Skip to content
Hosting Operations8 min read

ModSecurity Rules in cPanel: 9 FAQs [Solved]

Fix ModSecurity false positives in cPanel by whitelisting rules per domain. Learn audit log analysis, OWASP CRS tuning, and safe rule management.

Written by Abdul AbrorTechnical Hosting Support Engineer
assorted icon lot
On this page

TL;DR — Key takeaways

  • ModSecurity in cPanel uses OWASP Core Rule Set by default; false positives require per-domain whitelisting, not global rule deletion.
  • Read audit logs at /usr/local/apache/logs/modsec_audit.log or through WHM's interface to identify which rule ID triggered the block.
  • Whitelist specific rule IDs for individual domains using ModSecurity Vendors in WHM or SecRuleRemoveById directives in .htaccess files.
  • Disabling ModSecurity globally removes protection against SQLi, XSS, and file upload attacks across all hosted sites.
  • Test rule changes on staging domains first; incorrect SecRule syntax can break Apache and take sites offline.

ModSecurity in cPanel ships with the OWASP Core Rule Set, a collection of patterns designed to block SQL injection, cross-site scripting, and file inclusion attacks. The rules run at the Apache layer, inspecting every HTTP request before it reaches your application. When a rule matches, ModSecurity returns a 403 or 406 error and logs the transaction.

False positives happen constantly. A legitimate POST request with JSON data might trigger rule 920273. A URL parameter containing a hyphen and number can match 942100. In support tickets I handled, the usual culprit was a WordPress plugin or custom form submitting data that looked suspicious to the ruleset. Disabling ModSecurity globally is dangerous; whitelisting the specific rule for the affected domain is the correct fix.

What is ModSecurity and how does it work in cPanel?

ModSecurity is an open-source web application firewall that runs as an Apache module. It evaluates HTTP requests against a set of rules, each with a unique ID, severity rating, and pattern match. cPanel includes ModSecurity by default and loads the OWASP CRS v3 or v4 ruleset depending on your version.

Each rule checks request headers, POST body data, query strings, or uploaded files. When a match occurs, ModSecurity can block the request, log it, or both. The action depends on the rule's configuration. Most OWASP rules use the "deny" action with a 403 status code.

Rules are organized by attack category: protocol violations (920000 series), SQL injection (942000), XSS (941000), and remote file inclusion (931000). A single request can trigger multiple rules if it contains several suspicious patterns.

How do I read ModSecurity audit logs in cPanel?

The audit log sits at /usr/local/apache/logs/modsec_audit.log on most cPanel servers. SSH in and run:

Each blocked request generates a section marked with a unique ID like [07/Aug/2026:06:45:12] [unique_id]. The section contains the full HTTP request, all matched rules, and the final action taken.

Look for lines starting with "Message:" — these show which rule ID fired. A line like "[id \"942100\"]" tells you rule 942100 matched. Note that ID; you'll need it for whitelisting.

WHM also provides a graphical viewer. Navigate to Security Center > ModSecurity Tools > Hits List. Filter by domain to narrow results. The interface shows rule IDs, request URLs, and timestamps in a table format.

  • tail -100 /usr/local/apache/logs/modsec_audit.log | grep -A 20 '403'
  • grep 'unique_id' /usr/local/apache/logs/modsec_audit.log | tail -10

How do I whitelist a ModSecurity rule for a specific domain?

Two methods exist: WHM's ModSecurity Vendors interface and manual Apache configuration. The WHM method is safer for multi-tenant environments.

In WHM, go to Security Center > ModSecurity Vendors. Click "Edit" next to OWASP. Scroll to the domain list and select your target domain. Add the rule ID (like 942100) to the "Disable Rules" field. Save and wait 60 seconds for Apache to reload.

For manual configuration, edit the domain's Apache include file. On EasyApache 4 systems, this is usually /etc/apache2/conf.d/userdata/std/2_4/username/domain.com/*.conf. Add these lines:

After editing, run '/scripts/rebuildhttpdconf && systemctl reload httpd' to apply changes. Test the previously blocked action immediately.

  • <IfModule mod_security2.c>
  • SecRuleRemoveById 942100 949110
  • </IfModule>

Can I use .htaccess to disable ModSecurity rules?

Yes, but only if the server administrator enabled AllowOverride for ModSecurity directives. Many hosting providers disable this for performance and security reasons.

If allowed, place this block in the domain's .htaccess file in the public_html directory:

This approach lets you control rules without SSH or WHM access. The downside: .htaccess files are processed on every request, adding slight overhead. For high-traffic sites, server-level configuration is faster.

  • <IfModule mod_security2.c>
  • SecRuleRemoveById 942100
  • SecRuleRemoveById 949110
  • </IfModule>

What are the most commonly whitelisted OWASP CRS rules?

From years of support tickets, these rule IDs generate the highest false-positive rate:

Rule 920273 fires on requests with invalid UTF-8 encoding. WordPress REST API calls sometimes trigger it. Rule 942100 detects SQL keywords in parameters; admin panels with search features hit this constantly.

Rule 949110 is an anomaly score threshold. OWASP CRS uses a scoring system: each suspicious pattern adds points, and 949110 blocks when the total exceeds five. Whitelisting 949110 alone won't help; you must disable the underlying rule that contributed to the score.

  • 920273: Invalid character in request
  • 942100: SQL injection attack detected via libinjection
  • 941100: XSS filter - Category 1: Script tag vector
  • 949110: Inbound anomaly score exceeded

Should I disable ModSecurity rules globally or per-domain?

Always prefer per-domain whitelisting. Global rule changes affect every site on the server. One customer's legitimate need to disable rule 942100 doesn't justify exposing 200 other sites to SQL injection.

I've seen servers compromised because an administrator globally disabled rules 930000-939999 (file upload checks) to fix one site's upload form. Attackers uploaded PHP shells to unrelated accounts within hours.

The only time to consider global changes: when you operate a single-tenant server and you've audited every application. Even then, document the change and set a calendar reminder to review it quarterly.

How do I test ModSecurity rule changes safely?

Set up a staging subdomain that mirrors production. Apply your whitelist changes there first. Run the blocked action again — form submission, API call, whatever triggered the original 403.

Check three things: the action completes successfully, no new errors appear in /var/log/apache2/error_log, and the ModSecurity audit log shows the request passed without blocks.

Syntax errors in SecRule directives will break Apache. Before applying changes to production, run 'apachectl configtest' after editing configuration files. If it returns "Syntax OK", you're safe to reload.

Wait 24 hours on staging. Monitor for edge cases: file uploads with different extensions, form submissions with special characters, authenticated vs. anonymous requests. Only migrate to production after confirming all variants work.

When should I actually disable ModSecurity entirely?

Short answer: almost never in production.

Disable it temporarily during emergency troubleshooting when you need to isolate whether ModSecurity is causing a site outage and you're under time pressure. The moment the incident is over, re-enable ModSecurity and whitelist the specific rules.

On development servers that sit behind a firewall with no public access, disabling ModSecurity is acceptable. The attack surface is minimal and false positives slow down testing.

For staging environments that receive real production traffic for A/B testing, keep ModSecurity enabled. Attackers scan staging subdomains just as aggressively as production.

How do I update OWASP CRS rules in cPanel?

cPanel packages OWASP CRS updates with its own releases. When you run 'yum update cpanel' or '/scripts/upcp', new rulesets install automatically if available.

Check your current CRS version in WHM under Security Center > ModSecurity Vendors. The version number appears next to "OWASP ModSecurity Core Rule Set".

Major CRS updates (v3 to v4) change rule IDs and detection logic. Your existing whitelists may become invalid. Before updating, export your current whitelist configuration from WHM. After the update, review audit logs for 72 hours and adjust whitelists as needed.

Manual CRS installation is possible but breaks cPanel's package management. Stick with the bundled version unless you're running custom rules that require a specific CRS release.

Quick troubleshooting checklist

  • Reproduce the blocked request and note the exact URL and POST data
  • Check /usr/local/apache/logs/modsec_audit.log for the transaction ID and rule ID
  • Verify the rule ID in WHM under ModSecurity Vendors
  • Create a domain-specific whitelist entry using SecRuleRemoveById in the domain's configuration
  • Test the previously blocked action to confirm it now completes
  • Monitor error logs for 48 hours to catch any secondary blocks
  • Document whitelisted rules and the business justification in your runbook

FAQ

How do I find which ModSecurity rule blocked my request in cPanel?

Check the ModSecurity audit log at /usr/local/apache/logs/modsec_audit.log via SSH or download it through WHM. Search for the timestamp of the blocked request. Each block shows a unique transaction ID, the triggered rule ID (like 949110), and the matched pattern. The rule ID is what you need to whitelist.

Can I disable a ModSecurity rule for one domain without affecting others in cPanel?

Yes. In WHM, go to Security Center > ModSecurity Vendors, then configure domain-specific rules. Add the rule ID to the whitelist for that single domain. Alternatively, place SecRuleRemoveById directives in the domain's Apache configuration or .htaccess file with the specific rule IDs to disable.

What happens if I disable ModSecurity completely in cPanel?

All OWASP CRS protections disappear: SQL injection filtering, XSS blocking, malicious file upload prevention, and bot traffic filtering stop working. Sites become exposed to automated attacks that scan for common vulnerabilities. Only disable ModSecurity temporarily for troubleshooting, then re-enable and whitelist specific rules instead.