AppleSEPKeyStore IOKit Use-After-Free (CVE-2026-20637)
by Enfilade (enfilade.io / enfilade-labs) · 2026-07-05
- Severity
- High
- CVE
- CVE-2026-20637
- Category
- binary
- Affected product
- AppleSEPKeyStore driver (com.apple.driver.AppleSEPKeyStore, exposed as IOKit service AppleKeyStore)
- Affected versions
- iOS/iPadOS 26.1 – 26.2 and macOS 26.1 – 26.2 (tested); fixed in iOS/iPadOS 26.3
- Disclosed
- 2026-07-05
- Patch status
- patched
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-04 |
| Author / Researcher | Enfilade (enfilade.io / enfilade-labs) |
| CVE / Advisory | CVE-2026-20637 |
| Category | binary |
| Severity | High |
| CVSS Score | Not specified in source |
| Status | PoC |
| Tags | ios, macos, kernel, iokit, use-after-free, race-condition, aksepkeystore, xnu, kernel-panic |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | AppleSEPKeyStore driver (com.apple.driver.AppleSEPKeyStore, exposed as IOKit service AppleKeyStore) |
| Versions Affected | iOS/iPadOS 26.1 – 26.2 and macOS 26.1 – 26.2 (tested); fixed in iOS/iPadOS 26.3 |
| Language / Platform | Objective-C, IOKit userspace client APIs; targets iOS/macOS kernel |
| Authentication Required | No |
| Network Access Required | No (local app, physical/local device required) |
Summary
The AppleSEPKeyStore kernel driver exposes an IOKit user client (AppleKeyStore) whose command gate can be freed while still being accessed, producing a use-after-free. The PoC opens repeated IOServiceOpen connections while separate threads race IOConnectCallMethod calls against IOServiceClose on the same connection with no delay, creating a tight window where the command gate is used after being torn down. When the race lands, the kernel panics with an “element modified after free” error inside IOCommandGate. Apple’s own advisory (iOS 26.3 / iPadOS 26.3) describes this as a use-after-free “addressed with improved memory management” in AppleKeyStore.
Vulnerability Details
Root Cause
A race between IOKit user-client method invocation (IOConnectCallMethod) and connection teardown (IOServiceClose) allows the underlying IOCommandGate object to be freed by one thread while another thread is still dereferencing it, corrupting freed memory.
Attack Vector
- Open the IOKit service
AppleKeyStoreviaIOServiceGetMatchingService/IOServiceOpen, repeating across 100,000 iterations with varying client “type” values. - Spawn 8 high-priority “caller” threads that continuously invoke
IOConnectCallMethodagainst the current connection across selectors 0–15, with no throttling. - Simultaneously spawn 4 high-priority “closer” threads that continuously call
IOServiceCloseon the same connection and immediately clear it. - The unsynchronized close-vs-call race eventually frees the command gate while a caller thread is still operating on it, causing a kernel panic.
Impact
Reliable local denial of service (kernel panic / device reboot); the underlying UAF class of bug is also a plausible primitive for local privilege escalation if made deterministic and paired with heap grooming, though this PoC only demonstrates the crash.
Environment / Lab Setup
Target: iOS/iPadOS 26.1-26.2 or macOS 26.1-26.2, physical device (simulator cannot reach the driver)
Attacker: Xcode, ability to build and run a native Objective-C IOKit-calling app/binary on the target device
Proof of Concept
PoC Script
See
poc.m(standalone command-line harness) andViewController.m(the same trigger logic wired into a one-button iOS app) in this folder.
| |
The program locates the AppleKeyStore IOKit service, then spins up 8 caller threads hammering IOConnectCallMethod and 4 closer threads hammering IOServiceClose, while the main thread opens 100,000 new connections back-to-back with no delay, maximizing the odds of hitting the use-after-free race.
Detection & Indicators of Compromise
panic(cpu 4 caller 0xfffffff015b84ae0): [iokit.IOCommandGate]: element modified after free
(off:72, val:0xfffffffffffffe00, sz:80, ptr:0xffffffe69b7d0db0)
Kernel Extensions in backtrace:
com.apple.driver.AppleSEPKeyStore(2.0)[...]
Signs of compromise:
- Device panic logs referencing
iokit.IOCommandGate“element modified after free” withAppleSEPKeyStorein the backtrace. - Repeated, rapid
IOServiceOpen/IOServiceClosecycles against theAppleKeyStoreservice from a single unprivileged process shortly before a panic. - Unexplained spontaneous reboots correlating with a third-party app running heavy multithreaded IOKit activity.
Remediation
| Action | Detail |
|---|---|
| Primary fix | Update to iOS 26.3 / iPadOS 26.3 or later, which Apple states addresses this use-after-free with improved memory management in AppleKeyStore |
| Interim mitigation | Avoid running untrusted third-party apps on affected builds; where feasible, restrict or monitor apps making unusual volumes of concurrent IOKit calls to security-sensitive services |
References
Notes
Mirrored from https://github.com/enfilade-labs/CVE-2026-20637-AppleSEPKeyStore-UAF on 2026-07-05.