Skip to content

Enabling OWASP CRS for ModSecurity on cPanel/WHM without breaking sites

How to switch a cPanel server to the OWASP Core Rule Set in detection mode first, watch the audit log, then enable blocking once the noise is gone.

A cPanel server with ModSecurity enabled but no vendor rules loaded is a placebo. The decision most operators face is which rule set to use, and how to turn it on without taking the busiest customer site offline at 09:00. The OWASP Core Rule Set (CRS) is the rule set we standardize on for cPanel hosts that have not bought a commercial WAF.

What’s happening

WHM ships ModSecurity, but rules are vendor-supplied: OWASP CRS, Comodo CWAF, or third-party. CRS is the most-maintained free option, with paranoia levels 1 through 4. The trap is that levels 3 and 4 will block legitimate WordPress admin POSTs out of the box, so flipping the rule set to blocking mode on a live server is how you generate a queue of “site is down” tickets.

How to verify

whmapi1 modsec_get_configs
whmapi1 modsec_get_rules vendor_id=OWASP3
modsec --list rules vendor=OWASP3 | head -40
grep -E "id:9[0-9]{5}" /usr/local/apache/logs/modsec_audit.log | tail

Confirm CRS is installed, confirm the paranoia level set in modsecurity.conf, and confirm whether SecRuleEngine is DetectionOnly or On.

The fix

  1. In WHM > ModSecurity Vendors, install OWASP ModSecurity Core Rule Set v3 if missing.
  2. Set SecRuleEngine DetectionOnly in the main ModSecurity config. Apply, restart Apache.
  3. Set CRS paranoia level to 1 initially. Let it run 48–72 hours over a representative traffic window.
  4. Tail modsec_audit.log, list every rule ID that fires for legitimate traffic, and add per-site exclusions in WHM > ModSecurity Tools.
  5. Flip SecRuleEngine On. Watch for the next 24 hours.
  6. Move to paranoia level 2 only after the level-1 noise is fully tuned out. Repeat the audit.

For environments where this should stay tuned across dozens of accounts, Stack Harbor handles WAF lifecycle as part of cPanel server management.