HSEC-2026-0014
Vulnerability from osv_haskell – Published: 2026-11-13 11:01 – Updated: 2026-11-13 11:01 – Source websiteArbitrary 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).
{
"affected": [
{
"database_specific": {
"human_link": "https://github.com/haskell/security-advisories/tree/main/advisories/published/2026/HSEC-2026-0014.md",
"osv": "https://raw.githubusercontent.com/haskell/security-advisories/refs/heads/generated/osv-export/2026/HSEC-2026-0014.json"
},
"ecosystem_specific": {
"affected_api": [
{
"module": "Codec.Archive",
"name": "unpackToDir"
},
{
"module": "Codec.Archive",
"name": "unpackToDirLazy"
},
{
"module": "Codec.Archive",
"name": "unpackArchive"
}
]
},
"package": {
"ecosystem": "Hackage",
"name": "libarchive"
},
"ranges": [
{
"events": [
{
"introduced": "0.1.0.0"
},
{
"fixed": "3.0.6.0"
}
],
"type": "ECOSYSTEM"
}
],
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
],
"database_specific": {
"home": "https://github.com/haskell/security-advisories",
"osvs": "https://raw.githubusercontent.com/haskell/security-advisories/refs/heads/generated/osv-export",
"repository": "https://github.com/haskell/security-advisories"
},
"details": "# Arbitrary file write via path traversal in unpackToDir\n\n`Codec.Archive.unpackToDir` extracts a tar (or other archive supported by the\nlibarchive C library) from a `ByteString` into a directory. `unpackToDirLazy`\nis the streaming variant; both funnel through the same internal\n`unpackEntriesFp` routine.\n\n`unpackEntriesFp` joined each entry\u0027s name onto the destination directory with\n`System.FilePath.(\u003c/\u003e)` without validating the name. Entry names starting with\n`..` sequences therefore escape the destination: `fp \u003c/\u003e \"../../../../etc/x\"`\nresolves outside the extraction root. The joined path is written back into the\narchive entry (`archiveEntrySetPathname`) and handed to libarchive\u0027s\n`archive_read_extract` with no `ARCHIVE_EXTRACT_SECURE_*` flags, so neither the\nHaskell layer nor the C library rejects the traversal. The `..` check is not\nlimited to tar archives: any format whose entry names libarchive reports\nverbatim is affected. Extraction result codes were also discarded, so write\nfailures could pass unnoticed.\n\nAn attacker who can supply an archive to a service that extracts it with these\nAPIs gains an arbitrary file write with the privileges of the extracting\nprocess. A demonstrated escalation (verified in a container): an archive with\nmember `../../../../etc/profile.d/zz-poc-zipslip.sh` plants a shell script\nsourced by every subsequent login shell, converting the file write into code\nexecution when any user logs in.\n\nThe reported traversal is fixed in libarchive-3.0.6.0, which fails with\n`ArchiveFatal` when an entry path begins with `..`\n(commit `325a2296379905557de1fa21b28d86f34bab2441`).\n\nUsers should upgrade to libarchive-3.0.6.0 or later. If pinned to an older\nversion, validate entry names before extraction (reject absolute paths and any\npath containing a `..` component) or extract inside a sandboxed directory.\n\nExternal vulnerability reported by Akash Sebastian (justabughunter).\n",
"id": "HSEC-2026-0014",
"modified": "2026-11-13T11:01:54Z",
"published": "2026-11-13T11:01:54Z",
"references": [
{
"type": "PACKAGE",
"url": "https://hackage.haskell.org/package/libarchive"
},
{
"type": "FIX",
"url": "https://github.com/vmchale/libarchive/commit/325a2296379905557de1fa21b28d86f34bab2441"
}
],
"schema_version": "1.5.0",
"summary": "Arbitrary file write via path traversal in unpackToDir"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.