snapd Local Privilege Escalation

Date: March 17, 2026
CVSS 3.0: 7.8 (High)

What is the snapd LPE Vulnerability?

CVE-2026-3888 is a local privilege escalation vulnerability affecting snapd and the SUID-root snap-confine binary on Ubuntu Linux systems. The vulnerability abuses a TOCTOU (Time-of-Check to Time-of-Use) race condition between snap-confine and systemd-tmpfiles.

Systems configured to automatically clean stale directories within /tmp may allow attackers to recreate deleted snap temporary directories with attacker-controlled contents before snap-confine completes its bind-mount operations.

Disclosure Information

The vulnerability was assigned CVE-2026-3888 and publicly disclosed in 2026. Public proof-of-concept exploits demonstrated successful privilege escalation on Ubuntu 24.04 systems running vulnerable versions of snapd.

How It Works

The vulnerability exists due to unsafe handling of temporary directories used by snap-confine during sandbox setup. The exploit chain relies on a race condition between:

  • systemd-tmpfiles cleanup operations
  • Snap sandbox preparation
  • Bind-mount operations within snap-confine

An attacker first creates a stale snap private temporary directory beneath /tmp. When systemd-tmpfiles removes the stale directory during cleanup, the attacker rapidly recreates the path with controlled contents before snap-confine completes its execution flow.

By abusing the race condition, attackers can poison the sandbox environment and force snap-confine to load attacker-controlled shared libraries. Because snap-confine executes with SUID-root privileges, arbitrary code execution occurs as root.

Potential Impact

Successful exploitation may result in:

  • Full root compromise
  • Bypass of privilege boundaries
  • Persistence installation
  • Credential theft
  • Security monitoring bypass
  • Container and sandbox escape scenarios

Mitigation Steps

Recommended mitigation steps include:

  • Upgrade snapd to a patched version.
  • Remove unnecessary SUID permissions where possible.
  • Restrict or harden systemd-tmpfiles cleanup policies.
  • Monitor for suspicious modifications within /tmp.
  • Implement endpoint monitoring for abnormal snap-confine activity.
  • Apply regular operating system and package updates.

Educational Usage

This vulnerability was utilized during the Hack The Box “Snapped” machine to escalate privileges from the compromised user account jonathan to root. Exploitation involved identifying vulnerable snapd versions, confirming automatic cleanup behavior in /tmp, compiling a public proof-of-concept exploit, and executing a malicious shared library through the vulnerable snap-confine process.

Sources



Loading...