// For flags

CVE-2021-21381

Sandbox escape via special tokens in .desktop file

Severity Score

8.2
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

0
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

-
*SSVC
Descriptions

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`.

Flatpak es un sistema para construir, distribuir y ejecutar aplicaciones de escritorio en sandbox en Linux. En Flatpack desde la versión 0.9.4 y anteriores a la versión 1.10.2, presenta una vulnerabilidad en la funcionalidad "file forwarding" que puede ser usada por un atacante para conseguir acceso a archivos que normalmente no estarían permitidos por los permisos de la aplicación. Colocando los tokens especiales "@@" y/o "@@u" en el campo Exec del archivo .desktop de una aplicación Flatpak, un editor de aplicaciones malicioso puede engañar a Flatpak para que se comporte como si el usuario hubiera elegido abrir un archivo de destino con su aplicación Flatpak, lo que automáticamente hace que ese archivo esté disponible para la aplicación Flatpak. Esto ha sido corregido en versión 1.10.2. Una solución mínima es el primer commit "`Disallow @@ and @@U usage in desktop files`". El siguiente commit "`dir: Reserve the whole @@ prefix`" y "`dir: Refuse to export .desktop files with suspicious uses of @@ tokens`" se recomiendan, pero no son estrictamente necesarias. Como solución, evite instalar aplicaciones Flatpak de fuentes no fiables, o compruebe el contenido de los archivos exportados ".desktop" en "exports/share/applications/*.desktop" (normalmente "~/.local/share/flatpak/exports/share/applications/*.desktop" y "/var/lib/flatpak/exports/share/applications/*.desktop") para asegurarse de que los nombres literales de los archivos no siguen "@@" o "@@u"

A sandbox escape flaw was found in the way flatpak handled special tokens in ".desktop" files. This flaw allows an attacker to gain access to files that are not ordinarily allowed by the app's permissions. The highest threat from this vulnerability is to confidentiality and integrity.

*Credits: N/A
CVSS Scores
Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None
Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
High
Availability
None
Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None
Attack Vector
Network
Attack Complexity
Medium
Authentication
None
Confidentiality
Partial
Integrity
Partial
Availability
None
* Common Vulnerability Scoring System
SSVC
  • Decision:-
Exploitation
-
Automatable
-
Tech. Impact
-
* Organization's Worst-case Scenario
Timeline
  • 2020-12-22 CVE Reserved
  • 2021-03-11 CVE Published
  • 2023-11-25 EPSS Updated
  • 2024-08-03 CVE Updated
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
  • ---------- First Exploit
CWE
  • CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
  • CWE-284: Improper Access Control
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Flatpak
Search vendor "Flatpak"
Flatpak
Search vendor "Flatpak" for product "Flatpak"
>= 0.9.4 < 1.10.2
Search vendor "Flatpak" for product "Flatpak" and version " >= 0.9.4 < 1.10.2"
-
Affected
Debian
Search vendor "Debian"
Debian Linux
Search vendor "Debian" for product "Debian Linux"
10.0
Search vendor "Debian" for product "Debian Linux" and version "10.0"
-
Affected
Fedoraproject
Search vendor "Fedoraproject"
Fedora
Search vendor "Fedoraproject" for product "Fedora"
33
Search vendor "Fedoraproject" for product "Fedora" and version "33"
-
Affected
Fedoraproject
Search vendor "Fedoraproject"
Fedora
Search vendor "Fedoraproject" for product "Fedora"
34
Search vendor "Fedoraproject" for product "Fedora" and version "34"
-
Affected