Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-3888-PoC — Python proof-of-concept for CVE-2026-3888, exploiting a snap-confine and systemd-tmpfiles race to escalate from a local unprivileged account to root on Linux. | Kitploit
Tools/GitHubGitHub/alinpfan/cve-2026-3888-poc
Privilege EscalationContainer SecurityVulnerability AnalysisExploitation
GitHubalinpfan/cve-2026-3888-poc

CVE-2026-3888-PoC

Python proof-of-concept for CVE-2026-3888, exploiting a snap-confine and systemd-tmpfiles race to escalate from a local unprivileged account to root on Linux.

View Repository
11 month agoNot yet reviewed
Share

CVE-2026-3888: snap-confine and systemd-tmpfiles race

This repository contains a proof of concept for the SUID snap-confine variant of CVE-2026-3888. The project studies how cleanup of snap's private temporary directory can interact with privileged sandbox construction and a filesystem race. It is intended for controlled, disposable Linux test systems where the operator has explicit authorization.

The flaw is local: an attacker needs an unprivileged account on a vulnerable host. Ubuntu describes the issue as snapd mishandling operations in a snap's private /tmp; when systemd-tmpfiles removes that directory, a local user may recreate it and influence later privileged setup. The exploit depends on the affected snapd implementation and the host's cleanup policy, so timing and applicability vary by system. Ubuntu CVE record · Ubuntu security notice USN-8102-1 · Qualys technical analysis

Mechanism

Snap confinement builds a mount namespace before launching an application or hook. Some paths needed by a snap are represented through a writable “mimic” tree under the snap's private temporary directory. In the affected flow, the relevant paths typically resemble /tmp/snap-private-tmp/<snap-instance>/tmp/.snap on the host and /tmp/.snap from inside the snap namespace; exact layout varies. snap-confine uses that tree while constructing bind mounts. systemd-tmpfiles can remove an old .snap tree while the containing sandbox namespace remains relevant. If a user recreates the removed path, filesystem ownership and the privileged setup can become inconsistent.

The race is between the privileged bind-mount setup and replacement of the mimic directory. If the replacement lands at the right point, a later mount can expose user-controlled content at a location used by the snap's runtime. In this variant, the content includes a small ELF program placed at the dynamic-loader path. A subsequent privileged snap-confine execution can then reach that program. This is a check/use race across cleanup, directory recreation, and privileged namespace setup; it is not a network-service exploit.

PoC workflow

cve-2026-3888-poc.py implements the stages below in one Python file using only the standard library. The target still needs its own snapd, systemd tools, and compatible installed snap.

  1. Preflight the host. The script checks the architecture, snapd and selected snap, snap-confine ownership and setuid mode, file capabilities, the snap's base and library compatibility, the tmpfiles cleanup rule and timer, and the current user's systemd manager. It stops if the host does not match the supported SUID variant or appears patched.
  2. Establish a sandbox namespace. A scoped snap-confine process keeps the snap's private /tmp namespace available while the cleanup condition is reached. The polling logic checks the parent directory rather than repeatedly accessing .snap, since touching the target can refresh its age and delay cleanup.
  3. Wait for tmpfiles cleanup. The script reads the configured /tmp cleanup age and waits until .snap is absent from the live namespace. The default maximum wait is the configured age plus 15 minutes; --max-wait changes only this timeout, not the host cleanup schedule.
  4. Recreate the mimic tree. After clearing a stale cached namespace, the script creates a marked mimic tree and copies the runtime-library entries needed for the selected host. The ownership marker lets cleanup identify this run's directory.
  5. Synchronize and exchange directories. The script starts a fresh namespace setup with debug output and watches for the relevant bind-mount event. It then uses Linux renameat2 with RENAME_EXCHANGE to atomically exchange the expected directory with the prepared tree. A post-swap ownership check confirms that the path now resolves to this user's content.
  6. Demonstrate privileged execution. The staged x86-64 ELF uses direct system calls and is generated in memory; no compiler, BusyBox, downloaded payload, or Python package is needed. In the selected SUID execution path, it copies /bin/bash to the snap's writable common directory and sets the setuid bit. The script verifies that the resulting helper is root-owned and setuid before claiming success.
  7. Verify and clean up. A host-side check requires effective UID 0. With --shell, the temporary helper starts /bin/bash -p; exiting that shell returns to the script, which removes the helper, its marked mimic tree, tracked processes, and cached namespace. Cleanup is best-effort if the process is forcibly killed or the host changes state during the run, so inspect the final output before treating a test as clean.

Requirements and limits

  • Linux x86-64 and Python 3.
  • snapd and /usr/lib/snapd/snap-confine installed as a root-owned setuid executable, without file capabilities.
  • An installed snap compatible with the implementation's mimic-library layout and with a writable /var/snap/<snap-name>/common directory.
  • systemd-run, systemctl, an active systemd-tmpfiles-clean.timer, and an active systemd user manager for the current account.
  • A host that has not received the vendor fix. Distribution package versions and backports differ; consult the relevant vendor advisory instead of relying only on a version string.

This implementation is deliberately narrow. It rejects root execution, non-x86-64 systems, capability-based snap-confine, incompatible loader/library combinations, missing user scopes, and configurations where the observed vulnerable cleanup condition is absent. The cleanup interval comes from the target's active tmpfiles configuration. The 30-day and 10-day intervals described in the original research are examples of Ubuntu defaults at disclosure time, not assumptions this PoC makes about every host. Qualys analysis

Running in an isolated lab

Run as an ordinary account on the test machine. Begin with checks that do not perform the exploit:

python3 cve-2026-3888-poc.py --self-test
python3 cve-2026-3888-poc.py --check --snap <installed-snap-name>

--self-test exercises the generated ELF copier in a temporary directory. --check performs prerequisite checks only. To run the full demonstration, use a disposable snapshot-backed VM that matches the requirements:

python3 cve-2026-3888-poc.py --snap <installed-snap-name>

To request an interactive root shell after the PoC verifies the temporary helper:

python3 cve-2026-3888-poc.py --snap <installed-snap-name> --shell

The script does not shorten the system cleanup interval. A shorter interval for repeatable experiments should be configured only inside a disposable test VM and restored after testing. Do not run the exploit on production systems or systems outside your authorization.

Mitigation and defensive observations

Install the fixed snapd package recommended by the operating-system vendor and follow its restart or reboot instructions. Ubuntu's initial notice lists fixed package versions by release; a follow-up notice records a Noble regression fix, so use the current notice for the exact release rather than copying a version from this README. USN-8102-1 · USN-8102-2

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    795
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    520
  • 3

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    439
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    346
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    267
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    264

Explore all tools

Browse our collection of tools

View all tools →