NLTK: ARFF_Formatter Injects Weka ARFF Schema Directives via Attacker-Controlled Class Labels
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| nltknltk | — | Not listed |
| PyPInltk |
< 3.10.4→ 3.10.4 |
3.10.4 |
| pipnltk |
< 3.10.4→ 3.10.4 |
3.10.4 |
Fix status by distribution
Records published by each distribution for this CVE. Fixed versions differ by release; check each link.
- Debian DEBIAN-CVE-2026-129221 nltk No fixed version in this record
- Ubuntu UBUNTU-CVE-2026-129221 nltk No fixed version in this record
Original description The description as published by the source.
Description
Summary
nltk.classify.weka.ARFF_Formatter writes class labels directly into the Weka ARFF @ATTRIBUTE '-label-' {...} declaration without any ARFF quoting or escaping. An attacker who can contribute class labels to a training dataset can include ARFF metacharacters such as }, newlines, @ATTRIBUTE, and @DATA to break out of the nominal label list and inject attacker‑controlled ARFF schema and data directives.
This vulnerability is reachable in any application that calls WekaClassifier.train() or ARFF_Formatter.from_train() with attacker‑influenced training data. The victim does not need to manually edit the ARFF file; the normal training workflow writes the malformed ARFF automatically.
Technical Details
The vulnerable code path is:
WekaClassifier.train()callsARFF_Formatter.from_train(featuresets).from_train()extracts labels from the training data and passes them toARFF_Formatter(labels, features).header_section()uses",".join(self._labels)directly, embedding attacker‑controlled strings into the ARFF header without sanitization.
Because the label names are not escaped, a label containing safe}\n@ATTRIBUTE injected NUMERIC\n@DATA\n0,owned\n% will close the label set, inject a new attribute, start a premature data section, and comment out the remaining header.
Proof of Concept
The following self‑contained Python script demonstrates the vulnerability. It requires only NLTK and does not need Weka t…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- package github.com
- REDHAT Red Hat
- web github.com
- web github.com
- web github.com
- web github.com
- web nvd.nist.gov
- web github.com