# CVE-2025-5981: Arbitrary File write in OSV-SCALIBR

> Attackers can write arbitrary files on the host system via path traversal when scanning untrusted container images with the remote-image flag.

- **Severity:** Medium 5.7 (`CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:A/VC:H/VI:L/VA:N/SC:H/SI:L/SA: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:** 18 Jun 2025
- **Updated:** 18 Jun 2025
- **Also known as:** GHSA-2hcm-q3f4-fjgw, GO-2025-3767

## What is CVE-2025-5981?

CVE-2025-5981 is a medium-severity path traversal vulnerability in Google osv-scalibr, published on 18 Jun 2025. 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

Arbitrary file write as the OSV-SCALIBR user on the host system via a path traversal vulnerability when using OSV-SCALIBR's unpack() function for container images. Particularly, when using the CLI flag --remote-image on untrusted container images.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory), CWE-427 (Uncontrolled Search Path Element)

## Which versions are affected by CVE-2025-5981?

3 open source packages ship an affected version, including github.com/google/osv-scalibr. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/google/osv-scalibr` | Go | From 0.1.3 | 0.2.1 |
| `github.com/google/osv-scalibr` | Go | From 0.1.3 | 0.2.1 |
| `github.com/google/osv-scalibr` | Go | From 0.1.3 | 0.2.1 |

Products: Google Osv-Scalibr.

## How do I fix CVE-2025-5981?

Upgrade github.com/google/osv-scalibr to 0.2.1 or later.

## Is CVE-2025-5981 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-5981 and fix it if it is affected.

What it is: CVE-2025-5981 is a medium-severity path traversal vulnerability in Google osv-scalibr, published on 18 Jun 2025. 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-2025-5981 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/google/osv-scalibr (Go): affected from 0.1.3; fixed in 0.2.1
- github.com/google/osv-scalibr (Go): affected from 0.1.3; fixed in 0.2.1
- github.com/google/osv-scalibr (Go): affected from 0.1.3; fixed in 0.2.1

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

## Sources

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

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