CVE-2022-21682 flatpak-builder can access files outside the build directory.

High 7.7 Published Updated

A malicious application can exploit path traversal in flatpak-builder to execute arbitrary code or modify files outside the build directory.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-21682?

CVE-2022-21682 is a high-severity path traversal vulnerability in Debian Debian Linux, published on 13 Jan 2022. Any signed-in user can exploit it over the network, with no action from the victim.

Official description

Flatpak is a Linux application sandboxing and distribution framework. A path traversal vulnerability affects versions of Flatpak prior to 1.12.3 and 1.10.6. flatpak-builder applies `finish-args` last in the build. At this point the build directory will have the full access that is specified in the manifest, so running `flatpak build` against it will gain those permissions. Normally this will not be done, so this is not problem. However, if `--mirror-screenshots-url` is specified, then flatpak-builder will launch `flatpak build --nofilesystem=host appstream-utils mirror-screenshots` after finalization, which can lead to issues even with the `--nofilesystem=host` protection. In normal use, the only issue is that these empty directories can be created wherever the user has write permissions. However, a malicious application could replace the `appstream-util` binary and potentially do something more hostile. This has been resolved in Flatpak 1.12.3 and 1.10.6 by changing the behaviour of `--nofilesystem=home` and `--nofilesystem=host`.

Weakness: CWE-22

Which versions are affected by CVE-2022-21682?

It affects 5 products.

Linux distribution packages (7)
flatpak-builder AlmaLinux:8All versions1.0.14-2.el8
flatpak-builder Red Hat:enterprise_linux:8::appstreamAll versions0:1.0.14-2.el8
flatpak-builder-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:1.0.14-2.el8
flatpak-builder-debugsource Red Hat:enterprise_linux:8::appstreamAll versions0:1.0.14-2.el8
flatpak-builder Rocky Linux:8All versions0:1.0.14-2.el8
flatpak openSUSE:TumbleweedAll versions1.12.4-1.1
flatpak-builder openSUSE:TumbleweedAll versions1.2.2-1.1

Products include Debian Debian Linux, Fedoraproject Fedora, Flatpak Flatpak, Flatpak Flatpak-Builder, Redhat Enterprise Linux.

How do I fix CVE-2022-21682?

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-2022-21682 being exploited?

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

All Debian Debian Linux vulnerabilities

Sources

Also known as ALSA-2022:7458, CLEANSTART-2024-GX04243, DEBIAN-CVE-2022-21682, GHSA-8ch7-5j3h-g4fx, OESA-2022-1788, RHSA-2022:7458 and 4 more.

Is CVE-2022-21682 in your software?

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

Check your SBOMs for free