linuxsnapdcve

Snap Flaw Enables Local Privilege Escalation To Root

Farhan Kurnia Pratama
Farhan Kurnia Pratama
· 5 min read

TL;DR

  • A race condition and timing flaw in snapd allows unprivileged local users to escalate to root via an interaction between snap-confine and systemd-tmpfiles.
  • High severity (CVSS 7.8) with high complexity, as exploitation requires an attacker to wait 10 to 30 days for system cleanup processes to trigger.
  • Patch immediately by upgrading the snapd package to the latest release for your distribution.

Vulnerability Summary

Field Value
CVE ID CVE-2026-3888
CVSS Score 7.8
CVSS Vector CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H
CVSS Version 3.1 (Source: Ubuntu)
Vulnerability Type Local Privilege Escalation (LPE)
Affected Software snapd
Affected Versions Ubuntu 16.04, 18.04, 20.04, 22.04, 24.04, 25.10; Upstream < 2.75
Patch Status Patched
PoC Publicly Available Not disclosed

Context

In my experience reviewing Linux environment escalations, bugs born from the interaction of two separate components operating exactly as designed are the most difficult to spot. CVE-2026-3888 is a perfect example of this logic flaw. It leverages a destructive interaction between snap-confine (which securely sandboxes snap apps) and systemd-tmpfiles (which periodically deletes stale temporary files).

Exploitation allows an unprivileged local user to gain full root access. The complexity is high because an attacker must patiently wait 10 to 30 days for a specific system cleanup cycle to execute, but the payoff is a total host compromise. Active exploitation has not been observed publicly, but the risk to multi-tenant or shared desktop environments is severe.

Disclosure Timeline

Date Event
2026-03-17 Vulnerability disclosed and patches officially released by Ubuntu.
2026-03-17 Qualys publishes technical details and root cause analysis.

Technical Detail

The root cause lies in how the setuid root binary snap-confine inherently trusts the /tmp/.snap directory during sandbox initialization. Because snap-confine operates with elevated privileges to handle mount namespace isolation, AppArmor policy loading, and seccomp filtering, it sits at a critical trust boundary.

In default configurations, systemd-tmpfiles automatically cleans up stale files in /tmp. If a specific snap application has not been accessed or modified for an extended period (10 days on Ubuntu 25.10, or 30 days on Ubuntu 24.04), systemd-tmpfiles will blindly delete the /tmp/snap-private-tmp/*/tmp/.snap directory.

The triggering condition occurs immediately after this scheduled deletion. An unprivileged attacker can quickly recreate the .snap directory and seed it with malicious payloads. When snap-confine is executed during the next sandbox initialization, it incorrectly bind-mounts these attacker-controlled files as root. This oversight allows the arbitrary execution of code within a highly privileged kernel-level context, completely bypassing the intended sandbox restrictions.

Mitigation

If patching is impossible due to operational constraints, I recommend modifying the systemd-tmpfiles configuration to explicitly prevent the cleanup daemon from targeting these snap directories. This stops the exploit chain entirely by denying the attacker the deletion event necessary to recreate the directory structure.

Replace the contents of /usr/lib/tmpfiles.d/snapd.conf with the following configuration:

D! /tmp/snap-private-tmp 0700 root root -
X /tmp/snap-private-tmp
X /tmp/snap-private-tmp/*/tmp
x /tmp/snap-private-tmp/*/tmp/.snap

Apply the changes to the running service:

sudo systemctl restart systemd-tmpfiles-clean.service

Remediation

The permanent fix is to upgrade snapd to the secured version. Canonical has introduced hardening that corrects the directory validation process before bind-mounting.

Target the specific package upgrade using your package manager:

sudo apt update && sudo apt install --only-upgrade snapd

Verification

Confirm the installed package version meets or exceeds the required patch level for your operating system release.

Check your current version policy:

apt policy snapd

Validate that the installed candidate matches one of the fixed versions (e.g., 2.73+ubuntu24.04.2 for Ubuntu 24.04 LTS or 2.73+ubuntu25.10.1 for Ubuntu 25.10).

References