Context
Azure Front Door Premium WAF with Microsoft_DefaultRuleSet 2.1. Before switching the managed rules from Log to Block, check what real traffic they would stop. A WAF policy can run in Prevention mode with the managed rule set action on Log (ruleSetAction: 'Log'). In that setup, custom rules such as rate limits block, while the managed rules only log.
Exclusions on RequestBodyPostArgNames for the upload field file were already in place for the SQLI, XSS and PROTOCOL-ENFORCEMENT groups.
Insight
- Uploads trip the General rules. Most legitimate browser multipart uploads match
General-200002(ParseBodyError) andGeneral-200003(strict multipart validation). Each scores 5, so together they reach the anomaly thresholdBLOCKING-EVALUATION-949110. Once the rule set action isBlock, these uploads are blocked. ID photos tripped the rules almost every time, documents about half the time. - The usual exclusions don’t help. A field exclusion covers the field value for the listed rule groups, not body parsing, so it does not cover the General rules.
- Exclusions don’t cover the multipart file name either. An apostrophe in a file name trips
920120/920121onMultipartFileName:file. - JSON inside a multipart field trips SQLI. Ordinary values set it off, for example a company name containing
&. - A common test value counts as an attack.
SQLI-942220matches the exact value0000012345, so testers who type it are flagged. - Everything else was scanners. The rest of the traffic that would have been blocked was scanner probes (
/.env,/.git/config,/.aws/credentials, injection on login paths), which the app already answered harmlessly. - Manual tests in log-only mode prove nothing about
Blockmode. A request that “passed the WAF” may still have reached 949110. Read the log.
Decision: keep the managed rules on Log and rely on the rate-limit custom rules in Prevention mode.
To make Block usable:
- Count the upload requests that reach 949110 (query below).
- Add narrow overrides for 200002/200003 on the upload paths only.
- Decide how to handle special characters in file names.
- Consider a 403 block response.
customBlockResponseStatusCodeis policy-wide, so with the rate-limit status a blocked upload shows up as a confusing 429.
Query: which requests would be blocked
Run against the Log Analytics workspace that receives the Front Door diagnostics. It joins the WAF log to the access log on trackingReference_s:
let waf = AzureDiagnostics| where TimeGenerated > ago(30d) and Category == "FrontDoorWebApplicationFirewallLog";let flagged = waf | where ruleName_s has "949110" | distinct trackingReference_s;AzureDiagnostics| where TimeGenerated > ago(30d) and Category == "FrontDoorAccessLog"| where httpMethod_s in ("POST","PUT")| extend path = tostring(parse_url(requestUri_s).Path)// optional: only your upload routes// | where path matches regex @'/(documents|upload)$'| extend path = replace_regex(path, @'[0-9a-fA-F-]{36}', '{id}') // group routes that differ only by ID| extend f = trackingReference_s in (flagged)| summarize total=count(), wouldBlock=countif(f), ok2xx=countif(f and httpStatusCode_s startswith "2") by httpMethod_s, path| where wouldBlock > 0 | order by wouldBlock descTo see which rules scored a request and what they matched, group FrontDoorWebApplicationFirewallLog by ruleName_s and details_matches_s for the upload paths.