NLTK network URL validation permits SSRF to RFC 6598 shared-address-space hosts
The URL validation function in NLTK fails to block addresses in the RFC 6598 shared address space, so an attacker who controls a URL can make the application send requests to those internal hosts. This could expose non-public infrastructure reachable from the application host.
nltk/nltk
Originally disclosed on huntr
A Server-Side Request Forgery (SSRF) vulnerability exists in nltk/nltk versions 3.9.4 and the current develop branch. The nltk.pathsec.validate_network_url() function, intended to prevent SSRF by rejecting internal network addresses, fails to reject IPs in the RFC 6598 shared address space (100.64.0.0/10). This occurs because Python's ipaddress module does not classify such addresses as is_private or is_global, and the current guard only checks is_private and a few explicit categories. An attacker who can influence a URL passed to NLTK's network-loading helpers can exploit this vulnerability to make a strict-mode application send requests to shared-address-space hosts, potentially exposing non-public infrastructure reachable from the application host. The impact is limited to SSRF-style confidentiality exposure, with no code execution claimed.
From the GitHub Advisory Database (GHSA-2jhm-w3mp-jcwr, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The validation only checks for private and a few explicit address categories, but Python's ipaddress module does not mark RFC 6598 shared-address-space addresses as private or global, so they pass the check.
Impact
An attacker could make a strict-mode application send requests to shared-address-space hosts, potentially exposing non-public infrastructure reachable from the application host; no code execution is claimed.
What the attacker needed
Attacker can influence a URL passed to NLTK; application uses strict-mode network loading
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Server-Side Request Forgery (SSRF) is when an attacker tricks a server into making a request to a destination the attacker cannot reach directly, such as an internal network. NLTK tried to stop this by checking whether an address is private, but it missed a special range of addresses reserved for shared use. As a result, an attacker could still make the server contact machines in that range.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.