Skip to content
Access control Write-up Intermediate

Flatpak Apps can escape their sandbox

Flatpak stored per-application permission overrides in a directory that sandboxed apps could write to when granted home access. An attacker-controlled app could therefore write its own override file and grant itself broad extra permissions, defeating the sandbox.

github.com

Published on github.com

~/.local/share/flatpak/overrides permissions are too relaxed and is the equivalent of giving full permissions.

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 overrides directory sits inside the user's home directory, which apps granted home access can write to, so the permission configuration is not protected from the apps it is meant to constrain.

Impact

An app that was only granted home access could grant itself network, session bus, device and host filesystem access, effectively escaping the sandbox.

What the attacker needed

App installed with home permission; attacker controls the app

The fix

Flatpak should prevent sandboxed apps from writing to the overrides directory, for example by storing overrides outside the paths an app can reach.

How it was found

  1. Give an app the home permission, which is a common request.
  2. From inside the app, create the overrides directory under the user's local Flatpak data.
  3. Write an override file named after the app containing a broad set of shared, socket, device and filesystem permissions.
  4. The app now runs with those expanded permissions.

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 of packaging Linux apps so they run in a restricted box called a sandbox, and each app is only allowed certain things such as network or home folder access. The report says the folder where those allowances are saved could itself be written to by an app that already had home access, so the app could simply edit its own allowance list. That means one modest permission could be turned into almost full access to the machine.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.