CVE-2026-63311: NLTK: SSRF Fail-Open in validate_network_url() via DNS Resolution Failure
(updated )
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
References
- github.com/advisories/GHSA-3gqm-fcw5-w839
- github.com/nltk/nltk/commit/4a820afa58810cd05049b6c6eae306694d6cfe65
- github.com/nltk/nltk/pull/3582
- github.com/nltk/nltk/releases/tag/v3.10.0
- github.com/nltk/nltk/security/advisories/GHSA-3gqm-fcw5-w839
- github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3723.yaml
- nvd.nist.gov/vuln/detail/CVE-2026-63311
- www.vulncheck.com/advisories/nltk-before-ssrf-via-dns-resolution-failure
Code Behaviors & Features
Detect and mitigate CVE-2026-63311 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →