iOS proof-of-concept app demonstrating a CoreGraphics ShadingType 5 PDF out-of-bounds write primitive, with on-device measurement and controlled write verification.
A PDF that makes CoreGraphics write to an address the document chooses.
Tested on iPhone18,1 / iOS 27.0.1 (24A446); cross-checked on macOS 15.8.
Works: a ShadingType 5 shading whose /Function returns more components than the
colour space has overflows the per-vertex record buffer. On device the fault lands
at cg_shading_type5_draw + 0x740:
str wzr, [x22, #0xc]
So the primitive is four zero bytes at an address the PDF picks, anywhere in the calling process's writable memory, single-byte precision.
Measured on device: the store executes every time (6/6, WnR=1); the address is the
document's value plus 0x76c; four zero bytes land at the aimed offset while a
control run aimed elsewhere changes nothing; PROT_NONE and read-only pages refuse
the write.
Does not work: arbitrary value (the store writes wzr, fixed by the instruction
encoding); kernel or cross-process reach (addresses above 2^48 never reach a
register, and kernel addresses are NaNs as doubles).
Excluded: ShadingType 4 validates that the function's output count equals the
component count, and DeviceN requires a tint transform with a fixed output count,
so neither can be made to overflow.
Two buttons. Run measures the primitive without corrupting anything. Write
aims the store at memory the app owns and verifies the write. Reports go to
Documents/ and can be exported from the app.
IDENT="iPhone Distribution: Name (TEAMID)" \
APP_ID="TEAMID.com.example.cve112611" \
TEAM_ID="TEAMID" \
./build.sh