Inefficient Algorithmic Complexity Affecting nltk package, versions [,3.10.3)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.22% (13th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-NLTK-19639021
  • published7 Sept 2026
  • disclosed27 Aug 2026
  • creditibfavas

Introduced: 27 Aug 2026

NewCVE-2026-81723  (opens in a new tab)
CWE-407  (opens in a new tab)

How to fix?

Upgrade nltk to version 3.10.3 or higher.

Overview

nltk is a Natural Language Toolkit (NLTK) is a Python package for natural language processing.

Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity through the XMLCorpusView._read_xml_fragment() function in nltk/corpus/reader/xmldocs.py. An attacker can exhaust CPU by supplying a malformed XML corpus file with a single oversized unterminated tag to an affected reader such as BNCCorpusReader.words(). The function reads the file in 1 KiB blocks and repeatedly rescans the entire growing fragment with _VALID_XML_RE.match() and fragment.rfind("<"), so processing time grows quadratically with input size. A user opening attacker-controlled corpus data sees excessive CPU consumption and a denial of service while the reader tries to parse the file.

CVSS Base Scores

version 4.0
version 3.1