Every CVE Search/ Get API key

RUSTSEC-2026-0425

`nix-nar`: `Decoder::unpack` writes archive entries outside the destination directory (path traversal)

7.5 HighFix available

Decoder::unpack does not safely contain the paths it extracts, so a malicious NAR archive can create files outside the destination directory — a path traversal (CWE-22).

In src/dec.rs (Decoder::unpack):

  • A symlink entry's target is written without checking where it points (src/dec.rs:153), so the archive can create a symlink that escapes the destination directory.
  • The out-of-destination containment check compares path strings only and does not account for symlinks created earlier in the same unpack (src/dec.rs:176-181), before reaching the write sinks (std::fs::create_dir at src/dec.rs:201 and OpenOptions::open at src/dec.rs:218).
  • The parser also accepts entry names containing / (src/parser.rs:138-147).

Combined, a malicious archive can include a symlink a pointing at an external directory and then an entry named a/b, causing b to be written to <external>/b, outside the destination. This can create new files anywhere the process can write (it cannot overwrite existing files), which is escalatable to code execution by planting files in attacker-chosen locations.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
None
Integrity
High
Availability
None

What each source reports

OSV Score used 7.5

`nix-nar`: `Decoder::unpack` writes archive entries outside the destination directory (path traversal)

Decoder::unpack does not safely contain the paths it extracts, so a malicious NAR archive can create files outside the destination directory — a path traversal (CWE-22).

In src/dec.rs (Decoder::unpack):

  • A symlink entry's target is written without checking where it points (src/dec.rs:153), so the archive can create a symlink that escapes the destination directory.
  • The out-of-destination containment check compares path strings only and does not account for symlinks created earlier in the same unpack (src/dec.rs:176-181), before reaching the write sinks (std::fs::create_dir at src/dec.rs:201 and OpenOptions::open at src/dec.rs:218).
  • The parser also accepts entry names containing / (src/parser.rs:138-147).

Combined, a malicious archive can include a symlink a pointing at an external directory and then an entry named a/b, causing b to be written to <external>/b, outside the destination. This can create new files anywhere the process can write (it cannot overwrite existing files), which is escalatable to code execution by planting files in attacker-chosen locations.

Record
RUSTSEC-2026-0425
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Updated
2026-11-02

Affected packages

Affected packages
PackageAffectedFixed
nix-nar
crates.io
0.0.0-0 up to 0.6.0
0.6.0

History

History
RecordedChangedSources
first indexedOSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

RUSTSEC-2026-0425 is a high vulnerability (CVSS 7.5) in nix-nar, published October 30, 2026. No source lists public exploit code. Fixed in nix-nar 0.6.0.

References

MoveEnter Open