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

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

- **Severity:** High 7.7 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 13 Jan 2022
- **Updated:** 3 Aug 2024
- **Also known as:** ALSA-2022:7458, CLEANSTART-2024-GX04243, DEBIAN-CVE-2022-21682, GHSA-8ch7-5j3h-g4fx, OESA-2022-1788, RHSA-2022:7458, RLSA-2022:7458, UBUNTU-CVE-2022-21682, openSUSE-SU-2024:11755-1, openSUSE-SU-2024:11756-1

## 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 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2022-21682?

It affects 5 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `flatpak-builder` | AlmaLinux:8 | All versions | 1.0.14-2.el8 |
| `flatpak-builder` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.0.14-2.el8 |
| `flatpak-builder-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.0.14-2.el8 |
| `flatpak-builder-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.0.14-2.el8 |
| `flatpak-builder` | Rocky Linux:8 | All versions | 0:1.0.14-2.el8 |
| `flatpak` | openSUSE:Tumbleweed | All versions | 1.12.4-1.1 |
| `flatpak-builder` | openSUSE:Tumbleweed | All versions | 1.2.2-1.1 |

Products: 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.

## Is CVE-2022-21682 being exploited?

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

## Other vulnerabilities in Debian Debian Linux

- [CVE-2015-3306](https://insights.sbomify.com/CVE-2015-3306/): ProFTPD Improper Access Control (critical 10.0, exploited in the wild)
- [CVE-2025-49113](https://insights.sbomify.com/CVE-2025-49113/): RoundCube Webmail Deserialization of Untrusted Data (critical 9.9, exploited in the wild)
- [CVE-2026-24061](https://insights.sbomify.com/CVE-2026-24061/): GNU InetUtils Argument Injection (critical 9.8, exploited in the wild)
- [CVE-2025-39682](https://insights.sbomify.com/CVE-2025-39682/): Linux Kernel Improper Check for Unusual or Exceptional Conditions (critical 9.8, exploited in the wild)
- [CVE-2024-9680](https://insights.sbomify.com/CVE-2024-9680/): Mozilla Firefox Use-After-Free (critical 9.8, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-21682 and fix it if it is affected.

What it is: 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.
Exploitation: There is no known exploitation of CVE-2022-21682 in the wild and no public exploit code.

Affected product: Debian Debian Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-21682/ (Markdown: https://insights.sbomify.com/CVE-2022-21682/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-21682
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-21682
- OSV: https://osv.dev/vulnerability/CVE-2022-21682

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-21682/
Summaries are generated and may contain mistakes; the official description above is the record.
