`nix-nar`: `Decoder::unpack` writes archive entries outside the destination directory (path traversal)
Affects nix-narSource GCVE Database
CVSS 7.5 High : upgrade to 0.6.0 soon.
Data as of 30 Oct 2026, 11:15 UTC
- Patch
- Available – fixed in 0.6.0
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:NWhat to do
Upgrade nix-nar to 0.6.0.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
crates.ionix-narpkg:cargo/nix-narOther threats | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
A fix is available in `nix-nar` version 0.6.0. Users should upgrade to version 0.6.0 or later to mitigate this path traversal vulnerability. No additional mitigation steps are required if the upgrade is applied.
Description
The `nix-nar` crate's `Decoder::unpack` function improperly handles path containment when extracting archive entries, allowing a malicious NAR archive to write files outside the intended destination directory via path traversal. This occurs because symlink targets are not validated and the containment check only compares path strings without considering symlinks created earlier during unpacking. An attacker can craft an archive that creates symlinks pointing outside the destination and then writes files through these symlinks, potentially enabling code execution by placing files in attacker-controlled locations.