CVE-2021-21381 Sandbox escape via special tokens in .desktop file
A malicious Flatpak app can access unauthorized files by exploiting special tokens in .desktop files, bypassing sandbox permissions.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2021-21381?
CVE-2021-21381 is a high-severity path traversal vulnerability in Debian Debian Linux, published on 11 Mar 2021. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Official description
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`.
Weakness: CWE-74
Which versions are affected by CVE-2021-21381?
It affects 3 products.
Linux distribution packages (40)
flatpak Red Hat:enterprise_linux:7::client | All versions | 0:1.0.9-11.el7_9 |
flatpak-builder Red Hat:enterprise_linux:7::client | All versions | 0:1.0.0-11.el7_9 |
flatpak-debuginfo Red Hat:enterprise_linux:7::client | All versions | 0:1.0.9-11.el7_9 |
flatpak-devel Red Hat:enterprise_linux:7::client | All versions | 0:1.0.9-11.el7_9 |
flatpak-libs Red Hat:enterprise_linux:7::client | All versions | 0:1.0.9-11.el7_9 |
flatpak Red Hat:enterprise_linux:7::computenode | All versions | 0:1.0.9-11.el7_9 |
flatpak-builder Red Hat:enterprise_linux:7::computenode | All versions | 0:1.0.0-11.el7_9 |
flatpak-debuginfo Red Hat:enterprise_linux:7::computenode | All versions | 0:1.0.9-11.el7_9 |
flatpak-devel Red Hat:enterprise_linux:7::computenode | All versions | 0:1.0.9-11.el7_9 |
flatpak-libs Red Hat:enterprise_linux:7::computenode | All versions | 0:1.0.9-11.el7_9 |
flatpak Red Hat:enterprise_linux:7::server | All versions | 0:1.0.9-11.el7_9 |
flatpak-builder Red Hat:enterprise_linux:7::server | All versions | 0:1.0.0-11.el7_9 |
flatpak-debuginfo Red Hat:enterprise_linux:7::server | All versions | 0:1.0.9-11.el7_9 |
flatpak-devel Red Hat:enterprise_linux:7::server | All versions | 0:1.0.9-11.el7_9 |
flatpak-libs Red Hat:enterprise_linux:7::server | All versions | 0:1.0.9-11.el7_9 |
flatpak Red Hat:enterprise_linux:7::workstation | All versions | 0:1.0.9-11.el7_9 |
flatpak-builder Red Hat:enterprise_linux:7::workstation | All versions | 0:1.0.0-11.el7_9 |
flatpak-debuginfo Red Hat:enterprise_linux:7::workstation | All versions | 0:1.0.9-11.el7_9 |
flatpak-devel Red Hat:enterprise_linux:7::workstation | All versions | 0:1.0.9-11.el7_9 |
flatpak-libs Red Hat:enterprise_linux:7::workstation | All versions | 0:1.0.9-11.el7_9 |
flatpak Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.2-6.el8_3 |
flatpak-debuginfo Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.2-6.el8_3 |
flatpak-debugsource Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.2-6.el8_3 |
flatpak-libs Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.2-6.el8_3 |
flatpak-libs-debuginfo Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.2-6.el8_3 |
flatpak-selinux Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.2-6.el8_3 |
flatpak-session-helper Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.2-6.el8_3 |
flatpak-session-helper-debuginfo Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.2-6.el8_3 |
flatpak-tests-debuginfo Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.2-6.el8_3 |
flatpak Red Hat:rhel_eus:8.1::appstream | All versions | 0:1.0.9-4.el8_1 |
flatpak-debuginfo Red Hat:rhel_eus:8.1::appstream | All versions | 0:1.0.9-4.el8_1 |
flatpak-debugsource Red Hat:rhel_eus:8.1::appstream | All versions | 0:1.0.9-4.el8_1 |
flatpak-libs Red Hat:rhel_eus:8.1::appstream | All versions | 0:1.0.9-4.el8_1 |
flatpak-libs-debuginfo Red Hat:rhel_eus:8.1::appstream | All versions | 0:1.0.9-4.el8_1 |
flatpak Red Hat:rhel_eus:8.2::appstream | All versions | 0:1.6.2-5.el8_2 |
flatpak-debuginfo Red Hat:rhel_eus:8.2::appstream | All versions | 0:1.6.2-5.el8_2 |
flatpak-debugsource Red Hat:rhel_eus:8.2::appstream | All versions | 0:1.6.2-5.el8_2 |
flatpak-libs Red Hat:rhel_eus:8.2::appstream | All versions | 0:1.6.2-5.el8_2 |
flatpak-libs-debuginfo Red Hat:rhel_eus:8.2::appstream | All versions | 0:1.6.2-5.el8_2 |
flatpak-selinux Red Hat:rhel_eus:8.2::appstream | All versions | 0:1.6.2-5.el8_2 |
Products include Debian Debian Linux, Fedoraproject Fedora, Flatpak Flatpak.
How do I fix CVE-2021-21381?
Upgrade to a fixed version.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2021-21381 being exploited?
There is no known exploitation of CVE-2021-21381 in the wild and no public exploit code.
Other vulnerabilities in Debian Debian Linux
Sources
Also known as DEBIAN-CVE-2021-21381, DSA-4868-1, GHSA-xgh4-387p-hqpp, MGASA-2021-0145, RHSA-2021:1002, RHSA-2021:1068 and 4 more.