All vulnerabilities
CVE-2026-63311GHSA-3gqm-fcw5-w839PYSEC-2026-3723

NLTK: SSRF Fail-Open in validate_network_url() via DNS Resolution Failure

nltk nltkpipLibraries & packages
CVSS
6.9Medium
ExploitationNo known exploitationNot in CISA KEV, which does not prove it is unexploitedCISA KEV
Exploit odds (EPSS)0.33%Chance of exploitation activity in the next 30 days, higher than 26% of CVEs. Scored 26 Oct 2026FIRST EPSS
Fixed in3.10.0Fixed versionGitHub
Published22 Aug 2026Updated 27 Oct 2026CVE List

What fixes it

A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.

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.

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:

  1. If DNS is temporarily unavailable, ALL SSRF protections are disabled
  2. DNS rebinding attacks bypass the check after the LRU cache entry expires
  3. 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.

Text from GitHub Advisory Database

Affected versions 54

  • nltk, pip<= 3.9.4GitHub
  • nltkaffected: all versions before 3.10.0CVE List
  • nltkunaffected: 3.10.0CVE List
  • nltk, PyPIfrom first release, fixed in 3.10.0OSV
  • nltk, PyPI0.8OSV
  • nltk, PyPI0.9OSV
  • nltk, PyPI0.9.3OSV
  • nltk, PyPI0.9.4OSV
  • nltk, PyPI0.9.5OSV
  • nltk, PyPI0.9.6OSV
  • nltk, PyPI0.9.7OSV
  • nltk, PyPI0.9.8OSV
  • nltk, PyPI0.9.9OSV
  • nltk, PyPI2.0.1OSV
  • nltk, PyPI2.0.1rc1OSV
  • nltk, PyPI2.0.1rc2-gitOSV
  • nltk, PyPI2.0.1rc3OSV
  • nltk, PyPI2.0.1rc4OSV
  • nltk, PyPI2.0.2OSV
  • nltk, PyPI2.0.3OSV
  • nltk, PyPI2.0.4OSV
  • nltk, PyPI2.0.5OSV
  • nltk, PyPI2.0b4OSV
  • nltk, PyPI2.0b5OSV
  • nltk, PyPI2.0b6OSV
  • nltk, PyPI2.0b7OSV
  • nltk, PyPI2.0b8OSV
  • nltk, PyPI2.0b9OSV
  • nltk, PyPI3.0.0OSV
  • nltk, PyPI3.0.0b1OSV
  • nltk, PyPI3.0.0b2OSV
  • nltk, PyPI3.0.1OSV
  • nltk, PyPI3.0.2OSV
  • nltk, PyPI3.0.3OSV
  • nltk, PyPI3.0.4OSV
  • nltk, PyPI3.0.5OSV
  • nltk, PyPI3.1OSV
  • nltk, PyPI3.2OSV
  • nltk, PyPI3.2.1OSV
  • nltk, PyPI3.2.2OSV
  • nltk, PyPI3.2.3OSV
  • nltk, PyPI3.2.4OSV
  • nltk, PyPI3.2.5OSV
  • nltk, PyPI3.3OSV
  • nltk, PyPI3.4OSV
  • nltk, PyPI3.4.1OSV
  • nltk, PyPI3.4.2OSV
  • nltk, PyPI3.4.3OSV
  • nltk, PyPI3.4.4OSV
  • nltk, PyPI3.4.5OSV
  • nltk, PyPI3.5OSV
  • nltk, PyPI3.5b1OSV
  • nltk, PyPI3.6OSV
  • nltk, PyPI3.6.1OSV

References 8