Disabling several mod_security rules due to 403 response to POST request?
I upgraded to WHM 76 and started having an issue where mod_security was blocking form submits that included code.
It seemed that whenever the server received a POST request that contained a lot of triangle brackets and matched some code rules/regex and took me to a 403 Forbidden error
This was an issue because I have a particular form in the Admin panel of our sites that allow the site administrator add Google Analytics or Google Tag Manager ads. I wrote my own special sanitization for these fields to prevent injection.
However, Apache still blocked these after my upgrade, so I went into WHM and looked at the "Hits List" in the Security Center => ModSecurity Tools.
I ended up disabling 6 rules here, and now it works. See screenshot.
The problem is, I feel like I "cured a headache with an axe" here. I didn't see a saw of modifying these rules in WHM to my own custom ones, moreover I'm not too familiar with writing secrules.
Based on my screenshot, what can be surmised about the importance of the rules I disabled? Is there any way to just exclude a particular POST request or whitelist the one form where I want to do this?
WHM/Cpanel version 76.0.20
-
Hello @orvn, Can you browse to WHM >> ModSecurity" Vendors and verify if there's a specific third-party rule-set that's enabled on this system? For instance, are you using the OWASP rule-set? Thank you. 0 -
Hello @orvn, Can you browse to WHM >> ModSecurity" Vendors and verify if there's a specific third-party rule-set that's enabled on this system? For instance, are you using the OWASP rule-set? Thank you.
Yes, so it says I have the OWASP ModSecurity Core Rule Set V3.0 (SpiderLabs OWASP curated ModSecurity) rule set with 17/22 enabled rules.0 -
Yes, so it says I have the OWASP ModSecurity Core Rule Set V3.0 (SpiderLabs OWASP curated ModSecurity) rule set with 17/22 enabled rules.
Hello @orvn, The OWASP rule set (like any custom ruleset) comes with a risk of false positives. We document a description of the specific rule groups along with instructions of what to do when you encounter a false positive at: OWASP ModSecurity CRS - cPanel Knowledge Base - cPanel Documentation If you want an easy way to only disable specific rules on individual accounts, the plugin noted in the previous post is indeed a useful tool to do this. Thank you.0 -
Thanks! That type 1 error doc is really useful. Man, looking through some of these OWASP rules I feel very grateful of the time and thought you guys and all the folks at OWASP put into this production-quality stuff. Thanks for your hard work. 0 -
Hello @orvn, The OWASP ruleset should also improve once we integrate version 3.1 with cPanel & WHM. Take a look at the following feature request and submit a vote to show your support: Update ModSecurity Vendor OWASP to OWASP ModSecurity Core Rule Set (CRS) 3.1 Thanks! 0
Please sign in to leave a comment.
Comments
6 comments