CVE-2021-21261 Flatpak sandbox escape via spawn portal

High 7.3 Published Updated

A malicious Flatpak app can escape its sandbox and execute arbitrary code on the host system by manipulating environment variables passed to the portal service.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2021-21261?

CVE-2021-21261 is a high-severity code injection vulnerability in Debian Debian Linux, published on 14 Jan 2021. It can only be exploited from the same machine or local network, with no action from the victim.

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

Weakness: CWE-74

Which versions are affected by CVE-2021-21261?

It affects 2 products.

Linux distribution packages (40)
flatpak Red Hat:enterprise_linux:7::clientAll versions0:1.0.9-10.el7_9
flatpak-builder Red Hat:enterprise_linux:7::clientAll versions0:1.0.0-10.el7_9
flatpak-debuginfo Red Hat:enterprise_linux:7::clientAll versions0:1.0.9-10.el7_9
flatpak-devel Red Hat:enterprise_linux:7::clientAll versions0:1.0.9-10.el7_9
flatpak-libs Red Hat:enterprise_linux:7::clientAll versions0:1.0.9-10.el7_9
flatpak Red Hat:enterprise_linux:7::computenodeAll versions0:1.0.9-10.el7_9
flatpak-builder Red Hat:enterprise_linux:7::computenodeAll versions0:1.0.0-10.el7_9
flatpak-debuginfo Red Hat:enterprise_linux:7::computenodeAll versions0:1.0.9-10.el7_9
flatpak-devel Red Hat:enterprise_linux:7::computenodeAll versions0:1.0.9-10.el7_9
flatpak-libs Red Hat:enterprise_linux:7::computenodeAll versions0:1.0.9-10.el7_9
flatpak Red Hat:enterprise_linux:7::serverAll versions0:1.0.9-10.el7_9
flatpak-builder Red Hat:enterprise_linux:7::serverAll versions0:1.0.0-10.el7_9
flatpak-debuginfo Red Hat:enterprise_linux:7::serverAll versions0:1.0.9-10.el7_9
flatpak-devel Red Hat:enterprise_linux:7::serverAll versions0:1.0.9-10.el7_9
flatpak-libs Red Hat:enterprise_linux:7::serverAll versions0:1.0.9-10.el7_9
flatpak Red Hat:enterprise_linux:7::workstationAll versions0:1.0.9-10.el7_9
flatpak-builder Red Hat:enterprise_linux:7::workstationAll versions0:1.0.0-10.el7_9
flatpak-debuginfo Red Hat:enterprise_linux:7::workstationAll versions0:1.0.9-10.el7_9
flatpak-devel Red Hat:enterprise_linux:7::workstationAll versions0:1.0.9-10.el7_9
flatpak-libs Red Hat:enterprise_linux:7::workstationAll versions0:1.0.9-10.el7_9
flatpak Red Hat:enterprise_linux:8::appstreamAll versions0:1.6.2-5.el8_3
flatpak-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:1.6.2-5.el8_3
flatpak-debugsource Red Hat:enterprise_linux:8::appstreamAll versions0:1.6.2-5.el8_3
flatpak-libs Red Hat:enterprise_linux:8::appstreamAll versions0:1.6.2-5.el8_3
flatpak-libs-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:1.6.2-5.el8_3
flatpak-selinux Red Hat:enterprise_linux:8::appstreamAll versions0:1.6.2-5.el8_3
flatpak-session-helper Red Hat:enterprise_linux:8::appstreamAll versions0:1.6.2-5.el8_3
flatpak-session-helper-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:1.6.2-5.el8_3
flatpak-tests-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:1.6.2-5.el8_3
flatpak Red Hat:rhel_eus:8.1::appstreamAll versions0:1.0.9-3.el8_1
flatpak-debuginfo Red Hat:rhel_eus:8.1::appstreamAll versions0:1.0.9-3.el8_1
flatpak-debugsource Red Hat:rhel_eus:8.1::appstreamAll versions0:1.0.9-3.el8_1
flatpak-libs Red Hat:rhel_eus:8.1::appstreamAll versions0:1.0.9-3.el8_1
flatpak-libs-debuginfo Red Hat:rhel_eus:8.1::appstreamAll versions0:1.0.9-3.el8_1
flatpak Red Hat:rhel_eus:8.2::appstreamAll versions0:1.6.2-4.el8_2
flatpak-debuginfo Red Hat:rhel_eus:8.2::appstreamAll versions0:1.6.2-4.el8_2
flatpak-debugsource Red Hat:rhel_eus:8.2::appstreamAll versions0:1.6.2-4.el8_2
flatpak-libs Red Hat:rhel_eus:8.2::appstreamAll versions0:1.6.2-4.el8_2
flatpak-libs-debuginfo Red Hat:rhel_eus:8.2::appstreamAll versions0:1.6.2-4.el8_2
flatpak-selinux Red Hat:rhel_eus:8.2::appstreamAll versions0:1.6.2-4.el8_2

Products include Debian Debian Linux, Flatpak Flatpak.

How do I fix CVE-2021-21261?

Upgrade to a fixed version.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2021-21261 being exploited?

There is no known exploitation of CVE-2021-21261 in the wild and no public exploit code.

All Debian Debian Linux vulnerabilities

Sources

Also known as CLEANSTART-2024-PO02295, DEBIAN-CVE-2021-21261, DSA-4830-1, GHSA-4ppf-fxf6-vxg2, OESA-2021-1043, RHSA-2021:0304 and 7 more.

Is CVE-2021-21261 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free