Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. nltk
  4. ›
  5. CVE-2026-81723

CVE-2026-81723: NLTK: Quadratic CPU Exhaustion in `XMLCorpusView._read_xml_fragment()`

September 2, 2026

XMLCorpusView._read_xml_fragment() reads a corpus file in 1 KiB blocks, appending each block to a growing fragment string, then calls _VALID_XML_RE.match(fragment) on the full accumulated buffer every iteration. Because each iteration rescans the entire accumulated fragment, the total amount of work grows quadratically with input size.

Commit c9c332284 (CWE-1333) made each match() call linear. The quadratic behavior is separate: the loop calls match() once per 1 KiB block, each time on a longer buffer.

On the test system, an 8 MiB malformed XML file consumed approximately 48 CPU-seconds through the public BNCCorpusReader.words() API with no source modification. Absolute timings vary by hardware. _read_xml_fragment() imposes no limit on fragment size or iteration count.

References

  • github.com/advisories/GHSA-vp2x-qp44-57v7
  • github.com/nltk/nltk/commit/7808692d451b962711005d954859bb83aabcf8fa
  • github.com/nltk/nltk/releases/tag/v3.10.3
  • github.com/nltk/nltk/security/advisories/GHSA-vp2x-qp44-57v7
  • nvd.nist.gov/vuln/detail/CVE-2026-81723
  • www.vulncheck.com/advisories/nltk-before-3.10.3-quadratic-cpu-exhaustion-via-xmlcorpusview

Code Behaviors & Features

Detect and mitigate CVE-2026-81723 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 3.10.3

Fixed versions

  • 3.10.3

Solution

Upgrade to version 3.10.3 or above.

Impact 3.7 LOW

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L

Learn more about CVSS

Weakness

  • CWE-400: Uncontrolled Resource Consumption
  • CWE-407: Inefficient Algorithmic Complexity

Source file

pypi/nltk/CVE-2026-81723.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:16:09 +0000.