Skip to content

Repository files navigation

🛡️ Imperva Cloud WAF

Header Normalization Bypass - CWE-436

Severity CWE CVE Status


Researcher: Juan Felipe Osorio Zapata - JF0x0r

Twitter


1. Executive Summary

A parsing differential in the Imperva Cloud WAF deep-packet inspection (DPI) engine allows complete evasion of field-specific security rules by substituting hyphens (-) with underscores (_) in sensitive HTTP headers. While the WAF applies signature-based decoding and blocking logic to canonical headers such as X-Forwarded-For, the underscore-delimited variant X_forwarded_for is processed as an opaque user-defined header, bypassing all field-specific inspection routines.

Many backend servers and frameworks (e.g., Nginx, IIS, and others) normalize or semantically interpret the underscored variant as equivalent to the hyphenated canonical form. This creates a tunneling vector: payloads that the WAF is explicitly configured to block in X-Forwarded-For pass unobstructed via X_forwarded_for, where the backend accepts and acts upon them.

This is a CWE-436: Interpretation Conflict between the security control (Imperva WAF) and the downstream consumer (origin server).


2. Technical Root Cause

Clarification on RFC 7230: RFC 7230 permits both - and _ as valid characters within header field-names. However, it does not mandate semantic equivalence between hyphenated and underscored forms. The vulnerability is not a protocol flaw; it is a product-specific parsing differential. Imperva's engine fails to canonicalize header names before applying field-specific deep inspection, causing X_forwarded_for (and similar variants) to evade security logic that strictly targets X-Forwarded-For.

The result is a security boundary violation: the WAF enforces policy on one syntactic representation while the backend interprets another representation of identical semantic intent.

RFC 7230 §3.2.6 — Supporting Evidence

The following excerpt from RFC 7230 §3.2.6 confirms that both - and _ are legal token characters in HTTP header field-names, which is the syntactic foundation that makes this bypass possible:

RFC 7230 §3.2.6 — token character definition

Affected headers exhibiting this behavior include, but are not limited to:

Canonical Header Bypass Variant
X-Forwarded-For X_forwarded_for
X-Original-Url X_original_url
X-Rewrite-Url X_rewrite_url
X-HTTP-Method-Override X_http_method_override

3. Proof of Concept

3.1 Automated Detection

Use the provided scanner to test a target endpoint. It sends paired payloads: one in the standard hyphenated header (STD) and one in the underscore variant (VAR). A classic bypass is flagged when STD=403 (blocked by field-specific rule) and VAR=200 (accepted).

pip install requests urllib3
python3 imperva_header_normalization.py https://target.example/

Scanner output — confirmed bypass detection:

Script output showing header normalization bypass detection


3.2 Manual PoC — Imperva-protected endpoint (imperva.com)

Step 1 — Canonical header blocked (HTTP 403):
The WAF correctly intercepts the request when X-Forwarded-For is used with a malicious payload.

403 Blocked — canonical X-Forwarded-For header

Step 2 — Underscore variant bypasses WAF (HTTP 200):
The identical payload delivered via X_forwarded_for reaches the origin server unfiltered.

200 OK — X_forwarded_for bypass


3.3 Manual PoC — support.imperva.com

The same differential was reproducible against Imperva's own support portal, demonstrating the bypass is not target-specific but engine-level.

Step 1 — Canonical header blocked (HTTP 403):

403 Blocked — support.imperva.com canonical header

Step 2 — Underscore variant bypasses WAF (HTTP 200):

200 OK — support.imperva.com bypass confirmed


4. Impact Assessment

Dimension Detail
Affected Product Imperva Cloud WAF (all tiers)
CWE CWE-436: Interpretation Conflict
CVSS v3.1 Base 8.6 (High) — AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N
Attack Vector Remote, unauthenticated
Scope Any application behind Imperva WAF relying on field-specific header rules

Exploitation scenarios enabled by this bypass

  • IP Spoofing via X_forwarded_for: Manipulate IP-based access controls, rate limiting, geo-fencing, and audit logs.
  • Path traversal / SSRF via X_original_url / X_rewrite_url: Trigger internal routing logic in frameworks that process these headers.
  • Method override via X_http_method_override: Invoke restricted HTTP verbs (DELETE, PUT, PATCH) through POST requests on backends that respect this header.
  • WAF rule nullification: Any field-specific signature rule (SQLi, XSS, RFI in header context) targeting canonical header names is silently defeated.

5. Affected Backend Normalization Behavior

The following server/framework behaviors make this bypass exploitable end-to-end:

Backend Normalization Behavior
Nginx Converts underscores to hyphens in proxied headers when underscores_in_headers on is set; silently drops underscored headers otherwise (attacker controls which path)
IIS / ASP.NET Exposes headers via ServerVariables using underscore-normalized keys (e.g., HTTP_X_FORWARDED_FOR), making both forms equivalent at the application layer
PHP $_SERVER keys are uppercased and hyphens replaced with underscores — X-Forwarded-For and X_forwarded_for both map to HTTP_X_FORWARDED_FOR
Apache mod_proxy Passes headers as-is; application frameworks perform normalization downstream
Node.js / Express Header names are lowercased; libraries that normalize separators treat both forms identically

6. Remediation

For Imperva (Vendor)

  1. Canonicalize header field-names before applying field-specific deep inspection rules — normalize both - and _ to a single representation at the DPI layer.
  2. Update signature matching to apply header-based rules to all syntactic variants of a target header, not just the canonical RFC form.
  3. Audit all field-specific rules for equivalent bypass exposure across other header normalization dimensions (case folding, whitespace, encoded characters).

For Defenders / WAF Operators

Until a vendor patch is available, the following mitigations reduce exposure:

# Nginx — deny underscore headers at the edge
underscores_in_headers off;   # default — drops headers with underscores
ignore_invalid_headers on;    # drop malformed/unknown headers
# Apache — strip non-standard headers before proxying
RequestHeader unset X_Forwarded_For
RequestHeader unset X_Original_Url
RequestHeader unset X_Rewrite_Url
RequestHeader unset X_Http_Method_Override
  • Custom WAF rules: Add explicit rules for underscore variants of all sensitive headers.
  • Allowlist known headers: Drop any header not in an explicitly approved list at the ingress layer.
  • Audit application logic: Ensure backend code does not act on underscored header variants without sanitization.

7. Disclosure Timeline

Date Event
23 Feb 2026 Vulnerability discovered and reported via authorized bug bounty platform.
23 Feb 2026 Bugcrowd triage responds: "Unable to identify immediate security impact" — marked Not Applicable.
28 Feb 2026 Direct outreach to Imperva security researcher Yohan Sillam (LinkedIn).
19 Mar 2026 Follow-up outreach to Imperva security researcher Daniel Johnston (LinkedIn).
Apr 2026 Imperva silently deploys a fix to the affected customer's managed WAF instance without acknowledging the report or issuing a public advisory.
Apr 2026 (Current) Public disclosure initiated. CVE ID request submitted to MITRE.

8. References


9. About the Researcher

Juan Felipe Osorio Zapata - JF0x0r
Independent Security Researcher

Focused on web application security, Android Hacking, Code Review, WAF evasion techniques, and protocol-level parsing differentials.

Portfolio Twitter Bugcrowd HackerOne


This research was conducted responsibly under coordinated disclosure principles. All testing was performed on authorized environments or Imperva's own infrastructure.

About

Imperva Cloud WAF bypass via HTTP header normalization differential (CWE-436) - PoC, analysis & remediation.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages