ModSecurity False Positives That Break WordPress Admin

A 403 on wp-admin usually means a web application firewall rule scored your own request as an attack. Here is how to find the rule ID that fired and exclude it without switching off ModSecurity.

By.

•

min read

Rows of pale vertical slats forming a barrier; small rounded capsules drift through the gaps while one amber capsule is caught between two slats.

Legitimate request caught in a firewall barrier

If your WordPress admin throws a 403 when you save a post, publish a product, or load the block editor — and the error never reaches PHP, never appears in the WordPress debug log, and disappears the moment your host “turns off the firewall” — you are looking at a ModSecurity false positive. A web application firewall rule has scored your own legitimate request as an attack and the web server has dropped it before WordPress ever ran.

The fix is not to disable ModSecurity. It is to find the numeric rule ID that fired, write an exclusion scoped to that rule and that one request parameter, and leave the remaining several hundred rules doing their job. That takes about fifteen minutes once you know where to look. This article shows where to look.

What a ModSecurity false positive looks like from inside WordPress

ModSecurity runs inside Apache, Nginx, or LiteSpeed, ahead of PHP. When it blocks a request, WordPress is never invoked, so every symptom you see is the absence of a response rather than an error message:

  • A bare “403 Forbidden” page from the web server, styled by the server, not by your theme.
  • In the block editor: “Updating failed. The response is not a valid JSON response.” The editor sent a POST to the REST API and got an HTML error page back.
  • Site Health reporting “The REST API encountered an unexpected result” with a 403.
  • WooCommerce checkout or a contact form submitting once and silently failing, usually only for certain customers.
  • Nothing at all in wp-content/debug.log, because PHP never executed.

That last point is the useful diagnostic. No PHP error and no WordPress log entry means the block happened upstream. If the same action succeeds from the command line with a minimal request, the difference is in the headers, cookies, or body your browser sent.

Why wp-admin trips WAF rules more than the front end does

The OWASP Core Rule Set, which is the rule set behind most ModSecurity deployments, is written to detect SQL injection, cross-site scripting, remote command execution and PHP injection in request data. The WordPress admin legitimately sends all of those shapes:

  • Post content contains HTML and sometimes JavaScript. That is what a post editor is for, and it reads identically to a stored XSS payload.
  • The theme and plugin file editors send raw PHP in a POST parameter, which is precisely what a PHP injection rule looks for.
  • The Customizer and the block editor send nested JSON full of braces, quotes and escape sequences.
  • Cookies accumulate. Analytics, session and attribution cookies get inspected like any other request data, and their values are often random strings. A random string eventually contains a substring that matches a command-injection pattern.

That last one is the cause most people never find, because it is not reproducible. A real case filed against the Core Rule Set project involved WordPress Site Health calling GET /wp-json/wp/v2/types/post?context=edit and being blocked by rules 932236 and 932220 (Unix command injection) because marketing attribution cookies contained the substrings fd and ||cmp, and by rule 933151 (medium-risk PHP function name) because a cookie name contained chr. None of that is WordPress’s doing, and none of it is stable from one request to the next — which is why “it works for me” is such a common and useless response.

Which rule families fire on WordPress admin

Core Rule Set rule IDs are grouped by attack class, and the first three digits tell you what tripped. These are the families that account for most WordPress admin false positives:

Rule ID prefixAttack classTypical WordPress trigger
920xxxProtocol enforcementUnusual headers, malformed Content-Length, long or repeated arguments from large forms
932xxxRemote command execution (Unix)Random substrings in cookie values that resemble shell commands or pipes
933xxxPHP injectionTheme/plugin file editor; PHP function names appearing in cookie names or post content
941xxxCross-site scriptingHTML or inline script saved in post content, widgets, or custom fields
942xxxSQL injectionApostrophes, comment syntax, or hex-looking strings in post bodies and search queries
949110Inbound anomaly score exceededNot a cause — this is the rule that performs the block once the score crosses the threshold

Rule 949110 is the one that appears in nearly every blocked-request log, and it is the one people most often try to disable. Disabling it switches off blocking for the entire rule set. It is the trigger, not the gun.

How anomaly scoring decides to block you

Modern Core Rule Set installations do not block on a single rule match. Each rule that fires adds points based on its severity, and the request is blocked only when the total crosses a threshold. The defaults, set in crs-setup.conf by rule 900110, are an inbound threshold of 5 and an outbound threshold of 4. The severity-to-score mapping is CRITICAL 5, ERROR 4, WARNING 3, NOTICE 2.

Because most detected threats carry a score of 5, the practical effect of the default threshold is that one critical match blocks the request. That is a deliberately strict setting, and it is why false positives surface so quickly on a content-heavy site.

Rules are also grouped into four paranoia levels, set via rule 900000. The project describes PL1 as “baseline security with a minimal need to tune away false positives,” PL2 as “rules that are adequate when real user data is involved,” PL3 as “online banking level security with lots of false positives,” and PL4 as rules strong enough to protect the “crown jewels.” Plenty of shared hosts ship PL2 or higher without mentioning it.

How to find the rule ID that blocked the request

Every exclusion starts with a rule ID, and guessing is a waste of an afternoon. Reproduce the failing action, then read the log.

On a self-managed server, the audit log is usually at /var/log/modsec_audit.log, and matching entries also land in the web server error log. You want four fields: the rule id, the msg, the matched variable, and the matched data.

# Find the most recent blocks and the rule IDs behind them
grep -Eo '\[id "[0-9]+"\].*\[msg "[^"]+"\]' /var/log/modsec_audit.log | tail -20

# Narrow to one request by its unique ID once you have it
grep -F 'UNIQUE_ID_HERE' /var/log/modsec_audit.log

The matched variable is the part that matters most. A log line reading Matched Data: ... found within ARGS:content tells you the post body tripped the rule; found within REQUEST_COOKIES:sbjs_first tells you a tracking cookie did. Those two findings lead to completely different exclusions, and writing the wrong one leaves the rule disabled far more broadly than it needed to be.

On cPanel servers you do not need shell access. WHM’s ModSecurity Tools interface has a Hits List showing the server’s history of rule events; clicking the Rule ID link in a hit lets you edit or disable that rule. Note two limitations the interface does not advertise loudly: it shows only the most relevant hit per request, so a request that tripped three rules may look like it tripped one, and vendor-supplied rules cannot be edited or deleted there. For the full picture you still need the Apache logs. Custom rules on EasyApache 4 live in /etc/apache2/conf.d/modsec/modsec2.user.conf, and changes are staged until you click Deploy and Restart Apache.

Writing the exclusion: four options, narrowest first

Exclusions come in two flavours. Configure-time exclusions are ModSecurity directives that remove a rule or a target from the firewall when the config loads. Runtime exclusions are themselves SecRule statements that apply only to requests matching a condition, usually a URI. Runtime exclusions must be defined before the Core Rule Set include; configure-time exclusions go after it.

ApproachScopeWhen to use it
ctl:ruleRemoveTargetById inside a URI-scoped SecRuleOne rule, one parameter, one URLDefault choice. Narrowest possible blast radius.
SecRuleUpdateTargetByIdOne rule, one parameter, site-wideWhen the same parameter trips the rule on many URLs.
SecRuleRemoveByIdOne rule, entirely, site-wideLast resort for a rule that is simply wrong for your stack.
Lower the paranoia levelDozens of rules at onceRarely. One setting disables a large block of detection.

A URI-scoped runtime exclusion looks like this. Custom rule IDs must come from the 1–99,999 range, which the project reserves for local use:

# In rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf
# Allow the WP REST API call that Site Health makes, without
# disabling cookie inspection anywhere else on the site.
SecRule REQUEST_URI "@beginsWith /wp-json/wp/v2/" \
    "id:10001,\
     phase:1,\
     nolog,\
     pass,\
     ctl:ruleRemoveTargetById=932236;REQUEST_COOKIES:sbjs_first,\
     ctl:ruleRemoveTargetById=932220;REQUEST_COOKIES:sbjs_current,\
     ctl:ruleRemoveTargetById=933151;REQUEST_COOKIES_NAMES"

Two syntax details cost people hours. The separator between the rule ID and the target is a semicolon, not a colon — 932236;REQUEST_COOKIES:PHPSESSID, not 932236:REQUEST_COOKIES:PHPSESSID. And the configure-time form uses a leading exclamation mark to mean “exclude this target”:

# In rules/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf
SecRuleUpdateTargetById 941320 "!ARGS:content"
SecRuleUpdateTargetById 930000-944999 "!ARGS:post_content"

Put exclusions in REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf and RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf, which exist precisely so your changes survive a Core Rule Set upgrade. Editing the shipped rule files directly means your next update silently reinstates every false positive you fixed.

If you are staring at a 403 on a client site right now and cannot get the host to tell you which rule fired, send us the URL and the time of the block — reading a ModSecurity audit log is a twenty-minute job for someone who does it weekly and a lost day for someone who doesn’t.

The shortcut most WordPress sites should take first

Before hand-writing anything, install the official WordPress rule-exclusions plugin. Core Rule Set 4 moved the per-application exclusion packages out of the main rule set and into a plugin system, and the WordPress package is maintained as wordpress-rule-exclusions, reserved rule ID range 9,507,000–9,507,999, Apache-2.0 licensed, and marked as tested in the project’s plugin registry.

Plugins live in a plugins/ folder alongside rules/, and the include order is fixed:

Include crs/crs-setup.conf
Include crs/plugins/*-config.conf
Include crs/plugins/*-before.conf
Include crs/rules/*.conf
Include crs/plugins/*-after.conf

Drop the plugin’s files into crs/plugins/, strip any .example suffix from the config file, reload the web server, and a large share of the standard WordPress false positives disappear without a line of hand-written config. To disable it later, rename the file to .disabled. This is a Core Rule Set 4 feature — hosts still on the 3.3.x line need the folder created manually.

The registry also lists a third-party wordpress-hardening-plugin. It adds restrictions rather than removing them — not what you want mid-diagnosis.

What not to do

Do not disable ModSecurity for the whole account. This is the standard support-ticket outcome, and it trades a working save button for your entire pre-PHP filtering layer. Plugin vulnerabilities get exploited at scale within days of disclosure, and the WAF is often the only thing between a known CVE and your database while you wait for a patch — see how attackers actually get in through plugin vulnerabilities.

Do not raise the anomaly threshold permanently. Pushing the inbound threshold from 5 to 50 stops the 403s and most of the blocking with them. Raising it temporarily to collect false positives is legitimate tuning — the netnea methodology starts effectively unlimited and walks down through 100, 50, 10 and finally 5 as exclusions are added. The operative words are walks down.

Do not disable rule 949110. It evaluates the accumulated score. Remove it and the rule set becomes detection-only while still writing every log line, so the server looks protected and isn’t.

Do not assume the WAF is the problem. A 403 on wp-admin can equally come from file permissions, a security plugin’s own firewall, or an .htaccess rule. Confirm the block appears in the audit log first. And if the site was recently compromised, a 403 may be the cleanup rather than the bug — our first-60-minutes incident guide covers telling those apart.

A tuning order that works

  1. Reproduce the failure and capture the timestamp.
  2. Pull the matching audit log entries; record every rule ID, not just the first.
  3. Discard 949110 from the list — it is the blocker, not a cause.
  4. For each remaining rule, note the matched variable (ARGS:x, REQUEST_COOKIES:y, REQUEST_HEADERS:z).
  5. Install the WordPress exclusions plugin and retest. Many of the IDs will stop appearing.
  6. Write URI-scoped ctl:ruleRemoveTargetById exclusions for whatever is left.
  7. Retest the full admin workflow: save a post, upload media, update a plugin, run Site Health, complete a test checkout.
  8. Re-test after the next host-side rule update, because vendor rule sets change without notice.

Step 8 is the one everybody skips. A host updating its ModSecurity vendor rules is the most common reason a site that worked yesterday throws 403s today with nothing changed on your side. If nobody retests admin workflows after host-side changes, the next false positive gets found by a customer instead of by you — the same failure mode behind our practical hardening checklist: controls nobody verifies after a change are controls you hear about when they break.

If wp-admin, your checkout, or your REST API is throwing 403s and the hosting support answer has been “we disabled the firewall for you,” talk to us about putting it back properly. Targeted exclusions take an hour or two to write and keep the protection you are already paying for.