
Proof-of-concept and differential lab for CVE-2026-128014: a two-chunk Brotli stream pins FrankenPHP 1.13.1 request workers in a non-terminating decode loop (DoS).
| CVE | CVE-2026-128014 |
| Component | FrankenPHP static binary — bundled PHP brotli extension (ext-brotli 0.21.0) statically linked against the Brotli decoder |
| Affected | FrankenPHP 1.13.1 (Brotli 1.2.0); all builds shipping Brotli < 1.2.1 |
| Fixed in | FrankenPHP 1.13.2 (Brotli 1.2.1, upstream fix 0ed4268a) |
| CWE | CWE-835 (Loop with Unreachable Exit Condition), CWE-754 (Improper Check for Unusual or Exceptional Conditions) |
| Impact | Denial of service — an unauthenticated request pins a request worker in a non-terminating decode loop that consumes CPU indefinitely |
| Vector | HTTP POST whose request body is fed to one incremental brotli_uncompress_add() decoder in two chunks |
| Trigger | 22-byte malformed stream + spray, chunk boundary at offset 17 |
| Credit | Upstream advisory GHSA-p746-jj3f-94p8 (FrankenPHP security release) |
A single unauthenticated HTTP request whose body reaches brotli_uncompress_add() in two chunks drives the Brotli 1.2.0 decoder bundled in FrankenPHP 1.13.1 into a decode loop that never terminates: the request never returns, the worker thread spins on a full CPU core, and enough concurrent requests exhaust the worker pool. FrankenPHP 1.13.2 — identical base image, config, app and entrypoint, only the bundled Brotli bumped 1.2.0 → 1.2.1 — rejects the same bytes in ~60 ms with brotli_uncompress_add(): failed to uncompress and keeps serving. The differential was validated against the official upstream binaries and against AddressSanitizer source builds of both Brotli versions across a 36-configuration matrix.
Brotli encodes per-block-type counts (NBLTYPESL/C/D) in the metablock header. A block switch command is only legal when the corresponding NBLTYPES is ≥ 2. When the literal block-length counter reaches zero mid-metablock, ProcessCommandsInternal must perform a literal block switch, and 1.2.0 reports the illegal switch the same way it reports "need more input":
c/dec/decode.c, Brotli 1.2.0, line 1189:
static BROTLI_INLINE BROTLI_BOOL DecodeBlockTypeAndLength(
int safe, BrotliDecoderState* s, int tree_type) {
brotli_reg_t max_block_type = s->num_block_types[tree_type];
...
if (max_block_type <= 1) {
return BROTLI_FALSE; /* illegal switch — but FALSE means "no input" */
}
The fast path of the command loop discards that return value outright — c/dec/decode.c, lines 1943–1953 and 2332–2334:
#define BROTLI_SAFE(METHOD) \
{ \
if (safe) { \
if (!Safe##METHOD) { \
result = BROTLI_DECODER_NEEDS_MORE_INPUT; \
goto saveStateAndReturn; \
} \
} else { \
METHOD; /* return value dropped */ \
} \
}
...
NextLiteralBlock:
BROTLI_SAFE(DecodeLiteralBlockSwitch(s)); /* safe == 0 here */
goto CommandInner; /* block_length[0] still 0 */
The arithmetic that breaks: with NBLTYPESL == 1, max_block_type == 1, so every trip through CommandInner sees block_length[0] == 0, jumps to NextLiteralBlock, executes the switch, gets BROTLI_FALSE, drops it, and returns to CommandInner. Nothing advances — no input is consumed, no output is produced, no state changes. The loop is unbounded by construction:
CommandInner ──(block_length[0] == 0)──▶ NextLiteralBlock
▲ │
└── DecodeLiteralBlockSwitch → FALSE ◀───┘ (result discarded, safe == 0)
Each pass burns CPU; the decoder never parks, so the incremental add() call never returns and the request worker is pinned for the lifetime of the process. This is the same discarded-return defect class upstream fixed in 0ed4268a for CVE-2026-111497; on this x86-64 static build the discarded value manifests as the non-terminating loop rather than the out-of-bounds write, because the loop is reached with input still pending and never hands control back to the caller.
Fix commit 0ed4268a (shipped in Brotli 1.2.1 / FrankenPHP 1.13.2):
static BROTLI_INLINE BrotliDecoderErrorCode DecodeBlockTypeAndLength(
int safe, BrotliDecoderState* s, int tree_type) {
...
if (max_block_type <= 1) {
return BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH; /* -17, a real error */
}
...
#define BROTLI_SAFE_WITH_STATUS(METHOD) \
{ \
BrotliDecoderErrorCode status; \
if (safe) { status = Safe##METHOD; } \
else { status = METHOD; } \
if (status != BROTLI_DECODER_SUCCESS) { \
result = status; \
goto saveStateAndReturn; \
} \
}
BROTLI_SAFE_WITH_STATUS propagates -17 BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH out of the decode loop in both the fast and the safe path, so the impossible switch terminates the stream instead of feeding the loop.
The lab is a differential environment: one target image, two builds, identical in every respect except the bundled FrankenPHP release.
vuln — official FrankenPHP 1.13.1 Linux x86-64 static binary, Brotli 1.2.0, port 8081.
fixed — official FrankenPHP 1.13.2 Linux x86-64 static binary, Brotli 1.2.1, port 8082.
Both run the same PHP 8.5.12 runtime, the same ext-brotli 0.21.0 extension, the same Caddyfile and the same lab/app/index.php, which exposes the real attack surface:
POST /decompress?split=N — splits the raw request body into two chunks at byte N and feeds them to one incremental decoder: brotli_uncompress_init(), brotli_uncompress_add($ctx, $chunk1, BROTLI_FLUSH), brotli_uncompress_add($ctx, $chunk2, BROTLI_FINISH). This is exactly the shape the upstream advisory names.POST /decompress-guarded?split=N — the same vulnerable binary behind the published workaround: untrusted requests are rejected with 403 before brotli is touched.GET / — build fingerprint: FrankenPHP version, PHP version, ext-brotli version and the linked Brotli library version (BROTLI_VERSION_TEXT, 1.2.0 vs 1.2.1), the per-build differential observable.Each target runs under lab/supervisor.sh, which records the process exit status to /tmp/exit-status and the full log to /tmp/frankenphp.log, so a worker death is a durable observable as well.
A companion source-level differential harness (AddressSanitizer builds of pristine Brotli 1.2.0 and 1.2.1) replicates the extension's exact call pattern — 512 KiB output buffer, loop on NEEDS_MORE_OUTPUT — and is used to classify the decoder without the HTTP layer.
./run-lab.sh build # fetch the two official binaries, build both images
./run-lab.sh up # start vuln (8081) + fixed (8082) on network cve128014lab
./run-lab.sh sweep # run the full differential PoC from inside the poc container
./run-lab.sh down # tear down
run-lab.sh drives podman compose; the compose file pins --cpus 2 --memory 4g per container and the dedicated cve128014lab network. Every PoC mode can also be run standalone from a container on that network:
podman run --rm --network=cve128014lab -v "$PWD/poc/poc.py:/opt/poc/poc.py:Z" \
python:3.12-alpine python /opt/poc/poc.py exploit \
--vuln http://vuln:8080 --fixed http://fixed:8080 --timeout 8