{"id":"CVE-2026-63311","kind":"vulnerability","aliases":["CVE-2026-63311","GHSA-3gqm-fcw5-w839"],"related":[],"title":"NLTK: SSRF Fail-Open in validate_network_url() via DNS Resolution Failure","description":"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.","summary":"NLTK 3.9.4 and earlier skip the private-address check in validate_network_url() when DNS lookup fails, so the request still goes out. An attacker who can make an application fetch a URL can reach internal services such as cloud metadata endpoints.","severity":"medium","cvss":6.9,"epss":0.00334,"exploited":false,"exploited_at":null,"products":[{"name":"nltk","fixed":["3.10.0"],"affected":"<= 3.9.4","ecosystem":"pypi"},{"name":"nltk","fixed":["3.10.0"],"affected":"< 3.10.0","ecosystem":"vendor"}],"ecosystems":["pypi","vendor"],"tags":["cloud","cwe-918","nltk","package","pypi","python"],"not_affected_if":["fixed-urls","local-data-only"],"how_to_check":"- Run `pip show nltk` and check whether the version is `3.9.4` or earlier.\n- Search application code for calls to nltk network download or URL-loading paths that take user-supplied URLs.","fix":"- Upgrade `nltk` to `3.10.0`.\n- Until upgraded, do not pass user-controlled URLs into NLTK network functions.","status":"open","published_at":"2026-08-22T15:16:19+00:00","first_seen_at":"2026-10-27T08:02:10+00:00","triaged_at":"2026-10-27T08:03:27+00:00","updated_at":"2026-10-27T08:31:47+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-10-27T08:03:27Z","model":"claude-haiku-5-5","output":{"fix":"- Upgrade `nltk` to `3.10.0`.\n- Until upgraded, do not pass user-controlled URLs into NLTK network functions.","reach":"internet","title":"NLTK: URL check fails open on DNS errors, enabling server-side request forgery","impact":"medium","summary":"NLTK 3.9.4 and earlier skip the private-address check in validate_network_url() when DNS lookup fails, so the request still goes out. An attacker who can make an application fetch a URL can reach internal services such as cloud metadata endpoints.","category":"package","nicknames":[],"who_cares":["python","pypi","nltk","cloud"],"confidence":0.8,"needs_auth":"no","worst_case":"Internal services and cloud metadata credentials readable via forced requests","analyst_note":"","how_to_check":"- Run `pip show nltk` and check whether the version is `3.9.4` or earlier.\n- Search application code for calls to nltk network download or URL-loading paths that take user-supplied URLs.","needs_analyst":false,"not_affected_if":["local-data-only","fixed-urls"],"who_is_affected":"Applications that pass user-influenced URLs into NLTK's network-URL code path are exposed, since the validation is what blocks internal addresses. Systems that only use NLTK with local data or fixed URLs are unlikely to be affected. Hosts running in cloud environments with metadata endpoints raise the stakes.","user_interaction":"no","needs_special_setup":"yes","severity_if_unknown":"medium"},"cost_usd":0.000673,"input_tokens":4063,"output_tokens":533,"severity_before":"medium"},"analyst_status":null,"analyst_note":null,"search":"'-2024':276C '-2026':15A,23A,284C '-234':111C '-33236':285C '-39705':277C '-63311':16A,24A '-918':29B '/latest/meta-data':227C '1':163C '169.254.169.254':226C,355C '193':110C '2':174C '3':187C '3.9.4':35B,84C '3gqm':19A 'access':360C 'account':371C 'add':297C,309C 'addr':137C 'address':42B,279C,287C 'advisori':349C 'allow':230C,252C,326C 'applic':64B 'attack':59B,177C,358C 'aw':362C 'behavior':237C 'bypass':178C,197C 'cach':184C 'catch':112C 'check':43B,145C,180C,312C 'close':241C 'cloud':27B,74B,233C,352C 'confidenti':346C 'constitut':374C 'correct':236C 'credenti':368C 'cve':14A,22A,275C,283C 'cvss':337C,340C 'cwe':28B 'deseri':281C 'disabl':173C 'disclosur':378C 'distinct':273C 'dns':11A,49B,99C,165C,175C,205C,213C,243C 'doesn':219C 'downstream':380C 'earlier':37B,305C 'effect':211C 'else/fallback':144C 'empti':121C,269C,321C 'endpoint':76B,354C 'entri':185C 'environ':189C 'error':103C 'except':258C 'execut':141C 'expir':186C 'explicit':311C,350C 'expos':367C 'fail':4A,51B,96C,221C,240C,245C 'fail-clos':239C 'fail-open':3A 'failur':13A,206C,262C 'fcw5':20A 'fetch':65B 'find':292C 'fix':303C,308C 'function':93C,147C,254C 'gcp':365C 'ghsa':18A 'ghsa-3gqm-fcw5-w839':17A 'goe':56B 'h':343C,385C 'happen':125C 'helper':107C 'high':344C,376C 'high-impact':375C 'hostnam':106C,266C,315C 'identifi':351C 'imd':363C 'impact':377C 'import':200C,202C 'imposs':336C 'intern':70B 'introduc':301C 'ip':159C,333C 'issu':306C 'iter':133C 'justifi':383C 'l':390C 'layer':300C 'line':109C 'list':122C,270C 'lookup':50B 'loop':128C 'lru':183C 'make':62B,154C 'mean':162C 'metadata':75B,234C,353C,366C 'network':8A,46B,86C,91C,131C,224C 'never':140C,325C 'newli':296C 'newly-ad':295C 'nltk':1A,25A,26A,30B,34B,83C 'nltk.pathsec':201C 'nltk.pathsec.validate':223C 'nltk/pathsec.py':95C 'normal':149C,229C 'note':338C 'noth':135C 'nvd':387C 'open':5A,97C,222C 'oserror':113C,212C 'packag':31B 'path':289C 'pathsec.py':298C 'perman':196C 'pickl':280C 'poc':198C 'privat':41B 'private-address':40B 'proceed':152C,331C 'protect':171C,194C 'pypi':32B 'python':33B,199C 'rais':217C,256C,322C 'reach':69B 'rebind':176C 'reject':250C 'request':54B,156C,329C 'resolut':12A,100C,244C 'resolv':105C,139C,192C,265C,314C 'result':319C 'return':101C,119C,148C,228C,260C,267C,316C 'sc':342C,384C,389C 'secur':299C 'securityerror':324C 'servic':71B,370C 'side':210C 'simul':204C 'skip':38B 'socket.getaddrinfo':117C,209C 'ssrf':2A,80C,170C,231C 'status':263C 'still':55B 'subsequ':345C 'suggest':307C 'system':381C 'target':293C,359C 'temporarili':167C 'token':372C 'travers':290C 'unavail':168C,214C 'unittest.mock':203C 'unittest.mock.patch':208C 'unreli':191C 'url':9A,47B,67B,87C,92C,132C,225C,247C,328C 'urlopen':151C 'use':341C 'valid':7A,45B,88C,90C,127C,130C,160C,334C 'valueerror':115C 'via':10A 'vulner':81C 'w839':21A 'without':157C 'xml':288C","nicknames":[],"mitigations":[],"who_affected":"Applications that pass user-influenced URLs into NLTK's network-URL code path are exposed, since the validation is what blocks internal addresses. Systems that only use NLTK with local data or fixed URLs are unlikely to be affected. Hosts running in cloud environments with metadata endpoints raise the stakes.","tier":"C","verified":{},"analyst_revisit_at":null,"first_public_at":"2026-08-22T15:16:19+00:00","kev":null,"cvss_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","cvss_by":"disclosure@vulncheck.com","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-3gqm-fcw5-w839","url":"https://github.com/advisories/GHSA-3gqm-fcw5-w839","severity":"medium","published_at":"2026-09-02T15:39:39+00:00","modified_at":"2026-10-27T07:58:29+00:00","first_seen_at":"2026-10-27T08:02:10+00:00","fetched_at":"2026-10-27T09:49:50+00:00","note":null},{"source":"nvd","external_id":"CVE-2026-63311","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-63311","severity":null,"published_at":"2026-08-22T15:16:19+00:00","modified_at":"2026-10-14T13:10:00+00:00","first_seen_at":"2026-10-27T08:31:47+00:00","fetched_at":"2026-10-27T08:31:47+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}