Vulnerability · Published Dec 23, 2021 · Assigned by GitHub_M

CVE-2021-43854Inefficient Regular Expression Complexity in nltk

High 7.5

In plain English

A high-severity uncontrolled resource consumption in nltk from nltk. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 2.8% (higher than 86% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.5High
Exploit odds (30 days)2.8%top 13.5% of all CVEs
Exploited in the wildNo reportsnot in CISA KEV
Attack toolingNoneno public tooling known

Official description

NLTK (Natural Language Toolkit) is a suite of open source Python modules, data sets, and tutorials supporting research and development in Natural Language Processing. Versions prior to 3.6.5 are vulnerable to regular expression denial of service (ReDoS) attacks. The vulnerability is present in PunktSentenceTokenizer, sent_tokenize and word_tokenize. Any users of this class, or these two functions, are vulnerable to the ReDoS attack. In short, a specifically crafted long input to any of these vulnerable functions will cause them to take a significant amount of execution time. If your program relies on any of the vulnerable functions for tokenizing unpredictable user input, then we would strongly recommend upgrading to a version of NLTK without the vulnerability. For users unable to upgrade the execution time can be bounded by limiting the maximum length of an input to any of the vulnerable functions. Our recommendation is to implement such a limit.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12nltk3.6.7-1DEBIAN-CVE-2021-43854
Debian:13nltk3.6.7-1DEBIAN-CVE-2021-43854
Debian:14nltk3.6.7-1DEBIAN-CVE-2021-43854
PyPInltk3.6.6GHSA-f8m6-h2c7-8h9x
PyPInltk3.6.5PYSEC-2021-859

Affected products (as reported)

VendorProductVersions
nltk nltk < 3.6.5

Weakness: CWE-400 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

References