HSEC-2026-0014

Vulnerability from osv_haskell – Published: 2026-11-13 11:01 – Updated: 2026-11-13 11:01 – Source website
VLAI
Summary
Arbitrary file write via path traversal in unpackToDir
Details

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).


{
  "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"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

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.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    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.