Impact
The vulnerability exists in the Natural Language Toolkit (NLTK) library, where the collocations.py script passes command‐line arguments directly to Python's eval() function without input validation. An attacker who can influence the arguments supplied to the script can inject arbitrary Python code, which then executes as part of the BigramAssocMeasures namespace. This escalation allows the attacker to run OS commands and gain full control of the system that executes the script. The weakness is a classic code injection flaw (CWE‑95).
Affected Systems
Any installation of NLTK version 3.9.2 or earlier is susceptible. The vulnerability is present in all environments where the collocations.py tool is executed directly with user‑supplied command‑line arguments. Upgrading to NLTK 3.9.3 or later removes the vulnerable code. No other products or vendors were specified beyond the NLTK package itself.
Risk and Exploitability
The CVSS score of 8.5 indicates high severity, while the EPSS score of less than 1% suggests a low probability of exploitation today, yet the flaw remains actionable. The vulnerability is not listed in the CISA KEV catalog. Exploitation requires an attacker who controls the command‑line arguments of a locally executed collocations.py invocation, which could be achieved by any user who is able to run the script. The attacker can execute arbitrary Python code and system commands via the os module. The extent to which this leads to system‑wide control is not explicitly mentioned in the CVE description and is inferred from the ability to run OS commands; the risk level is thus high.
OpenCVE Enrichment
Github GHSA