# CVE-2020-15229: Path traversal and files overwrite with unsquashfs

> Attackers can overwrite host files via crafted squashfs images, leading to system compromise, especially during root builds.

- **Severity:** High 8.2 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 14 Oct 2020
- **Updated:** 4 Aug 2024
- **Also known as:** GHSA-7gcp-w6ww-2xv9, openSUSE-SU-2020:1769-1, openSUSE-SU-2020:1770-1, openSUSE-SU-2020:1814-1

## What is CVE-2020-15229?

CVE-2020-15229 is a high-severity path traversal vulnerability in Opensuse Backports Sle, published on 14 Oct 2020. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Singularity (an open source container platform) from version 3.1.1 through 3.6.3 has a vulnerability. Due to insecure handling of path traversal and the lack of path sanitization within `unsquashfs`, it is possible to overwrite/create any files on the host filesystem during the extraction with a crafted squashfs filesystem. The extraction occurs automatically for unprivileged (either installation or with `allow setuid = no`) run of Singularity when a user attempt to run an image which is a local SIF image or a single file containing a squashfs filesystem and is coming from remote sources `library://` or `shub://`. Image build is also impacted in a more serious way as it can be used by a root user, allowing an attacker to overwrite/create files leading to a system compromise, so far bootstrap methods `library`, `shub` and `localimage` are triggering the squashfs extraction. This issue is addressed in Singularity 3.6.4. All users are advised to upgrade to 3.6.4 especially if they use Singularity mainly for building image as root user. There is no solid workaround except to temporary avoid to use unprivileged mode with single file images in favor of sandbox images instead. Regarding image build, temporary avoid to build from `library` and `shub` sources and as much as possible use `--fakeroot` or a VM for that.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

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

2 open source packages ship an affected version, including github.com/sylabs/singularity. It affects 3 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/sylabs/singularity` | Go | From 3.1.1 | 3.6.4 |
| `github.com/sylabs/singularity` | Go | From 3.1.1 | 3.6.4 |
| `singularity` | SUSE:Package Hub 15 SP2 | All versions | 3.6.4-bp152.2.12.1 |
| `singularity` | openSUSE:Leap 15.1 | All versions | 3.6.4-lp151.2.12.1 |
| `singularity` | openSUSE:Leap 15.2 | All versions | 3.6.4-lp152.2.9.1 |

Products: Opensuse Backports Sle, Opensuse Leap, Sylabs Singularity.

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

Upgrade github.com/sylabs/singularity to 3.6.4 or later.

## Is CVE-2020-15229 being exploited?

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

## Other vulnerabilities in Opensuse Backports Sle

- [CVE-2020-12641](https://insights.sbomify.com/CVE-2020-12641/): Roundcube Webmail Remote Code Execution (critical 9.8, exploited in the wild)
- [CVE-2020-12640](https://insights.sbomify.com/CVE-2020-12640/): Path traversal in n/a (critical 9.8)
- [CVE-2020-8233](https://insights.sbomify.com/CVE-2020-8233/): Command injection in EdgeSwitch firmware v1.9.0 and prior (high 8.8)
- [CVE-2020-8026](https://insights.sbomify.com/CVE-2020-8026/): inn: non-root owned files (high 8.4)
- [CVE-2019-5164](https://insights.sbomify.com/CVE-2019-5164/): Command injection in Shadowsocks (high 7.8)

## Fix prompt for AI coding agents

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

What it is: CVE-2020-15229 is a high-severity path traversal vulnerability in Opensuse Backports Sle, published on 14 Oct 2020. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2020-15229 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/sylabs/singularity (Go): affected from 3.1.1; fixed in 3.6.4
- github.com/sylabs/singularity (Go): affected from 3.1.1; fixed in 3.6.4

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-15229/ (Markdown: https://insights.sbomify.com/CVE-2020-15229/index.md)
```

## Sources

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

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