6.9medium
NLTK before 3.10.0 SSRF via DNS Resolution Failure
- Severity
- 6.9medium CVSS:4.0 by VulnCheck
- Exploit likelihood
- 0.28% (higher than 21% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- VulnCheck
- Also known as
- GHSA-3gqm-fcw5-w839PYSEC-2026-3723
Description
NLTK before 3.10.0 (affected versions <= 3.9.4) contains a server-side request forgery (SSRF) vulnerability in the validate_network_url() function in nltk/pathsec.py. The _resolve_hostname() helper catches OSError and ValueError during socket.getaddrinfo() and returns an empty list; when DNS resolution fails, the validation loop executes no IP checks and the function fails open, allowing urlopen() to proceed without validation. An attacker who can trigger DNS resolution failures or use DNS rebinding can bypass SSRF protections and reach restricted network resources, including cloud metadata endpoints (e.g., 169.254.169.254).
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| nltk nltk | before 3.10.0 Not affected: 3.10.0 | CVE List, NVD |
| nltk (PyPI) | before 3.10.0 | GitHub Advisory Database, PyPA Advisory Database |
All scores
| VulnCheck | 6.9medium CVSS:4.0 | 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 |
| VulnCheck | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N |
| GitHub | medium CVSS:4.0 | 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 |
| PyPA Advisory Database | Not scored CVSS:4.0 | 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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.
What each source says
CVE List
NLTK before 3.10.0 (affected versions <= 3.9.4) contains a server-side request forgery (SSRF) vulnerability in the validate_network_url() function in nltk/pathsec.py. The _resolve_hostname() helper catches OSError and ValueError during socket.getaddrinfo() and returns an empty list; when DNS resolution fails, the validation loop executes no IP checks and the function fails open, allowing urlopen() to proceed without validation. An attacker who can trigger DNS resolution failures or use DNS rebinding can bypass SSRF protections and reach restricted network resources, including cloud metadata endpoints (e.g., 169.254.169.254).
GitHub Advisory Database
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.
NVD (es)
NLTK anterior a 3.10.0 (versiones afectadas menor o igual que 3.9.4) contiene una vulnerabilidad de falsificación de petición del lado del servidor (SSRF) en la función validate_network_url() en nltk/pathsec.py. La función auxiliar _resolve_hostname() captura OSError y ValueError durante socket.getaddrinfo() y devuelve una lista vacía; cuando la resolución DNS falla, el bucle de validación no ejecuta comprobaciones de IP y la función falla abierta, permitiendo que urlopen() proceda sin validación. Un atacante que puede desencadenar fallos de resolución DNS o usar el reenlace DNS puede eludir las protecciones SSRF y alcanzar recursos de red restringidos, incluyendo puntos finales de metadatos en la nube (p. ej., 169.254.169.254).
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-63311 changed 2026-08-26 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-3gqm-fcw5-w839 changed 2026-09-02 | CC-BY-4.0 |
| NVD | CVE-2026-63311 changed 2026-10-14 | Public domain |
| PyPA Advisory Database | PYSEC-2026-3723 changed 2026-08-28 | CC-BY-4.0 |