CVE-2026-129231 in NLTKinfo

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, SeekableUnicodeStreamReader.readline appends each new block to a growing character buffer and reruns splitlines over the entire buffer on every iteration. An attacker-controlled corpus file containing one very long unterminated line therefore causes quadratic CPU consumption in line-oriented corpus readers and can deny 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, commonly known as NLTK, serves as a foundational suite of open-source Python modules designed to support research and development in the field of Natural Language Processing. It provides extensive data sets, tutorials, and algorithms that facilitate tasks such as tokenization, stemming, tagging, parsing, and semantic reasoning. As a widely adopted library among developers and researchers working with textual data, its performance characteristics are critical for applications processing large volumes of text. The vulnerability identified in versions prior to 3.10.4 resides within the SeekableUnicodeStreamReader class, which is responsible for reading Unicode-encoded files efficiently by managing character buffers and stream positioning.

The core technical flaw lies in the implementation of the readline method within this reader component. When processing a file line-by-line, the function appends each newly read block of characters to an accumulating buffer that retains all previously processed content from the current logical line. Crucially, on every iteration where a new block is added, the system reruns the splitlines operation over the entirety of this growing character buffer rather than just processing the new incremental data or maintaining state for partial lines. This design choice creates a computational inefficiency that scales poorly with input size. In scenarios involving standard text files with short lines, the overhead is negligible because the buffers remain small and operations complete quickly. However, in cases where an attacker controls the corpus file being processed, they can construct a single line of extreme length without any terminating newline characters to signal the end of the line.

When such an unterminated line is encountered, the readline method continues to append incoming data blocks to the ever-expanding buffer and repeatedly executes splitlines on this massive aggregate string. This results in quadratic time complexity relative to the size of the input file for that specific operation. As the buffer grows larger with each read cycle, the computational cost increases exponentially rather than linearly. For large corpus files containing one very long unterminated line, this behavior leads to severe CPU consumption. The system becomes bogged down by redundant string processing operations, effectively locking up processor resources and preventing other tasks from executing efficiently.

The operational impact of this vulnerability is primarily a denial of service condition. An attacker who can influence the input data fed into NLTK-based applications can trigger this quadratic behavior intentionally or accidentally through malformed datasets. In production environments where automated text analysis pipelines process untrusted or user-uploaded documents, this flaw can cause application timeouts, resource exhaustion, and system instability. The impact is particularly acute in cloud-native or containerized deployments where CPU limits are enforced, as the excessive consumption may lead to automatic termination of the service by orchestration platforms like Kubernetes. This represents a significant availability risk for services relying on NLTK for text preprocessing at scale.

This vulnerability aligns with CWE-400, which describes Uncontrolled Resource Consumption, specifically manifesting through inefficient algorithmic complexity that leads to excessive resource usage under specific input conditions. From an offensive security perspective, this behavior can be categorized within the MITRE ATT&CK framework as part of techniques related to Impact or Defense Evasion, where adversaries might use resource exhaustion to disrupt service availability. The root cause is a failure in input validation and algorithmic optimization, specifically neglecting to handle edge cases involving extremely long lines without delimiters efficiently.

To mitigate this vulnerability, organizations must ensure that all instances of NLTK are updated to version 3.10.4 or later, where the readline implementation has been optimized to avoid reprocessing the entire buffer on each iteration. For environments unable to upgrade immediately due to dependency constraints, defensive coding practices should be implemented at the application layer. This includes validating input file structures before processing, enforcing maximum line length limits during parsing operations, and implementing timeouts for long-running text processing tasks. Additionally, monitoring CPU usage patterns in applications utilizing NLTK can help detect anomalous behavior indicative of this exploitation attempt, allowing for rapid isolation or restart of affected services to restore availability.

Responsible

GitHub M

Reservation

11/13/2026

Disclosure

11/20/2026

Moderation

accepted

CPE

ready

EPSS

0.00479

KEV

no

Activities

very low

Sources

Do you need the next level of professionalism?

Upgrade your account now!