42 lines
2.2 KiB
Swift
42 lines
2.2 KiB
Swift
// kern.decmpfs · XNU · AppleFSCompressionTypeZlib · CVE-2026-113910
|
|
// 原语: 信息泄露 · 内核 · tier 2
|
|
// Primitive: info leak · kernel · tier 2
|
|
//
|
|
// [zh] decmpfs 分块解压欠产出 → 内核堆泄露
|
|
// 分块 zlib 解压的实际产出少于预期时,27.0 不比对 produced 与 expected,内核页缓冲的尾部因此保持未写状态;read() 随后将整个缓冲交回应用,使应用取得陈旧的堆内容。
|
|
// 27.2 补入该比对。
|
|
//
|
|
// [en] decmpfs chunked decompression under-produce → kernel heap disclosure
|
|
// When chunked zlib decompression produces fewer bytes than expected, 27.0 does not compare produced
|
|
// against expected, so the tail of the kernel page buffer is left unwritten; read() then hands the
|
|
// whole buffer back to the app, which receives stale heap content. iOS 27.2 adds that comparison.
|
|
// ── 判别 / oracle ──
|
|
// 这是整套原语中少数完全不需要 entitlement 的内核路径:应用在自身容器内写入一个带 com.apple.decmpfs 扩展属性的文件,读回的内容即内核解压的产物。以 8 字节窗口扫描,
|
|
// 凡落在内核地址空间范围(≥ 0xFFFFFFE000000000)的值即为候选指针。
|
|
|
|
import Foundation
|
|
|
|
// ── byte helpers — verbatim 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) }
|
|
}
|
|
|
|
|
|
|