# CVE-2020-5291: Privilege escalation in setuid mode via user namespaces in Bubblewrap

> Attackers can gain root privileges in Bubblewrap when setuid mode and unprivileged user namespaces are enabled.

- **Severity:** High 7.2 (`CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 31 Mar 2020
- **Updated:** 4 Aug 2024
- **Also known as:** ALPINE-CVE-2020-5291, DEBIAN-CVE-2020-5291, GHSA-j2qp-rvxj-43vj, UBUNTU-CVE-2020-5291

## What is CVE-2020-5291?

CVE-2020-5291 is a high-severity vulnerability in Debian Debian Linux, published on 31 Mar 2020. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

Bubblewrap (bwrap) before version 0.4.1, if installed in setuid mode and the kernel supports unprivileged user namespaces, then the `bwrap --userns2` option can be used to make the setuid process keep running as root while being traceable. This can in turn be used to gain root permissions. Note that this only affects the combination of bubblewrap in setuid mode (which is typically used when unprivileged user namespaces are not supported) and the support of unprivileged user namespaces. Known to be affected are: * Debian testing/unstable, if unprivileged user namespaces enabled (not default) * Debian buster-backports, if unprivileged user namespaces enabled (not default) * Arch if using `linux-hardened`, if unprivileged user namespaces enabled (not default) * Centos 7 flatpak COPR, if unprivileged user namespaces enabled (not default) This has been fixed in the 0.4.1 release, and all affected users should update.

Weakness: CWE-269 (Improper Privilege Management), CWE-648 (Incorrect Use of Privileged APIs)

## Which versions are affected by CVE-2020-5291?

It affects 4 products.


Products: Archlinux Arch Linux, Centos Centos, Debian Debian Linux, Projectatomic Bubblewrap.

## How do I fix CVE-2020-5291?

Upgrade to a fixed version.

## Is CVE-2020-5291 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2020-5291 and fix it if it is affected.

What it is: CVE-2020-5291 is a high-severity vulnerability in Debian Debian Linux, published on 31 Mar 2020. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2020-5291 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-2020-5291/ (Markdown: https://insights.sbomify.com/CVE-2020-5291/index.md)
```

## Sources

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

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