Gptline: NLTK: Quadratic CPU Exhaustion in `XMLCorpusView._read_xml_fragment()` (CVE-2026-81723)
NLTK's XMLCorpusView._read_xml_fragment() function exhibits quadratic CPU exhaustion when processing malformed XML corpus files. The function reads input in 1 KiB blocks, appending to a growing buffer and rescanning the entire accumulated fragment with a regex match on each iteration. This causes CPU usage to grow quadratically with input size, leading to potential denial of service. The issue affects several corpus readers relying on XMLCorpusView, including BNCCorpusReader. No patch is available in published releases, but a fix is suggested to avoid rescanning the entire buffer each iteration.
AI Analysis
Technical Summary
The vulnerability in NLTK's XMLCorpusView._read_xml_fragment() arises because the function reads a corpus file in 1 KiB blocks, appending each block to a growing string fragment. On each iteration, it calls a regex match on the entire accumulated fragment, causing the total work to grow quadratically with input size. For malformed XML inputs that never match the regex, the loop continues until EOF, resulting in excessive CPU consumption. This affects readers such as BNCCorpusReader and others relying on XMLCorpusView, but not XMLCorpusReader.xml(). The issue was verified in NLTK versions 3.9.4, 3.10.0, and the current development branch. No patch exists in published releases, but a fix is proposed to use incremental parsing or bounded fragment accumulation to eliminate the quadratic behavior.
Potential Impact
Applications processing attacker-controlled XML corpus files with affected NLTK readers can experience CPU exhaustion leading to denial of service. The attacker only needs write access to a file path the reader will open; no special privileges or credentials are required. Offline tools processing trusted local corpora are not at risk. The impact is limited to availability (denial of service) with no confidentiality or integrity impact.
Mitigation Recommendations
A patch is available for this vulnerability. Users should apply the official fix once released. Until then, avoid processing untrusted XML corpus files with affected readers. The suggested fix involves avoiding rescanning the entire accumulated fragment on each iteration by using incremental parsing or bounded fragment accumulation. No generic mitigations are recommended beyond applying the patch when available.
Gptline: NLTK: Quadratic CPU Exhaustion in `XMLCorpusView._read_xml_fragment()` (CVE-2026-81723)
Description
NLTK's XMLCorpusView._read_xml_fragment() function exhibits quadratic CPU exhaustion when processing malformed XML corpus files. The function reads input in 1 KiB blocks, appending to a growing buffer and rescanning the entire accumulated fragment with a regex match on each iteration. This causes CPU usage to grow quadratically with input size, leading to potential denial of service. The issue affects several corpus readers relying on XMLCorpusView, including BNCCorpusReader. No patch is available in published releases, but a fix is suggested to avoid rescanning the entire buffer each iteration.
CVSS v3.1
Score 3.7low
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in NLTK's XMLCorpusView._read_xml_fragment() arises because the function reads a corpus file in 1 KiB blocks, appending each block to a growing string fragment. On each iteration, it calls a regex match on the entire accumulated fragment, causing the total work to grow quadratically with input size. For malformed XML inputs that never match the regex, the loop continues until EOF, resulting in excessive CPU consumption. This affects readers such as BNCCorpusReader and others relying on XMLCorpusView, but not XMLCorpusReader.xml(). The issue was verified in NLTK versions 3.9.4, 3.10.0, and the current development branch. No patch exists in published releases, but a fix is proposed to use incremental parsing or bounded fragment accumulation to eliminate the quadratic behavior.
Potential Impact
Applications processing attacker-controlled XML corpus files with affected NLTK readers can experience CPU exhaustion leading to denial of service. The attacker only needs write access to a file path the reader will open; no special privileges or credentials are required. Offline tools processing trusted local corpora are not at risk. The impact is limited to availability (denial of service) with no confidentiality or integrity impact.
Mitigation Recommendations
A patch is available for this vulnerability. Users should apply the official fix once released. Until then, avoid processing untrusted XML corpus files with affected readers. The suggested fix involves avoiding rescanning the entire accumulated fragment on each iteration by using incremental parsing or bounded fragment accumulation. No generic mitigations are recommended beyond applying the patch when available.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- BREW-gptline-CVE-2026-81723
- Osv Schema Version
- 1.7.3
- Ecosystems
- ["Homebrew"]
- Cvss Version
- 3.1
Threat ID: 6aac8e5a55bf5e2cf5491af3
Added to database: 09/18/2026, 01:05:30 UTC
Last enriched: 09/18/2026, 01:51:05 UTC
Last updated: 09/18/2026, 02:07:15 UTC
Views: 3
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.