/

CVE-2026-56876

Severity:

HIGH RISK

(8.1)

Zip Symlink Path Traversal (CWE-22) in extract-zip

CVE-2026-56876

Analyzed

Vulnerability type

Category:

Path Traversal via Archive Extraction

CWE:

CWE-22, CWE-61

Impact:

Arbitrary File Read/Write via Symlink Traversal

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

The extract-zip library fails to validate symlink targets when extracting archives, allowing links to point outside the intended extraction directory.

If a malicious ZIP includes symlinks with traversal paths (e.g., "../../../../etc/passwd"), applications using extract-zip may inadvertently enable arbitrary file read or write operations depending on their usage context.

Affected context

This vulnerability occurs in applications that rely on extract-zip to unpack user-provided or untrusted ZIP archives without additional path or symlink validation.

It is most relevant when extracted content is later read, served, or overwritten by the application or other system components under the assumption that all files and links remain contained within a dedicated extraction directory.

The risk increases when the process has access to sensitive filesystem locations or runs with elevated privileges.

Exploit preconditions

  • Attack surface: ZIP archive ingestion paths (file upload endpoints, package importers, content processing pipelines, or any workflow that unpacks ZIP files using extract-zip).
  • Required access: Ability to supply or control a ZIP file that will be processed by an extract-zip-based workflow, typically through an upload, sync, or import mechanism.
  • Trigger point: Archive extraction using extract-zip, where the library creates filesystem entries, including symlinks, directly based on data inside the ZIP.
  • Why exploitation is possible: Symlink targets within the archive are not normalized or constrained to the extraction root. As a result, path traversal sequences and absolute paths can produce symlinks pointing to arbitrary locations on the host filesystem, enabling indirect access when those links are later followed.

Why this happens

At its core, this issue stems from improper restriction of file paths during archive extraction, aligning with CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) and CWE-61 (Improper Restriction of Symlink Following).

The extract-zip library trusts symlink entries embedded in ZIP files and creates them without validating or resolving their target paths against the intended extraction root.

This insecure pattern allows relative path traversal (e.g., "../" sequences) or crafted absolute paths to escape the designated directory boundary.

When application logic subsequently reads from or writes to these symlinks, it can unintentionally operate on sensitive or unintended files elsewhere in the filesystem.

Potential impact

  • An attacker may cause the application to read sensitive files through symlinks pointing to locations such as configuration files, credentials stores, or system data.
  • The application could overwrite or modify arbitrary files when writing to paths that resolve through malicious symlinks.
  • Local privilege escalation may occur if the vulnerable process runs with higher privileges and is tricked into altering security-critical files (e.g., logs, configuration, or service scripts).
  • Data integrity issues can arise if application- or system-owned files are unexpectedly replaced or corrupted via redirected writes.
  • In multi-tenant environments, one tenant could potentially access or interfere with another tenant's data by abusing shared extraction paths.

General mitigation guidance

Effective mitigation focuses on enforcing strict directory boundaries and treating archive contents as untrusted until validated.

Common defensive patterns include:

  • Normalizing and validating all paths from ZIP entries (including symlink targets) to ensure they remain within a configurable extraction root, rejecting or sanitizing entries that traverse outside.
  • Disabling or filtering symlink extraction entirely when not strictly required, or replacing symlinks with safe metadata representations rather than filesystem links.
  • Implementing an allowlist-based extraction policy that only permits expected file types and locations, and skips unexpected links or special filesystem objects.
  • Running archive extraction under least-privilege accounts with limited filesystem access to reduce the impact of any escaped paths.
  • Isolating extraction into dedicated, sandboxed directories or containers and treating extracted artifacts as untrusted until additional validation logic completes.

How teams detect issues like this

Detection typically combines code-level review with operational safeguards:

  • Static analysis or linters can flag uses of archive libraries that create symlinks or write files without validating normalized paths against an expected root directory.
  • Code reviews should look for patterns where filesystem paths derived from ZIP entries are used directly, especially where "../" sequences or absolute paths are not explicitly handled.
  • Security policies may require that archive extraction utilities enforce path canonicalization and block symlink creation unless explicitly justified.
  • Runtime monitoring can track file system changes during extraction workflows, alerting when processes create symlinks or write outside designated extraction directories.
  • Automated dependency scanning tools can highlight known archive-handling vulnerabilities and prompt inspection of how libraries like extract-zip are integrated.

Sources

SourceLink
github.comgithub.com/ziad626/extract-zip-security-research/security/advisories/GHSA-x7jf-2287-qcpf
raw.githubusercontent.comraw.githubusercontent.com/cisagov/CSAF/develop/csaf_files/IT/white/2026/va-26-177-01.json
cve.orgcve.org/CVERecord?id=CVE-2026-56876

Frequently asked

questions

Yes, it can be remotely exploitable in scenarios where an attacker can upload or otherwise supply a ZIP file that your application processes using extract-zip. The actual impact depends on how extracted content is used and what filesystem locations the process can access.

The attacker must be able to influence the ZIP archive fed into extract-zip—commonly via file upload endpoints, import features, or synchronization mechanisms. No direct shell access is required; control over archive contents is sufficient.

The most robust fix is to enforce strict path validation for all archive entries and symlink targets, ensuring they remain within a defined extraction root, and to reject or skip any entry that attempts directory traversal or points to an external path. If symlinks are not essential, disabling or filtering them entirely is safer.

Establish a standard archive-handling pattern across your codebase: treat all archive contents as untrusted, normalize and validate paths before creating files or links, avoid following or creating symlinks unless strictly needed, and run extraction code under least-privilege accounts within isolated directories or containers. Regular security-focused code reviews and automated checks for path traversal and symlink handling can help maintain this discipline.

Find out what's already
exploitable in your codebase.