CVE-2021-21261
Flatpak sandbox escape via spawn portal
Check your servers for CVE-2021-21261
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2021-21261 affects flatpak, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
Flatpak is a system for building, distributing, and running sandboxed desktop applications on Linux. A bug was discovered in the `flatpak-portal` service that can allow sandboxed applications to execute arbitrary code on the host system (a sandbox escape). This sandbox-escape bug is present in versions from 0.11.4 and before fixed versions 1.8.5 and 1.10.0. The Flatpak portal D-Bus service (`flatpak-portal`, also known by its D-Bus service name `org.freedesktop.portal.Flatpak`) allows apps in a Flatpak sandbox to launch their own subprocesses in a new sandbox instance, either with the same security settings as the caller or with more restrictive security settings. For example, this is used in Flatpak-packaged web browsers such as Chromium to launch subprocesses that will process untrusted web content, and give those subprocesses a more restrictive sandbox than the browser itself. In vulnerable versions, the Flatpak portal service passes caller-specified environment variables to non-sandboxed processes on the host system, and in particular to the `flatpak run` command that is used to launch the new sandbox instance. A malicious or compromised Flatpak app could set environment variables that are trusted by the `flatpak run` command, and use them to execute arbitrary code that is not in a sandbox. As a workaround, this vulnerability can be mitigated by preventing the `flatpak-portal` service from starting, but that mitigation will prevent many Flatpak apps from working correctly. This is fixed in versions 1.8.5 and 1.10.0.
Severity (CVSS)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:N
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- none: nobody has to click or open anything
- Scope
- changed: the damage reaches other components, such as the host of a container or other users
- Impact
- confidentiality high, integrity low, availability none: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.60%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 49.7% of all scored CVEs. Scores of 1 Dec 2026.
Weakness
- CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component
Affected products
As the CNA lists them.
Is my server affected?
Find the installed version of flatpak and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i flatpak
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2021-21261 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2021-21261RHEL, Rocky, Alma, Fedora
rpm -q flatpak
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2021-21261Alpine
apk list --installed | grep -i flatpakWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2021-21261
trivy image --scanners vuln IMAGE | grep CVE-2021-21261
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
- https://github.com/flatpak/flatpak/security/advisories/GHSA-4ppf-fxf6-vxg2 github.com
- DSA-4830 debian.org · vendor advisory
- GLSA-202101-21 security.gentoo.org · vendor advisory
Other references
- https://github.com/flatpak/flatpak/releases/tag/1.8.5 github.com
- https://github.com/flatpak/flatpak/commit/6d1773d2a54dde9b099043f07a2094a4f1c2f486 github.com
- https://github.com/flatpak/flatpak/commit/6e5ae7a109cdfa9735ea7ccbd8cb79f9e8d3ae8b github.com
- https://github.com/flatpak/flatpak/commit/aeb6a7ab0abaac4a8f4ad98b3df476d9de6b8bd4 github.com
- https://github.com/flatpak/flatpak/commit/cc1401043c075268ecc652eac557ef8076b5eaba github.com
Source: the record CVE-2021-21261 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse