CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-63311

CVE-2026-63311: Server-Side Request Forgery and DNS Rebinding in Natural Language Toolkit (NLTK)

Amit Schendel
Amit Schendel
Senior Security Researcher

Sep 2, 2026·6 min read·2 visits

Executive Summary (TL;DR)

NLTK versions prior to 3.10.0 are vulnerable to Server-Side Request Forgery (SSRF) and DNS rebinding. Due to fail-open exception handling in DNS resolution and a lack of IP pinning, security checks on remote URLs can be completely bypassed by attackers controlling the target server or domain.

A vulnerability in the Natural Language Toolkit (NLTK) before version 3.10.0 allowed attackers to bypass SSRF filters via DNS resolution failures and DNS rebinding. By exploiting these weaknesses, unauthenticated remote attackers could coerce hosting systems into scanning internal networks or accessing sensitive cloud metadata endpoints.

Vulnerability Overview

The Natural Language Toolkit (NLTK) is a widely used Python library for processing human language data. In versions prior to 3.10.0, NLTK implemented a security sentinel in nltk/pathsec.py designed to filter outbound network connections. This filter aimed to prevent Server-Side Request Forgery (SSRF) and local directory traversal attacks during resource fetching.

The target attack surface consists of functions that dynamically fetch remote data, such as nltk.download() or nltk.data.load(). When these functions receive user-supplied URLs, they rely on the validation module to block malicious requests. The original implementation attempted to verify hostnames prior to establishing HTTP connections, but contained fatal logic design flaws.

Two critical weaknesses undermine the filter's security guarantees. First, the DNS validation loop fails open if the DNS query encounters an exception. Second, the absence of socket-level IP pinning allows Time-of-Check to Time-of-Use (TOCTOU) DNS rebinding attacks. These weaknesses allow an unauthenticated attacker to route HTTP requests to internal subnets, local loopback interfaces, or cloud provider metadata endpoints.

Root Cause Analysis

The root cause of the vulnerability lies in the implementation of the validate_network_url() function in nltk/pathsec.py. The function attempts to resolve target hostnames and verify that the corresponding IP addresses do not belong to private, loopback, or multicast ranges.

The first critical vulnerability involves fail-open error handling in the DNS resolver. The helper function _resolve_hostname() wraps socket.getaddrinfo() inside a try-except block. If the DNS query fails due to a network timeout, an invalid hostname format, or a deliberate DNS resolution error, the function catches the exception and returns an empty list.

@lru_cache(maxsize=256)
def _resolve_hostname(hostname):
    try:
        return socket.getaddrinfo(hostname, None, proto=socket.IPPROTO_TCP)
    except (OSError, ValueError):
        return []

Because the resolver returns an empty list, the verification loop in the calling function executes zero iterations. No IP addresses are evaluated against the forbidden lists, and the validation completes successfully without raising any security exceptions. The application then proceeds to establish a network connection using urllib.request.urlopen().

The second critical flaw is a Time-of-Check to Time-of-Use (TOCTOU) race condition. Even when DNS resolution succeeds, the validated IP address is never pinned to the actual HTTP request. The library validates the IP during the check stage, but the underlying HTTP client performs a separate DNS resolution when establishing the TCP socket. This architecture permits DNS rebinding, where an attacker-controlled DNS server yields a safe IP during validation and a local IP during execution.

Code and Patch Analysis

The security patch introduced in NLTK version 3.10.0 completely replaces the vulnerable pre-check validation logic with active socket-level IP pinning. The patch intercepts connection attempts to force the application to connect exclusively to the specific, validated IP addresses.

# Patched implementation of host resolution and validation
def _resolve_and_validate_host(host, port):
    try:
        addrinfo = socket.getaddrinfo(host, port, proto=socket.IPPROTO_TCP)
    except (OSError, ValueError):
        # FAIL CLOSED: Resolution failures now abort the request
        return []
    
    validated = []
    for res in addrinfo:
        ip_str = res[4][0]
        ip = ipaddress.ip_address(ip_str)
        if _ip_is_forbidden(ip):
            # Explicitly block access to local, private, or non-global routes
            raise PermissionError(f"SSRF attempt to blocked IP {ip_str}")
        validated.append(res)
    return validated

The patched library subclasses http.client.HTTPConnection and http.client.HTTPSConnection to implement safe connections. When making a connection, the custom handler resolves the hostname, validates every returned IP address, and establishes the TCP socket directly using the numeric IP. This avoids the second DNS lookup, neutralizing the TOCTOU rebinding vector.

This fix is highly complete and robust. It addresses the architectural flaws of the previous implementation by eliminating the split-resolution pattern and ensuring that DNS resolution failures result in a hard failure rather than a silent bypass.

Exploitation Methodology

Exploitation of CVE-2026-63311 requires the attacker to influence the URL parameter passed to NLTK's data-fetching functions. The attack vector depends on whether the target application accepts user-specified download mirrors or directly parses documents containing resource links.

In a DNS rebinding attack, the adversary registers a custom domain (such as rebind.attacker.com) and configures an authoritative DNS server under their control. The DNS server is programmed to alternate its responses or set the Time-To-Live (TTL) value of the record to 0. This ensures that the server does not allow downstream caching of the resolved IP.

When NLTK processes the input URL, the validation engine queries the DNS server. The DNS server returns a public IP address. The validation check evaluates this public IP, determines it is safe, and permits execution. Immediately afterward, the HTTP connection client requests resolution again. The DNS server now returns 127.0.0.1 or 169.254.169.254, forcing the application server to connect to its own local services or its cloud provider's metadata endpoint.

Impact Assessment

The impact of successful exploitation depends heavily on the execution environment. In cloud-deployed applications, such as Python services running on AWS, GCP, or Azure, the vulnerability provides a direct pathway to compromise the host. Attackers can query the cloud provider metadata service to retrieve sensitive IAM credentials, internal service configurations, and authentication tokens.

When deployed within internal networks, the vulnerability transforms the host application into an open proxy. Attackers can conduct internal port scanning and send unauthorized HTTP GET requests to local databases, cache systems, or internal APIs that trust requests originating from localhost. The vulnerability does not directly support arbitrary file writing or command execution, but can be chained with other local vulnerabilities to achieve Remote Code Execution (RCE).

The CVSS v4.0 base score is rated at 6.9, reflecting network-based, low-complexity attacks that require no prior privileges or user interaction. The impact is primarily categorized as low integrity and low confidentiality, because the standard urllib implementation limits the attacker to read-only HTTP GET requests without the ability to modify server state directly via other methods.

Remediation and Defenses

The primary remediation strategy is upgrading the NLTK installation to version 3.10.0 or higher. This upgrade can be performed via the standard package management utilities. The updated library contains the socket-level pinning modifications that neutralize both the fail-open and DNS-rebinding behaviors.

pip install --upgrade nltk>=3.10.0

If patching the software dependency is not immediately feasible, organizations should implement host-level or network-level firewall rules. Administrators can block outbound HTTP/HTTPS requests from the application server to private subnets (RFC 1918) and the cloud metadata range (169.254.169.254/32). These egress blocks prevent successful exploitation even if the library continues to permit the requests.

Furthermore, local DNS resolvers can be configured to drop responses that resolve external domains to private IP addresses. Implementing anti-DNS-rebinding filters at the resolver level provides a robust layer of defense against this class of vulnerabilities across the entire infrastructure.

Official Patches

nltkOfficial fix commit implementing safe connection mechanics
nltkRelease notes and binaries for NLTK version 3.10.0 containing the fix

Fix Analysis (1)

Technical Appendix

CVSS Score
6.9/ 10
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
EPSS Probability
0.24%
Top 85% most exploited

Affected Systems

Python environments utilizing the nltk library

Affected Versions Detail

Product
Affected Versions
Fixed Version
nltk
nltk
< 3.10.03.10.0
AttributeDetail
CWE IDCWE-918
Attack VectorNetwork
CVSS v4.0 Score6.9
EPSS Score0.00241
Exploit StatusProof of Concept
CISA KEV StatusNo

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1005Data from Local System
Collection
CWE-918
Server-Side Request Forgery (SSRF)

The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.

Known Exploits & Detection

NLTK Project Pull Request #3582Contains regression tests illustrating the bypass of host validation using mock DNS servers and custom resolution pipelines.

Vulnerability Timeline

Vulnerability identified and patch merged into NLTK codebase
2026-06-06
CVE-2026-63311 and GHSA-3gqm-fcw5-w839 publicly disclosed
2026-08-22
National Vulnerability Database analysis completed
2026-08-27

References & Sources

  • [1]GitHub Security Advisory GHSA-3gqm-fcw5-w839
  • [2]NVD Vulnerability Page for CVE-2026-63311
  • [3]VulnCheck Security Advisory

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-62674
9.0

CVE-2026-62674: Shared Agent Bundle Overwrite Leads to Authenticated Runner Remote Code Execution in omnigent

A critical validation flaw in the backend of the omnigent framework prior to version 0.3.0 allows authenticated users to overwrite the global shared agent bundle, leading to remote code execution on the runner process through malicious stdio MCP server configurations.

Amit Schendel
Amit Schendel
1 views•7 min read
•about 3 hours ago•CVE-2026-62388
7.5

CVE-2026-62388: Insecure Default Security Enforcement in Natural Language Toolkit (NLTK) Path Security Module

CVE-2026-62388 represents a critical design flaw in the Natural Language Toolkit (NLTK) before version 3.10.0. The central security module (`nltk/pathsec.py`) initialized its validation enforcement flag to false by default. This fail-open configuration rendered security controls—such as path traversal checks, zip archive audits, and SSRF validations—non-blocking, only emitting warnings while permitting arbitrary file operations and code execution.

Amit Schendel
Amit Schendel
4 views•6 min read
•about 4 hours ago•CVE-2026-76172
7.5

CVE-2026-76172: Parser Differential and Host Confusion in fast-uri

A critical parser differential and host confusion vulnerability (CVE-2026-76172) exists in fast-uri, a dependency-free URI validation and normalization library for Node.js. This vulnerability stems from improper validation of the URI scheme component after decoding percent-encoded characters using the legacy global unescape() function. This allows structural characters such as path delimiters and control characters to be written raw into the output stream during serialization, causing host confusion, Server-Side Request Forgery (SSRF), or HTTP response splitting downstream.

Amit Schendel
Amit Schendel
3 views•6 min read
•about 5 hours ago•CVE-2026-75899
7.5

CVE-2026-75899: Double-Decoding Host Bypass and SSRF in fast-uri

A double-decoding vulnerability in the fast-uri package allows unauthenticated remote attackers to bypass host-policy validation and conduct Server-Side Request Forgery (SSRF) attacks by submitting nested percent-encoded URI strings.

Alon Barad
Alon Barad
3 views•6 min read
•about 6 hours ago•CVE-2026-75975
7.5

CVE-2026-75975: Server-Side Request Forgery (SSRF) and Address-Policy Bypass via Malformed IPv6 Parser in fast-uri

A critical parser differential vulnerability in the Node.js fast-uri library allows unauthenticated remote attackers to bypass address-validation filters and perform Server-Side Request Forgery (SSRF). The library fails to validate complete IPv6 grammar inside bracketed literals, silently truncating invalid trailing characters and normalising malformed hosts into valid loopback or private addresses.

Amit Schendel
Amit Schendel
4 views•7 min read
•about 7 hours ago•CVE-2026-75931
7.5

CVE-2026-75931: Host Confusion and SSRF Bypass via Scheme-Relative URIs in fast-uri

A host confusion vulnerability exists in the fast-uri Node.js library when parsing scheme-relative URI references. Due to inconsistent domain name canonicalization, applications validating resolved hosts can be bypassed by downstream WHATWG-compliant parsers, facilitating Server-Side Request Forgery (SSRF).

Amit Schendel
Amit Schendel
4 views•7 min read