# RUSTSEC-2026-0450: \`ocipkg\`: unpacking an OCI archive can write and delete files outside the local image store (path traversal)

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **Published:** 2026-10-30T12:00:00.000Z
- **Modified:** 2026-11-06T14:45:02.837Z

## Who should check

- Projects that depend on crates.io package ocipkg (\>= 0.0.0-0, \< 0.4.1)

## Description

When \`ocipkg\` unpacks an OCI archive, the destination directory is derived from the
image name, which \`ocipkg\` reads from the archive's \*\*own\*\* \`index.json\`
(\`org.opencontainers.image.ref.name\`). That name is attacker-controlled, and
\`ImageName::parse\` accepts a hostname of \`..\`, so the computed destination escapes the
local image store. A "zip-slip"-style path traversal (CWE-22 / CWE-23). This is esclatable to code execution.

In \`Artifact::unpack\` (\`src/image/artifact.rs\`), the destination is
\`image\_dir(name) = data\_dir().join(name.as\_path())\` (\`src/local/mod.rs:31\`), where the
name comes from \`get\_name\_from\_index\` (\`src/image/layout.rs:114-124\`):

\`\`\`rust
let image\_name = self.base.get\_name()?;   // from the archive's index.json ref.name
let dest = image\_dir(&image\_name)?;        // data\_dir().join(name.as\_path()); hostname ".." escapes
if dest.exists() {
    if overwrite {
        fs::remove\_dir\_all(&dest)?;        // deletes a directory OUTSIDE the store
    }
}
fs::create\_dir\_all(&dest)?;
// ... each tar layer is then unpacked under \`dest\` (also outside the store)
\`\`\`

\#\# The fix

Fixed in \`ocipkg\` 0.4.1 by \[PR \#223\](https://github.com/termoshtt/ocipkg/pull/223). The leading
reference component is validated against the \`org.opencontainers.image.ref.name\` grammar from OCI
Image Specification 1.1.1 on parse and deserialization, and \`local::image\_dir\` revalidates the name
and rejects any non-normal path component (e.g. \`..\`) before any filesystem mutation, so a crafted
archive can no longer escape the local image store.

## Affected and fixed versions

- crates.io `ocipkg`: affected \>= 0.0.0-0, \< 0.4.1; fixed 0.4.1 (osv)

## Mitigation

- Upgrade ocipkg to 0.4.1 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by RUSTSEC-2026-0450. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/RUSTSEC-2026-0450.md
Affected: ocipkg >= 0.0.0-0, < 0.4.1
Fixed in: 0.4.1

Steps:
1. Search this machine and project for ocipkg (crates.io): dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is RUSTSEC-2026-0450 being exploited?

There is no confirmed exploitation: RUSTSEC-2026-0450 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known.

### How serious is RUSTSEC-2026-0450?

It has no CVSS score yet. Unknown.

### Which versions are affected by RUSTSEC-2026-0450?

ocipkg \>= 0.0.0-0, \< 0.4.1.

### Is there a fix for RUSTSEC-2026-0450?

Yes. Fixed in 0.4.1. Upgrade ocipkg to 0.4.1 or later.

### How do I check if I'm affected by RUSTSEC-2026-0450?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://rustsec.org/advisories/RUSTSEC-2026-0450.html>
- patch: <https://github.com/termoshtt/ocipkg/pull/223>
- other: <https://crates.io/crates/ocipkg>
- other: <https://github.com/termoshtt/ocipkg/issues/222>

## Attribution

- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/RUSTSEC-2026-0450> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/RUSTSEC-2026-0450> · JSON: <https://flawdb.com/api/v1/entries/RUSTSEC-2026-0450>
