[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-114560":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":10,"openIssues":12,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":12,"stars7d":12,"stars30d":13,"stars90d":12,"forks30d":12,"starsTrendScore":12,"compositeScore":14,"rankGlobal":8,"rankLanguage":8,"license":15,"archived":16,"fork":16,"defaultBranch":17,"hasWiki":18,"hasPages":16,"topics":19,"createdAt":8,"pushedAt":20,"updatedAt":21,"readmeContent":22,"aiSummary":23,"trendingCount":12,"starSnapshotCount":12,"syncStatus":24,"lastSyncTime":25,"discoverSource":26},114560,"CVE-2026-111497-PoC","MchinaMd57764\u002FCVE-2026-111497-PoC","MchinaMd57764",null,"C",51,12,0,1,40.44,"MIT License",false,"main",true,[],"2026-11-12 20:33:58","2026-11-21 07:09:19","# CVE-2026-111497 — Brotli BlockSwitch out-of-bounds write (Apple libcompression)\n\nReproducer and measurement notes for the Brotli decoder out-of-bounds write\ntracked as **CVE-2026-111497**, fixed by Apple in iOS 27.2.1. The same library\nflaw was fixed upstream in Google Brotli **1.2.1**.\n\nThis repository contains a two-stage trigger generator, a decode harness, and\nredacted evidence from runs against Apple's bundled Brotli decoder — including\nthe CFNetwork `Content-Encoding: br` response path on iOS 27.0.1. It documents\nwhat the bug does on a real device (remote crash, oversized response body,\ndestination offset control), and states plainly what it does not do.\n\n## References and authenticity\n\n| Source | What it establishes |\n|---|---|\n| [Apple advisory 149715](https:\u002F\u002Fsupport.apple.com\u002Fen-us\u002F149715) (iOS 27.2.1 \u002F 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. |\n| [NVD: CVE-2026-111497](https:\u002F\u002Fnvd.nist.gov\u002Fvuln\u002Fdetail\u002FCVE-2026-111497) (published 2026-10-22) | CVSS 3.1 base score **9.8** (`AV:N\u002FAC:L\u002FPR:N\u002FUI:N\u002FS:U\u002FC:H\u002FI:H\u002FA:H`); remote unauthenticated crafted stream; affects Google Brotli 1.0.3 through 1.2.0. |\n| [GHSA-9v8h-qqgm-4m35](https:\u002F\u002Fgithub.com\u002Fadvisories\u002FGHSA-9v8h-qqgm-4m35) | Severity critical; vulnerable range `>= 1.0.3, \u003C 1.2.1`. |\n| Upstream fix `0ed4268a` (Brotli 1.2.1) | Rejects BlockSwitch commands when `num_block_types \u003C 2` with `BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH` (-17). |\n\nThe CVE assignment, affected component and fixed version are documented by\nApple, NVD and the upstream project. This repository adds a reproducer and\ndevice-side measurements for the Apple build; it is not an Apple statement.\n\n## Root cause\n\nBlockSwitch commands are accepted for the literal, command and distance block\ncategories even when `num_block_types \u003C 2`. A crafted second-stage stream then\nsupplies block-switch values that corrupt the decoder's output position\ntracking, and the fast-path backward-reference copy in\n`ProcessCommandsInternal` performs an out-of-bounds `memmove16`\u002Fcopy relative\nto the output ring buffer:\n\n```\ndst = ringbuffer + pos   (pos = attacker-corrupted int32)\nsrc = ringbuffer content (attacker-controlled decoded data)\nlen = attacker-influenced copy length\n```\n\nUpstream 1.2.1 rejects these BlockSwitch commands. Vulnerable builds return\nsuccess and continue decoding with the corrupted state.\n\n## Apple patch diff (iOS 27.2 24B119 → iOS 27.2.1 24B156)\n\nInstruction-level diff of Apple's bundled `libcompression` Brotli decoder:\n\n- The six BlockSwitch functions (fast\u002Fsafe × literal\u002Fcommand\u002Fdistance) each grow by 12 bytes. Before applying a block switch they now load `num_block_types[i]` (struct offsets `0x11c` \u002F `0x120` \u002F `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.\n- 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.\n- `BrotliDecoderErrorString` grows by 36 bytes (error table extended to 34 entries) and gains the new `\"BLOCK_SWITCH\"` string; `ProcessCommands` grows by 76 bytes and `SafeProcessCommands` shrinks by 20 bytes.\n- The patched code matches upstream commit `0ed4268a` (Brotli 1.2.1).\n\nVerified by disassembling the extracted `libcompression.dylib` from each DSC:\n24A446 (27.0.1) vulnerable, 24B119 (27.2) vulnerable, 24B156 (27.2.1) patched,\n24C5037i (27.3 beta 1) vulnerable.\n\n## Delivery model: two separate decoder inputs\n\nThe decoder must consume stage 1 completely (parking with \"needs more input\")\nbefore stage 2 arrives; stage 2 then drives the corrupted block-switch path.\nConcatenating both stages into a single buffer does **not** crash. This is why\nthe bug is reachable over HTTP `Content-Encoding: br`, where the response body\nreaches the decoder in separate chunks.\n\n## Verified behaviour on iOS 27.0.1 (24A446)\n\nAll results below were observed on an iPhone 17,2 running 27.0.1 (24A446),\nwith the trigger delivered over HTTP as `Content-Encoding: br`.\n\n### 1. Remote crash through the system network stack\n\n`NSURLSession` fetches the response; stage 1 is flushed, stage 2 arrives in\nfragments; the decoder faults inside `libcompression` `ProcessCommands`. This\nis the baseline reproducer in this repository.\n\n### 2. Out-of-bounds read: an 8,391,286-byte body instead of 5,098 bytes\n\nServing stage 1 followed by the OOB-read stage 2 variant\n(`trigger_w13_second_oobread.bin`, stage2[0x0B] = `0xff`) makes CFNetwork\nreturn a body of **8,391,286 bytes** while the stream's legitimate decoded\nsize is **5,098 bytes**. The client receives a normal response with a normal\nEND and the process stays alive. Three runs returned identical lengths.\n\nThe excess bytes are live process memory beyond the decoder's 10,240-byte\nring-buffer allocation: Mach-O paths, Foundation localization tables,\nNSKeyedArchiver headers, BackBoard scene strings, and container paths. A\n64 KiB identifier-redacted window from one body is published in\n`network_oob_read.sample.bin`; per-run sizes and hashes are in\n`network_oob_read.stats.txt`.\n\nFor the same trigger, the native client's spray canaries appear in the body\n(14\u002F30 hits across runs), confirming that the read window overlaps the\nclient process heap.\n\n### 3. Reachable from web content\n\nA WKWebView page served from the same origin performs `fetch('\u002Fbr2')` and\nreceives the full 8,391,286 bytes as a normal `ArrayBuffer`\n(`st = 200`, `len = 8391286`, no fetch error, no WebKit crash). With the app\nprocess spraying 4,000 tagged blocks, the WebKit-delivered body contains zero\ncanary markers and byte-identical statistics, showing that the decode happens\noutside the page's app process.\n\nScope: this proves attacker web content can receive the oversized body. It\ndoes not demonstrate directed extraction of browser secrets; follow-up runs\nwith synthetic secret-bearing responses did not land the window on the\ntargeted heap objects.\n\n### 4. Destination control (network path)\n\nThe 32-bit little-endian value at stage2 offset `0x0B` (the field that is\n`0x2800` in the crash template) selects the destination offset `d`; the write\ntarget is `ringbuffer + d`. Measured on device with an instrumented harness\nthat patches that field and captures the Mach exception:\n\n| `d` | Observed result |\n|---|---|\n| `0x60000000` | Fault address low 32 bits equal `(rb + d) & 0xffffffff`; the sum is unmapped, so the process stops before a write. |\n| `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. |\n| `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`. |\n| `0x28ff` | The oversized-read path used in section 2: 8,391,286-byte body, normal END. |\n| `0x2a00` | Cross-slot value: crash inside libcompression before a landing write. |\n| live object (dictionary count field) | Crash inside libcompression before the write; the dictionary count remained 4. |\n\nExcerpts: `landing_control.log.txt`. This is an observed behaviour\nstudy; the instrumented harness is not included. Addresses are run-specific.\n\n### 5. Object corruption in the decoder's own process (not the network path)\n\nWith the in-process decoder harness, pointing the write at an\n`__NSMutableDictionary` count field (base + 0x14) made the public `-count` API\nreturn **23,666,792** (original value 4); the next dereference raised SIGSEGV\nat `0x7069687340`. This demonstrates corruption of a live pointer-bearing\nobject when the decoder runs in the attacker's own process. It is not a\ncross-object write through the network stack.\n\n### 6. What is not demonstrated\n\n- No code execution, no control-flow hijack, no PAC bypass.\n- No kernel compromise; the component is user-space `libcompression`.\n- No cross-object or live-object write over the network path. Aiming outside\n  the decoder's own allocation ends in a crash (denial of service).\n- No targeted secret extraction from browser or system processes.\n\n## Files\n\n| File | Purpose |\n|---|---|\n| `gen_trigger.c` | Two-stage trigger generator (`wbits body d15 d19 d23 b7 out_prefix`) |\n| `decode_harness.c` | Decode harness feeding stage 1 in 64 KiB chunks, then stage 2 |\n| `trigger_w13_first.bin` | Sample stage 1 (window bits 13, 23,068,693 B, md5 `8262ad7ecd5263782080afcf2e3b585b`) |\n| `trigger_w13_second.bin` | Sample stage 2 for the crash path (127 B) |\n| `trigger_w13_second_oobread.bin` | Stage 2 variant for the oversized-read path (127 B, stage2[0x0B] = `0xff`) |\n| `SHA256SUMS` | Hashes of the published evidence files |\n| `network_oob_read.sample.bin` | 64 KiB redacted window of an oversized network body |\n| `network_oob_read.stats.txt` | Per-run body sizes, hashes and byte statistics |\n| `web_fetch.log.txt` | WebKit `fetch()` result lines |\n| `landing_control.log.txt` | Destination-control and object-corruption excerpts |\n| `sanitize_evidence.py` | Scanner\u002Fredactor used before publishing evidence |\n\n## Build\n\nAgainst a brotli **1.2.0** source tree built with AddressSanitizer:\n\n```sh\ncc -fsanitize=address -g -O1 decode_harness.c \\\n   -I \u002Fpath\u002Fto\u002Fbrotli-1.2.0\u002Fc\u002Finclude \\\n   \u002Fpath\u002Fto\u002Fbrotli-1.2.0\u002Fbuild\u002Flibbrotlidec.a \\\n   \u002Fpath\u002Fto\u002Fbrotli-1.2.0\u002Fbuild\u002Flibbrotlicommon.a \\\n   -o decode_harness\n```\n\n## Reproduce\n\n```sh\n.\u002Fdecode_harness trigger_w13_first.bin trigger_w13_second.bin\n```\n\nExpected: AddressSanitizer reports an invalid write in `memmove16` (decode.c),\ncalled from `ProcessCommandsInternal` — the corrupted `pos` makes\n`dst = ringbuffer + pos` point outside the ring-buffer allocation.\n\nThe oversized-body result (section 2) requires HTTP delivery with a flushed\nstage 1 and a fragmented stage 2, as described above; the included harness is\nthe crash reproducer.\n\n## Evidence\n\n- `network_oob_read.sample.bin` — 64 KiB redacted window from a\n  8,391,286-byte body (source range `[0x18d000, 0x19d000)` of the raw dump).\n- `network_oob_read.stats.txt` — body sizes, SHA-256 of the withheld\n  full dumps, byte composition, canary control, redaction notes.\n- `web_fetch.log.txt` — WebKit `fetch()` result lines from three runs.\n- `landing_control.log.txt` — destination-control and in-process\n  object-corruption excerpts.\n- `SHA256SUMS` — hashes of the published evidence files.\n\nFull memory dumps are withheld because they contain device process memory.\nTheir SHA-256 values are published so the withheld artifacts remain\nverifiable. All published evidence was scanned with\n`sanitize_evidence.py`; container UUIDs, user paths and the harness\nbundle identifier are replaced with equal-length placeholders.\n\n## Affected \u002F fixed\n\n| Component | Status |\n|---|---|\n| Google Brotli 1.0.3 – 1.2.0 | Vulnerable |\n| Google Brotli 1.2.1 | Fixed (upstream commit `0ed4268a`) |\n| Apple libcompression (iOS 27.0.1 \u002F 24A446) | Vulnerable |\n| Apple libcompression (iOS 27.2 \u002F 24B119) | Vulnerable |\n| Apple libcompression (iOS 27.2.1 \u002F 24B156) | Fixed |\n| Apple libcompression (iOS 27.3 beta 1 \u002F 24C5037i) | Vulnerable |\n\n## Disclaimer\n\nFor security research and education only. This is a memory-corruption\nreproducer (crash and out-of-bounds read\u002Fwrite demonstration), not a\nweaponized exploit.\n","该项目是CVE-2026-111497漏洞的公开验证程序（PoC），针对Brotli压缩库中BlockSwitch机制引发的越界写入缺陷。核心功能包括两阶段触发样本生成器、解码测试框架，以及在真实iOS设备上复现远程崩溃、输出位置篡改和超长响应体等行为的实测证据；技术特点为纯C实现、聚焦Apple libcompression与上游Google Brotli 1.0.3–1.2.0版本的差异分析，并精确还原漏洞根因——对num_block_types \u003C 2时未拒绝BlockSwitch命令导致memmove16越界。适用于安全研究人员进行漏洞复现、影响评估及补丁有效性验证。",2,"2026-11-24 04:49:00","CREATED_QUERY"]