HSEC-2026-0014: Arbitrary file write via path traversal in unpackToDir
Published 2026-11-13 · Updated 2026-11-13
Summary
Hackage libarchive versions from 0.1.0.0 before 3.0.6.0 contain a path traversal flaw in Codec.Archive.unpackToDir and unpackToDirLazy that allows arbitrary file writes via entry names starting with '..'. Engineering teams using these APIs to extract untrusted archives should upgrade to libarchive 3.0.6.0 or later.
Who is affected
Applications and services using Hackage libarchive versions 0.1.0.0 up to 3.0.6.0 that call unpackToDir or unpackToDirLazy on attacker-supplied archives are affected across tar and any other supported format whose entry names are reported verbatim. Exploitation requires supplying a crafted archive containing entry paths beginning with '..', as unpackEntriesFp joins entry names without validation and calls archive_read_extract without ARCHIVE_EXTRACT_SECURE_* flags while also discarding extraction result codes. This grants an attacker arbitrary file write with the privileges of the extracting process, which was demonstrated to escalate to code execution by planting a shell script in /etc/profile.d/ that executes on subsequent user logins.
Exploitability
A CVSS vector and base score have not been provided or computed for this vulnerability, and an EPSS score is not yet available. The record lists CISA Known Exploited Vulnerabilities status as no, so active exploitation is not indicated by KEV. Quantitative exploitability ratings are therefore not documented.
Remediation
- Upgrade the Hackage libarchive dependency to version 3.0.6.0 or later, which fails with ArchiveFatal when an entry path begins with '..'.
- If pinned to an older version prior to 3.0.6.0, validate all archive entry names before extraction by rejecting absolute paths and any path containing a '..' component.
- If immediate upgrading is not possible, extract untrusted archives inside a sandboxed directory.
How to check your project
- Inspect project dependency configurations and lockfiles to identify whether Hackage libarchive version 0.1.0.0 or newer and prior to 3.0.6.0 is resolved.
- Audit application source code for calls to Codec.Archive.unpackToDir and unpackToDirLazy, especially where external or untrusted archives are processed.
Automated analysis of the published advisory data, generated 2026-11-19. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | Upgrade |
|---|---|---|---|---|
| Hackage | libarchive |
>= 0.1.0.0, < 3.0.6.0 | 3.0.6.0 | - |
FAQ
Which versions of Hackage libarchive are affected and fixed?
The vulnerability was introduced in version 0.1.0.0 and is fixed in version 3.0.6.0.
Does this path traversal issue only impact tar archives?
No. Any archive format supported by the libarchive C library whose entry names are reported verbatim is affected when extracted with unpackToDir or unpackToDirLazy.
What mitigations are available if we cannot immediately upgrade to libarchive 3.0.6.0?
If pinned to an older version, you should validate entry names before extraction to reject absolute paths and any path containing a '..' component, or perform extraction inside a sandboxed directory.
Original advisory description
References
- PACKAGE https://hackage.haskell.org/package/libarchive
- FIX https://github.com/vmchale/libarchive/commit/325a2296379905557de1fa21b28d86f34bab2441
Source records: HSEC-2026-0014 (OSV.dev).