Skip to content
Path traversal Write-up Advanced

Flatpak: Complete Sandbox Escape

The Flatpak portal accepted app-controlled symlinks in sandbox-expose options, allowing a malicious app to expose arbitrary host paths inside its sandbox. This gave every Flatpak app the ability to read and write host files and execute code in the host context.

github.com

Published on github.com

Every Flatpak app is able to read and write arbitrary files on the host and execute code in the host context.

The author, on github.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the portal resolved app-supplied symlinks before validating the resulting host path, so a link could point outside the intended directory and the resolved path was then mounted into the sandbox.

Impact

Every Flatpak app could read and write arbitrary host files and execute code in the host context, completely defeating the sandbox.

What the attacker needed

A Flatpak app installed; the Flatpak portal running

The fix

The issue was fixed in version 1.16.4 and is to be fixed in 1.18.0; disabling the Flatpak portal also mitigates it.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Flatpak is a way to package and run desktop apps in a sandbox, a restricted box that should stop an app from touching the rest of your computer. A symlink is a shortcut file that points to another file or folder. The portal, a helper service that grants apps extra access, followed these shortcuts without checking where they really led, so an app could ask for a shortcut to a sensitive folder and get the real folder mounted inside its sandbox.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.