CVE-2021-21381Sandbox escape via special tokens in .desktop file
Flatpak is a system for building, distributing, and running sandboxed desktop applications on Linux. In Flatpack since version 0.9.4 and before version 1.10.2 has a vulnerability in the "file forwarding" feature which can be used by an attacker to gain access to files that would not ordinarily be allowed by the app's permissions. By putting the special tokens `@@` and/or `@@u` in the Exec field of a Flatpak app's .desktop file, a malicious app publisher can trick flatpak into behaving as though the user had chosen to open a target file with their Flatpak app, which automatically makes that file available to the Flatpak app. This is fixed in version 1.10.2. A minimal solution is the first commit "`Disallow @@ and @@U usage in desktop files`". The follow-up commits "`dir: Reserve the whole @@ prefix`" and "`dir: Refuse to export .desktop files with suspicious uses of @@ tokens`" are recommended, but not strictly required. As a workaround, avoid installing Flatpak apps from untrusted sources, or check the contents of the exported `.desktop` files in `exports/share/applications/*.desktop` (typically `~/.local/share/flatpak/exports/share/applications/*.desktop` and `/var/lib/flatpak/exports/share/applications/*.desktop`) to make sure that literal filenames do not follow `@@` or `@@u`.
What to do
Fixed builds are available from Debian, Red Hat, Ubuntu: see the table below for the fixed version per release.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 20.04 | flatpak | Fixed | 1.6.5-0ubuntu0.3 | UBUNTU-CVE-2021-21381 |
| Ubuntu 18.04 | flatpak | Fixed | 1.0.9-0ubuntu0.3 | UBUNTU-CVE-2021-21381 |
| Debian 14 | flatpak | Fixed | 1.10.1-4 | DEBIAN-CVE-2021-21381 |
| Debian 13 | flatpak | Fixed | 1.10.1-4 | DEBIAN-CVE-2021-21381 |
| Debian 12 | flatpak | Fixed | 1.10.1-4 | DEBIAN-CVE-2021-21381 |
| Red Hat Enterprise Linux 9 | flatpak | Not affected | ||
| Red Hat Enterprise Linux 9 | flatpak-devel | Not affected | ||
| Red Hat Enterprise Linux 9 | flatpak-libs | Not affected | ||
| Red Hat Enterprise Linux 9 | flatpak-selinux | Not affected | ||
| Red Hat Enterprise Linux 9 | flatpak-session-helper | Not affected | ||
| Red Hat Enterprise Linux 8 | flatpak | Fixed | 0:1.6.2-6.el8_3 | RHSA-2021:1068 |
| Red Hat Enterprise Linux 8 | flatpak-libs | Fixed | 0:1.6.2-6.el8_3 | RHSA-2021:1068 |
| Red Hat Enterprise Linux 8 | flatpak-selinux | Fixed | 0:1.6.2-6.el8_3 | RHSA-2021:1068 |
| Red Hat Enterprise Linux 8 | flatpak-session-helper | Fixed | 0:1.6.2-6.el8_3 | RHSA-2021:1068 |
| Red Hat Enterprise Linux 7 | flatpak | Fixed | 0:1.0.9-11.el7_9 | RHSA-2021:1002 |
| Red Hat Enterprise Linux 7 | flatpak-builder | Fixed | 0:1.0.0-11.el7_9 | RHSA-2021:1002 |
| Red Hat Enterprise Linux 7 | flatpak-devel | Fixed | 0:1.0.9-11.el7_9 | RHSA-2021:1002 |
| Red Hat Enterprise Linux 7 | flatpak-libs | Fixed | 0:1.0.9-11.el7_9 | RHSA-2021:1002 |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- flatpak: affected: >= 0.9.4, < 1.10.2
Vendor advisories:
- https://www.debian.org/security/2021/dsa-4868 (vendor-advisory)
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/… (vendor-advisory)
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/… (vendor-advisory)
- https://security.gentoo.org/glsa/202312-12 (vendor-advisory)
References
- https://github.com/flatpak/flatpak/security/advisories/GHSA-xgh4-387p-hqpp
- https://github.com/flatpak/flatpak/pull/4156
- https://github.com/flatpak/flatpak/commit/8279c5818425b6812523e3805bbe242fb6a5d961
- https://github.com/flatpak/flatpak/commit/a7401e638bf0c03102039e216ab1081922f140ae
- https://github.com/flatpak/flatpak/commit/eb7946bb6248923d8c90fe9b84425fef97ae580d
- https://github.com/flatpak/flatpak/releases/tag/1.10.2
- https://www.debian.org/security/2021/dsa-4868
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/WXNVFOIB6ZP4DGOVKAM25T6OIEP3YLGV/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/2MXXLXC2DPJ45HSMTI5MZYHMYEGQN6AA/
- https://security.gentoo.org/glsa/202312-12
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.