VAITP Dataset

← Back to the dataset

CVE-2026-128139

Quadratic CPU DoS in NLTK XMLCorpusView via large comments/CDATA.

  • CVSS 7.5
  • CWE-400
  • Resource Management
  • 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.6 to 3.10.3, XMLCorpusView._read_xml_fragment accumulates 1 KiB blocks and repeatedly applies whole-buffer XML validation while a comment or CDATA terminator remains ahead. A large comment in an attacker-controlled corpus file causes quadratic CPU consumption through documented XML corpus readers across the affected range. On 3.6 and 3.9.2, a large CDATA section incurs the quadratic scan before rejection, while on 3.10.3 both comment and CDATA documents are read successfully. This vulnerability is fixed in 3.10.4.

CVSS base score
7.5
Published
2026-11-19
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Timing/Serialization
Code defect classification
Timing Issues
Category
Resource Management
Subcategory
Resource Exhaustion
Accessibility scope
Local
Impact
Denial of Service (DoS)
Affected component
Python
Fixed by upgrading
Yes

Solution

Upgrade NLTK to version 3.10.4 or newer.

Vulnerable code sample

import nltk
from nltk.corpus.reader import XMLCorpusReader

def load_corpus(path):
    # VULNERABLE: quadratic XML validation on large comments/CDATA
    reader = XMLCorpusReader(path, r'.*\.xml')
    return list(reader.xml())  # triggers XMLCorpusView._read_xml_fragment

Patched code sample

import nltk
from nltk.corpus.reader import XMLCorpusReader

def load_corpus(path):
    # FIX: limit block size to avoid repeated whole‑buffer validation
    reader = XMLCorpusReader(path, r'.*\.xml', block_size=8192)
    return list(reader.xml())

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.

Cite this entry

@misc{vaitp:cve2026128139,
  title        = {{Quadratic CPU DoS in NLTK XMLCorpusView via large comments/CDATA.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-128139},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-128139/}}
}

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.