ModSecurity web application firewall
ModSecurity is a firewall that inspects each web request before it reaches your site. It blocks requests that look like attacks, such as attempts to inject database commands. It's on for every Barbrick account.
What it blocks
- SQL injection (tricks to read or change your database)
- Cross-site scripting (code planted in a form field)
- Attempts to read files outside your site
- Known exploit patterns for popular software such as WordPress plugins
- Scanners and bots that probe for weak points
When it gets in the way
Rules sometimes block a legitimate action. These are called false positives. Typical cases:
- Saving a long post in WordPress that includes code snippets
- A contact form where someone pastes a web address and a quote mark
- Uploading a file or image with an odd name
- A plugin that sends unusual data to its own server
You'll usually see a "403 Forbidden" page, or the page fails to save. See 403 Forbidden.
How to tell it's ModSecurity
| Clue | Meaning |
|---|---|
| The block happens only when you submit a certain form or save a certain page | Likely a rule match on the content you sent |
| The same page loads fine when you view it | Rules usually act on submitted data |
The error log shows ModSecurity: Access denied |
Confirmed. See below |
| Block disappears from a different network | An IP block rather than ModSecurity. See Locked out |
The site's error log may show a line like this.
[Mon Nov 30 10:12:04.512 2026] [security2:error] [client 203.0.113.25]
ModSecurity: Access denied with code 403 (phase 2). Pattern match "union select"
at ARGS:content. [id "949110"] [uri "/wp-admin/post.php"]
| Part | Meaning |
|---|---|
client 203.0.113.25 |
The visitor's IP address |
Access denied with code 403 |
The request was blocked |
Pattern match "union select" |
What triggered it |
ARGS:content |
The form field that matched |
id "949110" |
The rule number. This is the most useful part for us |
uri |
The page being requested |
See Read your site's error log to find the log.
What to do
- Note the time, the page, what you were doing, and your IP address. You can find it by searching "what is my IP".
- Open a support request. Include the rule
idif you have it. See What to include when you ask for help. - We review the rule and, if safe, add an exception for your site. This is usually quick during business hours.
Note: You can turn ModSecurity off for a domain with its switch on the Web application firewall card in Account → Hosting → your site → Security, but please don't. It protects you against real attacks. Ask us for a rule exception instead, and use the switch only briefly to confirm ModSecurity is the cause.
Things you can try yourself
- Break up a very long edit into smaller saves.
- Remove code snippets or odd characters from the content, then add them back with a code block plugin.
- Rename a file to use only letters, numbers, and hyphens before uploading.
Still stuck? Ask us and we'll walk you through it.
