ModSecurity started as an Apache module and became one of the most widely used WAF engines in hosting. OWASP has maintained it since 2024. The engine itself knows nothing about attacks; the rules tell it what to look for, so it’s always paired with a rule set such as OWASP CRS or a security vendor’s rules.
How it works
ModSecurity inspects traffic in phases:
- Phase 1: request headers, such as the User-Agent.
- Phase 2: the request body, meaning form data and uploads.
- Phases 3 and 4: response headers and body, to stop sensitive data leaking.
- Phase 5: logging.
Example: a simple rule
SecRule ARGS "@rx <script" \
"id:100001,phase:2,deny,status:403,log,msg:'XSS attempt in parameter'"
The rule says: if any request parameter contains <script, block the request in phase 2 with a 403 and log it. Every rule has a unique id, which is what you need when asking for an exclusion.
Example: an error log entry
ModSecurity: Access denied with code 403 (phase 2).
[id "942100"] [msg "SQL Injection Attack Detected via libinjection"]
[uri "/wp-admin/post.php"]
Here saving a post was blocked because rule 942100 was suspicious of its text. If the content is legitimate (say, a tutorial with SQL examples), that’s a false positive.
Common problems
- 403 when saving content or uploading files: see the ModSecurity 403 error page.
- Turning off the whole engine to fix one issue: that leaves the site unprotected; exclude one rule on one URL instead.
- Confusing it with a permissions error: not every 403 error is ModSecurity; file permissions or an .htaccess rule can cause one too.
On ArabyHost
ArabyHost runs the LiteSpeed web server with Imunify360 security, which includes ModSecurity-style WAF rules. Rules aren’t edited from inside your account, so if a legitimate action is blocked, send our Arabic support team the URL and the time of the error. You can also ask the Araby AI assistant in the panel to read the error log and explain the cause.
FAQ
Can I disable ModSecurity myself on shared hosting?
Usually not, because the rules are managed server-wide to protect every account. The right approach is to ask support to exclude the specific rule for the affected URL.
How do I know a 403 error comes from ModSecurity?
It happens only on a specific action, such as saving a post or submitting a form, while other pages work. The error log has a line starting with ModSecurity: Access denied.
What is OWASP CRS?
The OWASP Core Rule Set is a free, open-source rule collection used with ModSecurity. It covers SQL injection, XSS, command injection and other common attacks.