# HSEC-2026-0014: Arbitrary file write via path traversal in unpackToDir

- Severity: not scored yet
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2026-11-13T11:01:54.000Z
- Modified: 2026-11-13T11:15:03.323Z

## Description

# Arbitrary file write via path traversal in unpackToDir

`Codec.Archive.unpackToDir` extracts a tar (or other archive supported by the
libarchive C library) from a `ByteString` into a directory. `unpackToDirLazy`
is the streaming variant; both funnel through the same internal
`unpackEntriesFp` routine.

`unpackEntriesFp` joined each entry's name onto the destination directory with
`System.FilePath.(</>)` without validating the name. Entry names starting with
`..` sequences therefore escape the destination: `fp </> "../../../../etc/x"`
resolves outside the extraction root. The joined path is written back into the
archive entry (`archiveEntrySetPathname`) and handed to libarchive's
`archive_read_extract` with no `ARCHIVE_EXTRACT_SECURE_*` flags, so neither the
Haskell layer nor the C library rejects the traversal. The `..` check is not
limited to tar archives: any format whose entry names libarchive reports
verbatim is affected. Extraction result codes were also discarded, so write
failures could pass unnoticed.

An attacker who can supply an archive to a service that extracts it with these
APIs gains an arbitrary file write with the privileges of the extracting
process. A demonstrated escalation (verified in a container): an archive with
member `../../../../etc/profile.d/zz-poc-zipslip.sh` plants a shell script
sourced by every subsequent login shell, converting the file write into code
execution when any user logs in.

The reported traversal is fixed in libarchive-3.0.6.0, which fails with
`ArchiveFatal` when an entry path begins with `..`
(commit `325a2296379905557de1fa21b28d86f34bab2441`).

Users should upgrade to libarchive-3.0.6.0 or later. If pinned to an older
version, validate entry names before extraction (reject absolute paths and any
path containing a `..` component) or extract inside a sandboxed directory.

External vulnerability reported by Akash Sebastian (justabughunter).

(As written by Haskell Security Advisories.)

## Affected

- libarchive (Hackage): from 0.1.0.0 before 3.0.6.0

## References

- <https://hackage.haskell.org/package/libarchive> (package)
- <https://github.com/vmchale/libarchive/commit/325a2296379905557de1fa21b28d86f34bab2441> (fix)

## Sources

- Haskell Security Advisories: [HSEC-2026-0014](https://osv.dev/vulnerability/HSEC-2026-0014), CC0-1.0, modified 2026-11-13

---

Page: https://cve.day/HSEC-2026-0014 · Whole record: https://cve.day/HSEC-2026-0014.json · Rebuilt by cve.day 2026-11-25T22:56:25.656Z
