CVE-2026-63311 — NLTK: SSRF Fail-Open in nltk — CVE Details
NLTK: SSRF Fail-Open in validate_network_url() via DNS Resolution Failure
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.33%). Schedule for your next planned update.
Does your project use an affected nltk version?
Paste your requirements.txt to check it for CVE-2026-63311 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
There is an SSRF vulnerability in NLTK 3.9.4's network URL validation. The validate_network_url() function in nltk/pathsec.py fails open when DNS resolution returns an error.
The _resolve_hostname() helper at lines 193-234 catches OSError and ValueError during socket.getaddrinfo() and returns an empty list []. When this happens, the validation loop in validate_network_url() iterates over nothing (for addr in resolved: ... never executes), with no else/fallback check. The function returns normally, and urlopen() proceeds to make the request without any IP validation.
This means:
- If DNS is temporarily unavailable, ALL SSRF protections are disabled
- DNS rebinding attacks bypass the check after the LRU cache entry expires
- In environments with unreliable resolvers, the protection is permanently bypassed
PoC:
import nltk.pathsec
import unittest.mock
# Simulate DNS failure
with unittest.mock.patch('socket.getaddrinfo', side_effect=OSError('DNS unavailable')):
# This SHOULD raise but doesn't -- fails open
nltk.pathsec.validate_network_url('http://169.254.169.254/latest/meta-data/')
# Returns normally, allowing SSRF to cloud metadata
The correct behavior is fail-closed: if DNS resolution fails, the URL should be REJECTED (not allowed). The function should raise an exception or return a failure status when _resolve_hostname() returns an empty list.
This is distinct from CVE-2024-39705 (which addressed pickle deserialization) and CVE-2026-33236 (which addressed XML path traversal). This finding targets the newly-added pathsec.py security layer introduced to fix those earlier issues.
Suggested fix: Add an explicit check after _resolve_hostname() returns: if the result is empty, raise a SecurityError. Never allow a URL request to proceed when IP validation was impossible.
CVSS Note: The CVSS use SC:H (High subsequent confidentiality) because the advisory explicitly identifies cloud metadata endpoints (169.254.169.254) as an attack target. Access to AWS IMDS or GCP metadata exposes credentials or service account tokens, which constitutes High-impact disclosure on downstream systems. This justifies SC:H over NVD's SC:L.
Advisory Timeline
- First published September 2, 2026 (85 days ago).
- Last revised September 2, 2026 — 0 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
pip install "nltk>=3.10.0"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: PyPI (1).
| Package | Fixed In |
|---|---|
| nltk PyPI · Affected: 0.8, 0.9, 0.9.3, 0.9.4 (+61 more) | 3.10.0 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-918Server-Side Request Forgery (SSRF)MITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 8.3 score means for each attack dimension.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:L/SI:L/SA:L
References
- https://github.com/nltk/nltk/security/advisories/GHSA-3gqm-fcw5-w839WEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-63311ADVISORY
- https://github.com/nltk/nltk/pull/3582WEB
- https://github.com/nltk/nltk/commit/4a820afa58810cd05049b6c6eae306694d6cfe65WEB
- https://github.com/nltk/nltkPACKAGE
- https://github.com/nltk/nltk/releases/tag/v3.10.0WEB
- https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3723.yamlWEB
- https://www.vulncheck.com/advisories/nltk-before-ssrf-via-dns-resolution-failureWEB
Frequently Asked Questions
- What is CVE-2026-63311?
- NLTK: SSRF Fail-Open in validate_network_url() via DNS Resolution Failure. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 8.3/10).
- How do I check if my project is affected by CVE-2026-63311?
- CVE-2026-63311 affects nltk. It has a 0.3% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-63311 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is a below-median EPSS score — only 19.3% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2026-81722HIGH
- CVE-2026-129234HIGH
NLTK: Untrusted search path in prover9/mace4 config allows local code execution via relative binary_location
- CVE-2024-39705HIGH
ntlk unsafe deserialization vulnerability
- CVE-2026-81724MEDIUM
- CVE-2026-81726MEDIUM
- CVE-2026-129232MEDIUM
NLTK: Quadratic CPU exhaustion in NLTK XMLCorpusView.read_block via deeply nested XML corpus tags
- CVE-2026-81723MEDIUM
NLTK: Quadratic CPU Exhaustion in `XMLCorpusView._read_xml_fragment()`
- CVE-2026-129226MEDIUM
NLTK: Uncontrolled recursion in semantic-logic type parser causes denial of service via nested type strings