RustSec logo

History ⋅ Edit ⋅ JSON (OSV)

RUSTSEC-2026-0425

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

Reported
Issued
Package
nix-nar (crates.io)
Type
Vulnerability
Categories
Keywords
#path-traversal #directory-traversal #symlink #arbitrary-file-write #nar
References
CVSS Score
7.5 HIGH
CVSS Details
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality Impact
None
Integrity Impact
High
Availability Impact
None
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Patched
  • >=0.6.0
Affected Functions
Version
nix_nar::Decoder::unpack
  • <0.6.0

Description

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):

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.

Advisory available under CC0-1.0 license.