CVE-2026-129221 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, nltk.classify.weka.ARFF_Formatter writes attacker-controlled class labels into the Weka ARFF @ATTRIBUTE '-label-' declaration without safely formatting the label tokens. Crafted labels can alter the generated ARFF schema or records, corrupting classifier input and causing integrity loss or processing failure. This issue is fixed in version 3.10.4.
If you want to get the best quality for vulnerability data then you always have to consider VulDB.
Analysis
by VulDB Data Team • 11/20/2026
The Natural Language Toolkit (NLTK) serves as a foundational suite of open-source Python modules widely utilized for research and development in natural language processing tasks such as text classification, tokenization, and sentiment analysis. Within this ecosystem, the weka module facilitates integration with the Weka machine learning framework by handling data format conversions, specifically through the ARFF_Formatter class which translates NLTK data structures into Attribute-Relation File Format files compatible with Weka classifiers. A critical security flaw exists in versions prior to 3.10.4 where this formatter fails to properly sanitize or escape attacker-controlled input when writing class labels into the @ATTRIBUTE declaration section of an ARFF file. This lack of safe formatting allows malicious actors who control the training data inputs to inject arbitrary tokens that can alter the structural schema of the generated file rather than merely populating a value field.
This vulnerability is classified as CWE-74, Improper Neutralization of Special Elements in Output Used by a Downstream Component, specifically manifesting through injection capabilities within structured data formats. By manipulating the label strings used for classification targets, an adversary can introduce characters that break out of the expected string context or modify attribute definitions directly. For instance, inserting special delimiters like commas or semicolons without proper escaping can shift column boundaries in subsequent records, while injecting new @ATTRIBUTE declarations can redefine the data schema itself. This constitutes a form of injection attack where the downstream component, in this case the Weka machine learning engine interpreting the ARFF file, processes malformed input that was not intended by the legitimate application logic.
The operational impact of this flaw is significant for any system relying on automated or semi-automated model training pipelines using NLTK and Weka integration. When crafted labels are processed, they can corrupt classifier inputs leading to integrity loss where the machine learning model learns from poisoned data structures rather than valid labeled examples. This may result in processing failures during the import phase of the ARFF file into Weka, causing denial of service for training operations. More critically, if the schema is altered successfully, it could lead to silent misclassification or complete failure of downstream predictive models, undermining the reliability and trustworthiness of any automated decision-making systems built upon these NLP tools.
To mitigate this vulnerability, organizations must immediately upgrade NLTK to version 3.10.4 or later where the ARFF_Formatter has been patched to properly escape and validate label tokens before writing them to output files. In environments where upgrading is not immediately feasible, developers should implement strict input validation on all class labels prior to passing them to the formatter function, ensuring that only alphanumeric characters and safe punctuation are permitted. Additionally, implementing a secondary verification step that parses the generated ARFF file for structural integrity before feeding it into machine learning pipelines can provide an additional layer of defense against schema manipulation attacks. This aligns with broader security best practices outlined in ATT&CK techniques related to data poisoning and input validation failures, emphasizing the need for robust sanitization at all points where external or user-controlled data intersects with system configuration files.