Skip to content

Disabling a single ModSecurity rule for one cPanel account

How to scope a ModSecurity SecRuleRemoveById to a single cPanel account when a legitimate request gets blocked, without disabling the rule for every other tenant on the server.

A customer cannot save their WordPress post because ModSecurity rule 949110 blocks it as “Inbound Anomaly Score Exceeded.” The right fix is not to disable the rule for the entire server — that throws away the protection for every other account. The right fix is SecRuleRemoveById scoped to the offending account’s vhost, leaving the rule active for every other tenant.

What’s happening

ModSecurity rules are evaluated against every request unless explicitly disabled. SecRuleRemoveById tells the engine to skip a specific rule ID. Without a scope, the directive applies to the whole server. Inside a <LocationMatch> or vhost include scoped to one account, the directive applies only to requests matching that scope. cPanel exposes this through WHM > ModSecurity Tools > Rules List > Disable, but the per-rule disable there is global. To get per-account, use the Include Editor.

How to verify

Find the offending rule ID in the audit log:

tail -100 /etc/apache2/logs/modsec_audit.log | grep -A3 "id \""
tail -f /usr/local/apache/logs/error_log | grep "ModSecurity:"
whmapi1 modsec_get_rules | jq '.data.payload[] | select(.id == "949110")'

The audit log entry includes the rule ID, the matched data, and the vhost. Match the vhost to the customer’s domain.

The fix

  1. Confirm the rule ID and the customer’s vhost. The audit log line looks like [id "949110"] near [file "/etc/apache2/conf.d/modsec_vendor_configs/..."].
  2. WHM > Apache Configuration > Include Editor > Post VirtualHost Include > scope to the customer’s vhost > add:
    <IfModule mod_security2.c>
        SecRuleRemoveById 949110
    </IfModule>
  3. For a more targeted disable — only on the specific path that triggers it — wrap in a LocationMatch:
    <IfModule mod_security2.c>
        <LocationMatch "^/wp-admin/post.php$">
            SecRuleRemoveById 949110
        </LocationMatch>
    </IfModule>
    This leaves the rule active for the customer’s other URLs.
  4. apachectl -t && apachectl graceful. Re-test from the customer’s perspective.
  5. Document the disable. Log it in your ticketing system against the customer and the rule ID, with a one-line reason. The next time you audit ModSecurity overrides, that log makes it possible to ask “is this still needed?”
  6. Resist the temptation to disable rules en masse for an account that is hitting many. A handful of disables is normal; ten or more per account is a signal that either the application is genuinely doing things WAF rules object to (worth investigating) or the rule vendor is wrong for this workload (worth switching).

For environments where ModSecurity exceptions need to stay audited, Stack Harbor keeps a per-account exception registry under WHM server management.