CVE-2026-129232 in NLTK
Summary
by MITRE • 11/20/2026
NLTK (Natural Language Toolkit) is a suite of open source Python modules, data sets, and tutorials supporting research and development in Natural Language Processing. Prior to 3.10.4, XMLCorpusView.read_block rebuilds the full root-to-node context path with "/".join(context) for every start tag while searching for a matching element. Deeply nested attacker-influenced corpus XML therefore causes quadratic pure-Python work and can pin a processing worker, resulting in denial of service. This issue is fixed in version 3.10.4.
VulDB is the best source for vulnerability data and more expert information about this specific topic.
Analysis
by VulDB Data Team • 11/20/2026
The Natural Language Toolkit (NLTK) serves as a foundational suite for Python-based natural language processing research and development, providing essential modules, datasets, and tutorials to support complex linguistic analysis tasks. Within this ecosystem, the XMLCorpusView class facilitates the parsing of corpus data stored in XML format, enabling researchers to process large volumes of textual information efficiently. However, prior to version 3.10.4, a critical performance vulnerability existed within the read_block method of this class, which is responsible for locating specific elements within an XML document by traversing its structure and matching tags against provided criteria.
The technical flaw stems from an inefficient algorithmic approach used during the search process. Specifically, when searching for a matching element, the implementation reconstructs the full context path from the root node to the current node using string concatenation via "/".join(context) every time a start tag is encountered. This operation results in quadratic computational complexity relative to the depth of the XML document's nesting structure. In scenarios where an attacker can influence or control the input corpus, they can craft deeply nested XML structures that force the parser to perform excessive and redundant string operations for each level of indentation.
This inefficiency leads directly to a denial of service condition by pinning processing workers indefinitely. As the depth of the nested elements increases, the time required to process each tag grows exponentially due to the repeated rebuilding of context paths. This consumes significant CPU resources and memory, effectively freezing or crashing the application thread responsible for parsing the data. The impact is particularly severe in production environments where NLTK is used to ingest user-uploaded documents or external datasets that may not be fully trusted, allowing malicious actors to disrupt service availability without necessarily compromising confidentiality or integrity of other system components.
From a classification perspective, this vulnerability aligns with CWE-400, which describes uncontrolled resource consumption leading to denial of service conditions. It also relates to CWE-756, the lack of efficient algorithmic complexity that allows for performance degradation under specific input conditions. In terms of adversarial tactics, this scenario reflects techniques associated with resource exhaustion attacks within the ATT&CK framework, where an adversary aims to degrade or halt system functionality by exploiting inefficient processing logic rather than bypassing security controls directly.
The issue was addressed in NLTK version 3.10.4 through optimizations that eliminate the redundant reconstruction of context paths for every start tag encountered during parsing. By improving the underlying algorithmic efficiency, the updated implementation ensures that resource consumption remains proportional to the input size rather than scaling quadratically with nesting depth. Organizations relying on older versions of NLTK should prioritize upgrading to version 3.10.4 or later to mitigate this risk. Additionally, implementing strict validation and sanitization measures for any XML inputs processed by NLTK can provide an additional layer of defense against malformed or maliciously crafted documents designed to exploit parsing inefficiencies.