Files
cinder27/CVE-2026-112683/CVE-2026-112683.swift
T

44 lines
2.1 KiB
Swift

// font.cff · FontParser · charstring 解释器 · CVE-2026-112683
// 原语: OOB 写 · 进程内 · tier 2
// Primitive: OOB write · in-process · tier 2
//
// [zh] CFF Type2 charstring 操作数栈溢出
// Type2 charstring 解释器的操作数栈为固定 48 项数组。27.0 仅在 pop 路径检查计数,push 路径不做检查。27.2 补入 Push/Pop 两道栈保护,并将扫描暂存区的
// 32 位乘法改为 64 位,同时修正了符号扩展指针。
//
// [en] CFF Type2 charstring operand stack overflow
// The Type2 charstring interpreter's operand stack is a fixed 48-entry array. On 27.0 only the pop
// path checks the count; the push path does not. iOS 27.2 adds Push/Pop stack guards, widens the
// scan scratch area's 32-bit multiply to 64-bit, and fixes a sign-extended pointer.
// ── 判别 / oracle ──
// 这个种子是一个裸 CFF:单个 charstring 连推 300 个操作数再 endchar。绘制字形才会真正执行解释器。
//
// 种子构建器(python,可直接运行): CVE-2026-112683/CVE-2026-112683.py
// runnable python seed builder: CVE-2026-112683/CVE-2026-112683.py
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) }
}