/

CVE-2026-128135

Severity:

HIGH RISK

(7.1)

Hardlink Path Traversal (CWE-59) in NLTK ZIP Extraction

CVE-2026-128135

Awaiting Analysis

Vulnerability type

Category:

Improper Link Resolution

CWE:

CWE-59, CWE-73

Impact:

Out-of-root file overwrite affecting integrity and availability

Severity:

HIGH RISK

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

NLTK ZIP extraction can write through an in-root hardlink whose other link points outside the intended NLTK data directory. A local attacker who can prepare the extraction target may cause a package member to overwrite an out-of-root file, potentially affecting its integrity or availability.

Affected context

The issue affects NLTK ZIP package extraction in versions 3.9.4 through 3.10.3 when an extraction target contains an in-root hardlink to a file outside the NLTK data root. In that situation, writing a package member through the link can cross the intended path containment boundary.

Exploit preconditions

  • Attack surface: Local access to an environment where NLTK performs ZIP extraction
  • Required access: Ability to prepare or influence the extraction target, including the relevant hardlink
  • Trigger point: Extraction of a ZIP package member to a path matching the in-root hardlink
  • Why exploitation is possible: The filesystem follows the hardlink to its outside target, allowing a write to escape the intended data root

Why this happens

The extraction process does not sufficiently account for hardlinks when enforcing path containment. A pathname may appear to remain inside the NLTK data root while resolving through an in-root hardlink to an out-of-root file. This is an improper link resolution issue mapped primarily to CWE-59: Improper Link Resolution Before File Access; the associated CWE-73 relates to external control of file names or paths.

Potential impact

  • An attacker may overwrite files outside the intended NLTK data root.
  • Modified files could affect application or system integrity.
  • Overwriting or damaging important files could disrupt availability.

General mitigation guidance

Defensive approaches focus on keeping extraction writes within a trusted directory boundary and reducing control over extraction targets.

  • Use extraction logic that safely handles symbolic links and hardlinks, and rejects paths that resolve outside the intended root.
  • Create extraction targets in newly created, access-controlled directories rather than attacker-prepared locations.
  • Validate paths and filesystem objects at the point of use, accounting for link resolution and race conditions.
  • Limit the privileges of processes that perform extraction and restrict write access to sensitive files.
  • Prefer secure-by-default archive handling APIs and minimize reliance on attacker-controlled archive paths or target state.

How teams detect issues like this

  • Use static analysis and code review to identify archive extraction code that writes files without resolving and checking link targets.
  • Review whether path containment checks account for hardlinks, symbolic links, and filesystem changes between validation and writing.
  • Apply policy checks to flag extraction into shared or attacker-writable directories, as well as processes with broad filesystem write permissions.
  • Test extraction behavior with linked targets in controlled security tests.

Sources

SourceLink
github.comgithub.com/nltk/nltk/commit/0e9898b7615b4ab3b023e868212316a489ece4f0
github.comgithub.com/nltk/nltk/commit/cf12a5e6a439fe1d722acd53d4309911faaaaf78
github.comgithub.com/nltk/nltk/pull/3753
github.comgithub.com/nltk/nltk/releases/tag/v3.10.4
github.comgithub.com/nltk/nltk/security/advisories/GHSA-wr3g-j6qj-xpgh

Frequently asked

questions

The described attack is local: an attacker must be able to prepare the extraction target and cause NLTK to extract a package.

They need sufficient local access to influence the extraction target, including the relevant in-root hardlink, and an opportunity to trigger extraction.

Ensure extraction writes remain within a trusted root after accounting for filesystem links, and use a fresh, access-controlled extraction directory.

Use secure archive-handling APIs, validate resolved destinations at write time, restrict who can modify extraction targets, and run extraction with least privilege.

Find out what's already
exploitable in your codebase.