Every tuned ModSecurity deployment ends up with a stack of local overrides. The mistake we see most often is editing the vendor rule files directly. The next vendor update erases the edits and the false positives return — sometimes with a few hours of customer downtime in between.
What’s happening
cPanel keeps vendor rules under /etc/apache2/conf.d/modsec_vendor_configs/<vendor>/. These files are owned by the vendor package and rewritten on update. WHM exposes a “disabled rules” interface and a “custom rules” interface that survive vendor refreshes. Both write to separate files (whm_modsec_*.conf) that are loaded after vendor rules and override them.
How to verify
whmapi1 modsec_get_settings
whmapi1 modsec_get_rules vendor_id=OWASP3 enabled=0 | head
ls -lt /etc/apache2/conf.d/modsec_vendor_configs/OWASP3/ | head
grep -l "SecRuleRemoveById" /etc/apache2/conf.d/whm_modsec_*.conf
If your customizations live anywhere other than the whm_modsec_*.conf files, they will not survive the next update.
The fix
- Never edit vendor files. Treat
/etc/apache2/conf.d/modsec_vendor_configs/as read-only. - Use WHM > ModSecurity Tools > Rules List > Disable for a clean toggle that survives updates and shows up in the UI.
- Use Custom Rules in WHM for scoped exclusions:
SecRuleUpdateTargetById 942100 "!ARGS:wp_nonce"inside a<LocationMatch "/wp-admin/admin-ajax.php">block. - For paranoia level shifts in CRS, write a single configuration override file under
/etc/apache2/conf.d/modsec2.user.confthat setstx.crs_setup_versionand the paranoia variables. Comment the rationale inline. - Quarterly, diff
whm_modsec_*.confagainst an archived copy. If your local overrides outnumber 30 lines, the rule set choice itself probably needs revisiting.
Stack Harbor reviews these override files at takeover and on each major cPanel update under WHM server management.