# HTTP/2 Downgrade Smuggling > A front-end speaks unambiguous HTTP/2 to clients but rewrites requests to HTTP/1.1 upstream, re-introducing framing ambiguity (H2.CL / H2.TE) and permitting characters HTTP/1 forbids. ## How it works HTTP/2 is binary: each message body is carried in DATA frames with a built-in length field, so `Content-Length` and `Transfer-Encoding` are redundant and there is little room for framing ambiguity. The ambiguity returns at **HTTP/2 downgrading** — a front-end that talks H/2 to the client but forwards HTTP/1.1 to the back-end. The back-end no longer sees the frame length and must fall back to CL or TE, which the attacker controls ([[raw/portswigger.net/http-2-the-sequel-is-always-worse-6639|HTTP/2: The Sequel]]). - **H2.CL** — the H/2 request carries an attacker-set `content-length` that the downgrade copies verbatim without validating against the frame length; the back-end stops early and the remainder is a smuggled prefix (Netflix). - **H2.TE** — the RFC says connection-specific fields like `Transfer-Encoding` must make a message malformed, but many front-ends accept TE in an H/2 request and emit it on downgrade, so the back-end chunk-parses while the front-end used the frame length. - **Binary-header injection** — H/2's header compression lets you place `\r\n`, colons in header names, and spaces in the `:method`/`:path` where HTTP/1 is plaintext-impossible. Servers are expected to re-impose HTTP/1 restrictions during the downgrade and frequently don't, yielding request-header injection (inject a `Transfer-Encoding`), full request-line injection, or request splitting with a double-`\r\n`. Because the client-side protocol is unambiguous, an H/2 response body that contains raw HTTP/1 headers is itself proof of a desync — a cleaner confirmation signal than HTTP/1.1 keep-alive gives. ## Techniques / payloads - **Detect** with HTTP Request Smuggler's timeout-based H2.x methods, or `curl --http2 --http2-prior-knowledge` to reach H/2 surface hidden behind servers that support H/2 but don't advertise it via ALPN. - **`\r\n` in a header value** injects an extra `Transfer-Encoding: chunked` on downgrade → H2.TE (Netlify/Firefox start page). - **Double-`\r\n`** terminates the first request inside a header and emits a clean second request — smuggling exactly two requests, which drives Response Queue Poisoning (Jira). Blocking `\r\n` but not bare `\n` is the classic failed hotfix. - **Pseudo-header abuse:** multiple `:path` headers (servers disagree which they route), `:authority` vs `Host` for Host-header attacks, and `:scheme` with arbitrary bytes to override the path or build an SSRF/cache-poisoning URL — the last works even without downgrading ([[Host Header SSRF]]). - **mod_proxy request-line injection** — Apache allowed spaces in `:method`, letting `GET /admin HTTP/1.1` ride in the method to bypass `ProxyMatch` deny rules (CVE-2021-33193). ## Notable cases - **Netflix / Netty / Zuul (CVE-2021-21295)** — H2.CL, redirected JS includes to compromise accounts, $20k ([[raw/portswigger.net/http-2-the-sequel-is-always-worse-6639|HTTP/2: The Sequel]]). - **AWS Application Load Balancer** — accepted `Transfer-Encoding` over H/2, exposing nearly every site behind it (Verizon law-enforcement portal: OAuth code via `Referer`; AOL/Athena CMS: CORS-credential theft). Imperva Cloud WAF also vulnerable. - **Atlassian Jira (PulseSecure vTM)** — double-`\r\n` RQP served other users' responses incl. `Set-Cookie`, forcing a global session expiry; F5 BIG-IP and Netlify shared the two-request RQP path, $15k×3. - **Varnish (CVE-2021-36740)** — H2 request smuggling via H/2→H/1 rewrite dropping the content-length check; reproducible in a documented Docker lab ([[raw/labs.detectify.com/how-to-set-up-docker-for-varnish-http-2-request-smuggling-6629|Varnish H2 smuggling]]). ## Defenses - **Use HTTP/2 end-to-end; do not downgrade upstream** — the root-cause fix ([[raw/apisec.ai/http-request-smuggling-in-api-gateways-3987|API Gateways]]). gRPC meshes inherit H/2 framing for back-ends that can't speak H/2 directly. - If downgrading, enforce HTTP/1 charset limits during rewrite: reject newlines in header values, colons in header names, spaces in the method, and connection-specific headers (TE). Validate any `content-length` against the frame length. - Treat `:scheme`/`:authority`/multiple `:path` as untrusted inputs needing validation. ## Related - [[HTTP Request Smuggling]] — parent guide. - [[CL.TE and TE.CL Desync]] — the HTTP/1.1 ambiguity that downgrading reintroduces. - [[Client-Side and Connection-Locked Desync]] · [[API Gateway Security]] · [[Host Header SSRF]] · [[Web Cache Poisoning]] ## Sources - [[raw/portswigger.net/http-2-the-sequel-is-always-worse-6639|HTTP/2: The Sequel is Always Worse]] - [[raw/portswigger.net/advanced-request-smuggling-5092|Advanced request smuggling]] - [[raw/labs.detectify.com/how-to-set-up-docker-for-varnish-http-2-request-smuggling-6629|Varnish HTTP/2 request smuggling]] - [[raw/apisec.ai/http-request-smuggling-in-api-gateways-3987|HTTP Request Smuggling in API Gateways]]