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

Published Nov 13, 2026
·
Updated

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 archivereadextract with no ARCHIVEEXTRACTSECURE 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 Software

1 affected componentFixes available
hackage/libarchive>=0.1.0.0<3.0.6.0
3.0.6.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade hackage/libarchive to a version that resolves this vulnerability.

    Fixed in 3.0.6.0
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 3.0.6.0
  3. Compensating control

    If using an older libarchive version, reject absolute entry paths and paths containing a `..` component before extraction, or extract into a sandboxed directory.

Event History

Nov 13, 2026
Advisory Published
via OSV·11:01 AM
Data Sourced
via OSV·11:01 AM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

Which extraction APIs are affected?

Both Codec.Archive.unpackToDir and the streaming unpackToDirLazy variant are affected because they use the same internal unpackEntriesFp routine.

2

Is the issue limited to tar archives?

No. Any archive format for which libarchive reports entry names verbatim can be affected.

3

What must an attacker be able to do to exploit this?

The attacker must be able to supply an archive that the application extracts using the affected APIs. They can then write files with the privileges of the extracting process.

4

Can extraction result handling be relied on to identify unsuccessful writes?

No. Extraction result codes were discarded, so write failures could pass unnoticed.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203