Reproducer and measurement notes for the Brotli decoder out-of-bounds write tracked as CVE-2026-111497, fixed by Apple in iOS 27.2.1. The same library flaw was fixed upstream in Google Brotli 1.2.1.
This repository contains a two-stage trigger generator, a decode harness, and
redacted evidence from runs against Apple's bundled Brotli decoder — including
the CFNetwork Content-Encoding: br response path on iOS 27.0.1. It documents
what the bug does on a real device (remote crash, oversized response body,
destination offset control), and states plainly what it does not do.
| Source | What it establishes |
|---|---|
| Apple advisory 149715 (iOS 27.2.1 / iPadOS 27.2.1, released November 9, 2026) | Component brotli; Impact: Processing maliciously crafted input may lead to memory corruption; An out-of-bounds write issue was addressed with improved input validation; CVE-2026-111497. The entry lists no external researcher credit. |
| NVD: CVE-2026-111497 (published 2026-10-22) | CVSS 3.1 base score 9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H); remote unauthenticated crafted stream; affects Google Brotli 1.0.3 through 1.2.0. |
| GHSA-9v8h-qqgm-4m35 | Severity critical; vulnerable range >= 1.0.3, < 1.2.1. |
Upstream fix 0ed4268a (Brotli 1.2.1) |
Rejects BlockSwitch commands when num_block_types < 2 with BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH (-17). |
The CVE assignment, affected component and fixed version are documented by Apple, NVD and the upstream project. This repository adds a reproducer and device-side measurements for the Apple build; it is not an Apple statement.
BlockSwitch commands are accepted for the literal, command and distance block
categories even when num_block_types < 2. A crafted second-stage stream then
supplies block-switch values that corrupt the decoder's output position
tracking, and the fast-path backward-reference copy in
ProcessCommandsInternal performs an out-of-bounds memmove16/copy relative
to the output ring buffer:
dst = ringbuffer + pos (pos = attacker-corrupted int32)
src = ringbuffer content (attacker-controlled decoded data)
len = attacker-influenced copy length
Upstream 1.2.1 rejects these BlockSwitch commands. Vulnerable builds return success and continue decoding with the corrupted state.
Instruction-level diff of Apple's bundled libcompression Brotli decoder:
- The six BlockSwitch functions (fast/safe × literal/command/distance) each grow by 12 bytes. Before applying a block switch they now load
num_block_types[i](struct offsets0x11c/0x120/0x124), compare it against 2, and fail with the new error code -17 (BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH) when fewer than two block types are defined. - Vulnerable builds instead return success (
mov w0, #0), which the callers misinterpret as "needs more input" — this is what lets the corrupted state persist instead of aborting the stream. BrotliDecoderErrorStringgrows by 36 bytes (error table extended to 34 entries) and gains the new"BLOCK_SWITCH"string;ProcessCommandsgrows by 76 bytes andSafeProcessCommandsshrinks by 20 bytes.- The patched code matches upstream commit
0ed4268a(Brotli 1.2.1).
Verified by disassembling the extracted libcompression.dylib from each DSC:
24A446 (27.0.1) vulnerable, 24B119 (27.2) vulnerable, 24B156 (27.2.1) patched,
24C5037i (27.3 beta 1) vulnerable.
The decoder must consume stage 1 completely (parking with "needs more input")
before stage 2 arrives; stage 2 then drives the corrupted block-switch path.
Concatenating both stages into a single buffer does not crash. This is why
the bug is reachable over HTTP Content-Encoding: br, where the response body
reaches the decoder in separate chunks.
All results below were observed on an iPhone 17,2 running 27.0.1 (24A446),
with the trigger delivered over HTTP as Content-Encoding: br.
NSURLSession fetches the response; stage 1 is flushed, stage 2 arrives in
fragments; the decoder faults inside libcompression ProcessCommands. This
is the baseline reproducer in this repository.
Serving stage 1 followed by the OOB-read stage 2 variant
(trigger_w13_second_oobread.bin, stage2[0x0B] = 0xff) makes CFNetwork
return a body of 8,391,286 bytes while the stream's legitimate decoded
size is 5,098 bytes. The client receives a normal response with a normal
END and the process stays alive. Three runs returned identical lengths.
The excess bytes are live process memory beyond the decoder's 10,240-byte
ring-buffer allocation: Mach-O paths, Foundation localization tables,
NSKeyedArchiver headers, BackBoard scene strings, and container paths. A
64 KiB identifier-redacted window from one body is published in
network_oob_read.sample.bin; per-run sizes and hashes are in
network_oob_read.stats.txt.
For the same trigger, the native client's spray canaries appear in the body (14/30 hits across runs), confirming that the read window overlaps the client process heap.
A WKWebView page served from the same origin performs fetch('/br2') and
receives the full 8,391,286 bytes as a normal ArrayBuffer
(st = 200, len = 8391286, no fetch error, no WebKit crash). With the app
process spraying 4,000 tagged blocks, the WebKit-delivered body contains zero
canary markers and byte-identical statistics, showing that the decode happens
outside the page's app process.
Scope: this proves attacker web content can receive the oversized body. It does not demonstrate directed extraction of browser secrets; follow-up runs with synthetic secret-bearing responses did not land the window on the targeted heap objects.
The 32-bit little-endian value at stage2 offset 0x0B (the field that is
0x2800 in the crash template) selects the destination offset d; the write
target is ringbuffer + d. Measured on device with an instrumented harness
that patches that field and captures the Mach exception:
d |
Observed result |
|---|---|
0x60000000 |
Fault address low 32 bits equal (rb + d) & 0xffffffff; the sum is unmapped, so the process stops before a write. |
0x2400 |
383 bytes written at rb + 0x2400 (inside the decoder's own 10,240-byte slot) and read back in the live process; content is the UTF-8 response text. |
0x2800 (template default) |
Original fixed overflow: write at rb + 0x202a with a 96-byte spill into the adjacent 10,240-byte block at rb + 0x2800. |
0x28ff |
The oversized-read path used in section 2: 8,391,286-byte body, normal END. |
0x2a00 |
Cross-slot value: crash inside libcompression before a landing write. |
| live object (dictionary count field) | Crash inside libcompression before the write; the dictionary count remained 4. |
Excerpts: landing_control.log.txt. This is an observed behaviour
study; the instrumented harness is not included. Addresses are run-specific.
With the in-process decoder harness, pointing the write at an
__NSMutableDictionary count field (base + 0x14) made the public -count API
return 23,666,792 (original value 4); the next dereference raised SIGSEGV
at 0x7069687340. This demonstrates corruption of a live pointer-bearing
object when the decoder runs in the attacker's own process. It is not a
cross-object write through the network stack.
- No code execution, no control-flow hijack, no PAC bypass.
- No kernel compromise; the component is user-space
libcompression. - No cross-object or live-object write over the network path. Aiming outside the decoder's own allocation ends in a crash (denial of service).
- No targeted secret extraction from browser or system processes.
| File | Purpose |
|---|---|
gen_trigger.c |
Two-stage trigger generator (wbits body d15 d19 d23 b7 out_prefix) |
decode_harness.c |
Decode harness feeding stage 1 in 64 KiB chunks, then stage 2 |
trigger_w13_first.bin |
Sample stage 1 (window bits 13, 23,068,693 B, md5 8262ad7ecd5263782080afcf2e3b585b) |
trigger_w13_second.bin |
Sample stage 2 for the crash path (127 B) |
trigger_w13_second_oobread.bin |
Stage 2 variant for the oversized-read path (127 B, stage2[0x0B] = 0xff) |
SHA256SUMS |
Hashes of the published evidence files |
network_oob_read.sample.bin |
64 KiB redacted window of an oversized network body |
network_oob_read.stats.txt |
Per-run body sizes, hashes and byte statistics |
web_fetch.log.txt |
WebKit fetch() result lines |
landing_control.log.txt |
Destination-control and object-corruption excerpts |
sanitize_evidence.py |
Scanner/redactor used before publishing evidence |
Against a brotli 1.2.0 source tree built with AddressSanitizer:
cc -fsanitize=address -g -O1 decode_harness.c \
-I /path/to/brotli-1.2.0/c/include \
/path/to/brotli-1.2.0/build/libbrotlidec.a \
/path/to/brotli-1.2.0/build/libbrotlicommon.a \
-o decode_harness./decode_harness trigger_w13_first.bin trigger_w13_second.binExpected: AddressSanitizer reports an invalid write in memmove16 (decode.c),
called from ProcessCommandsInternal — the corrupted pos makes
dst = ringbuffer + pos point outside the ring-buffer allocation.
The oversized-body result (section 2) requires HTTP delivery with a flushed stage 1 and a fragmented stage 2, as described above; the included harness is the crash reproducer.
network_oob_read.sample.bin— 64 KiB redacted window from a 8,391,286-byte body (source range[0x18d000, 0x19d000)of the raw dump).network_oob_read.stats.txt— body sizes, SHA-256 of the withheld full dumps, byte composition, canary control, redaction notes.web_fetch.log.txt— WebKitfetch()result lines from three runs.landing_control.log.txt— destination-control and in-process object-corruption excerpts.SHA256SUMS— hashes of the published evidence files.
Full memory dumps are withheld because they contain device process memory.
Their SHA-256 values are published so the withheld artifacts remain
verifiable. All published evidence was scanned with
sanitize_evidence.py; container UUIDs, user paths and the harness
bundle identifier are replaced with equal-length placeholders.
| Component | Status |
|---|---|
| Google Brotli 1.0.3 – 1.2.0 | Vulnerable |
| Google Brotli 1.2.1 | Fixed (upstream commit 0ed4268a) |
| Apple libcompression (iOS 27.0.1 / 24A446) | Vulnerable |
| Apple libcompression (iOS 27.2 / 24B119) | Vulnerable |
| Apple libcompression (iOS 27.2.1 / 24B156) | Fixed |
| Apple libcompression (iOS 27.3 beta 1 / 24C5037i) | Vulnerable |
For security research and education only. This is a memory-corruption reproducer (crash and out-of-bounds read/write demonstration), not a weaponized exploit.