VAITP Dataset

← Back to the dataset

CVE-2026-128135

NLTK ZIP extraction can overwrite out‑of‑root files via hardlink abuse (3.9.4‑3.10.3).

  • CVSS 7.1
  • CWE-59
  • Input Validation and Sanitization
  • Local

NLTK (Natural Language Toolkit) is a suite of open source Python modules, data sets, and tutorials supporting research and development in Natural Language Processing. From 3.9.4 to 3.10.3, NLTK ZIP package extraction can write through an existing in-root hardlink whose other link points outside the NLTK data root. A local attacker who can prepare the extraction target can cause a package member write to overwrite an out-of-root file, violating the pathsec containment boundary and affecting integrity and availability. This issues is fixed in version 3.10.4.

CVSS base score
7.1
Published
2026-11-19
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Path Traversal
Accessibility scope
Local
Impact
Denial of Service (DoS)
Affected component
NLTK
Fixed by upgrading
Yes

Solution

Upgrade NLTK to version 3.10.4 or later.

Vulnerable code sample

import os
import zipfile
from pathlib import Path

def install_nltk_data(zip_path: str, target_root: str) -> None:
    """
    Extract an NLTK data zip file into the given root directory.
    """
    target = Path(target_root)
    with zipfile.ZipFile(zip_path, 'r') as zf:
        # VULNERABLE: extracts without checking for hard‑links, allowing write‑through
        zf.extractall(path=target)

Patched code sample

import os
import zipfile
from pathlib import Path

def install_nltk_data(zip_path: str, target_root: str) -> None:
    """
    Extract an NLTK data zip file into the given root directory.
    """
    target = Path(target_root)

    def _is_hardlink(info: zipfile.ZipInfo) -> bool:
        # A hardlink in a zip has external_attr indicating a Unix file type of 0o120000
        return (info.external_attr >> 16) & 0o170000 == 0o120000

    with zipfile.ZipFile(zip_path, 'r') as zf:
        for info in zf.infolist():
            # FIX: skip members that are hard‑links to avoid write‑through attacks
            if _is_hardlink(info):
                continue
            zf.extract(info, path=target)

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

  • Refuse multiply-linked zip targets and bound what the data server sends (nltk/nltk)
    nltk/downloader.py, nltk/downloader.py · Downloader.download, nltk/downloader.py · Downloader._download_package, nltk/downloader.py · Downloader._update_index, nltk/downloader.py · _unzip_iter, nltk/pathsec.py · ZipFile._extract_member
  • Patch seven algorithmic-DoS and path/exec GHSA classes across all affected modules (nltk/nltk)
    nltk/ccg/lexicon.py, nltk/ccg/lexicon.py · augParseCategory, nltk/ccg/lexicon.py · matchBrackets, nltk/ccg/lexicon.py · nextCategory, nltk/corpus/reader/conll.py · ConllCorpusReader._get_srl_instances, nltk/corpus/reader/timit.py · TimitCorpusReader.phone_trees, nltk/corpus/reader/xmldocs.py, nltk/corpus/reader/xmldocs.py · XMLCorpusView._read_xml_fragment, nltk/data.py, nltk/data.py · SeekableUnicodeStreamReader.readline, nltk/downloader.py, nltk/downloader.py · _unzip_iter and 21 more

Cite this entry

@misc{vaitp:cve2026128135,
  title        = {{NLTK ZIP extraction can overwrite out‑of‑root files via hardlink abuse (3.9.4‑3.10.3).}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-128135},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-128135/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.