{"id":"CVE-2026-63311","aliases":["CVE-2026-63311","GHSA-3gqm-fcw5-w839","PYSEC-2026-3723"],"related":[],"kind":"vulnerability","state":"published","title":"NLTK before 3.10.0 SSRF via DNS Resolution Failure","summary":"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).","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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).","source":"cvelist"},{"lang":"en","text":"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.\n\nThe _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.\n\nThis means:\n1. If DNS is temporarily unavailable, ALL SSRF protections are disabled\n2. DNS rebinding attacks bypass the check after the LRU cache entry expires\n3. In environments with unreliable resolvers, the protection is permanently bypassed\n\nPoC:\n```python\nimport nltk.pathsec\nimport unittest.mock\n\n# Simulate DNS failure\nwith unittest.mock.patch('socket.getaddrinfo', side_effect=OSError('DNS unavailable')):\n    # This SHOULD raise but doesn't -- fails open\n    nltk.pathsec.validate_network_url('http://169.254.169.254/latest/meta-data/')\n    # Returns normally, allowing SSRF to cloud metadata\n```\n\nThe 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.\n\nThis 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.\n\nSuggested 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.\n\nCVSS 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"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).","source":"nvd"}],"published":"2026-08-22T14:12:40.063Z","modified":"2026-10-14T13:10:00.187Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"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","score":6.9,"rating":"MEDIUM"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"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","score":6.9,"rating":"MEDIUM"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:4.0","vector":"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"}],"cwes":["CWE-918"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"3.10.0","status":"affected"},{"type":"semver","version":"3.10.0","status":"unaffected"}],"vendor":"nltk","product":"nltk","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.10.0"}],"ecosystem":"PyPI","package":"nltk","purl":"pkg:pypi/nltk","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.10.0"}],"vendor":"nltk","product":"nltk","cpe":"cpe:2.3:a:nltk:nltk:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.10.0"}],"ecosystem":"PyPI","package":"nltk","purl":"pkg:pypi/nltk","source":"pysec"}],"references":[{"url":"https://github.com/nltk/nltk/security/advisories/GHSA-3gqm-fcw5-w839","tags":["evidence","exploit","mitigation","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://www.vulncheck.com/advisories/nltk-before-ssrf-via-dns-resolution-failure","tags":["advisory","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-63311","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/nltk/nltk/pull/3582","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/nltk/nltk/commit/4a820afa58810cd05049b6c6eae306694d6cfe65","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/nltk/nltk","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/nltk/nltk/releases/tag/v3.10.0","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3723.yaml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-08-26T15:58:19.898Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-63311","url":"https://www.cve.org/CVERecord?id=CVE-2026-63311","licence":"CVE Terms of Use","modified":"2026-08-26T16:16:26.704Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-3gqm-fcw5-w839","url":"https://github.com/advisories/GHSA-3gqm-fcw5-w839","licence":"CC-BY-4.0","modified":"2026-09-02T16:00:17.562Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-63311","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-63311","licence":"Public domain","modified":"2026-10-14T13:10:00.187Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3723","url":"https://osv.dev/vulnerability/PYSEC-2026-3723","licence":"CC-BY-4.0","modified":"2026-08-28T02:30:02.703Z"}],"updatedAt":"2026-11-25T22:59:34.875Z","epss":{"score":0.0028,"percentile":0.21935,"date":"2026-12-01T12:00:22.000Z"}}