<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>NLTK (&lt;= 3.9.4) - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/nltk--3.9.4/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata. Fed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Fri, 31 Jul 2026 19:30:03 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/nltk--3.9.4/feed.xml" rel="self" type="application/rss+xml"/><item><title>NLTK NKJPCorpusReader Path Traversal Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2026-07-nltk-path-traversal/</link><pubDate>Fri, 31 Jul 2026 19:30:03 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-07-nltk-path-traversal/</guid><description>A path-traversal vulnerability in NLTK's NKJPCorpusReader allows attackers to read arbitrary files by bypassing the nltk.pathsec security sandbox.</description><content:encoded><![CDATA[<p>The Natural Language Toolkit (NLTK) version 3.9.4 and earlier contains a critical path-traversal vulnerability (CVE-2026-12072) within the <code>NKJPCorpusReader</code> class. The component fails to validate or sanitize the <code>fileids</code> parameter used in its corpus reading methods (e.g., <code>header</code>, <code>raw</code>, <code>words</code>). Instead of utilizing the <code>nltk.pathsec</code> security framework, which is designed to prevent directory traversal and enforce strict access control, <code>NKJPCorpusReader</code> relies on insecure string concatenation to build file paths and subsequently invokes Python's built-in <code>open()</code> function.</p>
<p>This architectural flaw persists even when <code>nltk.pathsec.ENFORCE = True</code> is set, a configuration specifically intended to protect multi-tenant and web-based applications from unauthorized file system access. An attacker capable of influencing the input to these methods can escape the intended corpus directory, leading to unauthorized disclosure of sensitive files on the host system. The vulnerability affects a wide range of NLTK corpus readers that share the same insecure pattern of using raw file operations over the provided security API.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker identifies an application endpoint or script that accepts user-supplied input used as a <code>fileids</code> argument for NLTK's <code>NKJPCorpusReader</code>.</li>
<li>Attacker crafts a malicious path string containing directory traversal sequences (e.g., <code>../../../../</code>) to escape the configured corpus root directory.</li>
<li>The application passes the malicious string into the <code>NKJPCorpusReader.header()</code> or related corpus reading method.</li>
<li><code>NKJPCorpusReader</code> performs plain string concatenation of the corpus root and the attacker-controlled <code>fileids</code> without normalization or security validation.</li>
<li>The resulting path points to a sensitive file on the host filesystem (e.g., <code>/etc/passwd</code> or configuration files).</li>
<li>The <code>NKJPCorpusReader</code> method calls the Python built-in <code>open()</code> function directly with the resolved malicious path.</li>
<li>The <code>nltk.pathsec</code> sandbox is never consulted, bypassing the <code>ENFORCE=True</code> security configuration.</li>
<li>The application returns the content of the unintended file to the attacker, resulting in unauthorized data exfiltration.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation allows for the arbitrary reading of files on the host operating system with the privileges of the service account running the NLTK-based application. This poses a significant risk to web and multi-tenant environments where NLTK is utilized to process untrusted user input. Exposure of local configuration files, API keys, or system credentials could lead to full system compromise. The vulnerability affects any software utilizing NLTK &lt;= 3.9.4 for corpus analysis.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Update NLTK to the latest version once a patch is released that addresses the <code>NKJPCorpusReader</code> path validation logic.</li>
<li>Implement strict input validation for any user-controlled data intended to act as a file path or identifier within NLTK readers.</li>
<li>Audit application code for any custom use of <code>os.path.join</code> or string concatenation when constructing file paths passed to NLTK corpus objects, ensuring that <code>FileSystemPathPointer.open()</code> is used instead of the built-in <code>open()</code>.</li>
<li>Restrict the privileges of the system user running the NLTK-dependent application to the minimum necessary directory access using OS-level controls (e.g., AppArmor, SELinux, or container volume restrictions).</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>path-traversal</category><category>cve-2026-12072</category><category>library-vulnerability</category></item><item><title>NLTK pathsec DNS Rebinding SSRF Filter Bypass</title><link>https://feed.craftedsignal.io/briefs/2026-07-nltk-ssrf-bypass/</link><pubDate>Fri, 31 Jul 2026 19:29:56 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-07-nltk-ssrf-bypass/</guid><description>A DNS rebinding vulnerability in the NLTK pathsec module allows attackers to bypass SSRF filters and access restricted internal resources by manipulating hostname resolution during the validation and connection phases.</description><content:encoded><![CDATA[<p>The NLTK library (version 3.9.4 and earlier) contains a critical SSRF filter bypass vulnerability in its <code>nltk.pathsec</code> module, specifically within the <code>urlopen</code> function and underlying utilities like <code>nltk.data.load</code>. The vulnerability stems from a race condition or logic flaw involving independent DNS resolutions: <code>validate_network_url</code> performs an initial check against forbidden IP ranges (loopback, private, link-local), but the subsequent HTTP connection initiated by <code>urllib</code> performs a second, independent DNS resolution.</p>
<p>An attacker can exploit this via DNS rebinding by providing a domain that returns a legitimate public IP during the first check, and an unauthorized internal or loopback IP during the second check. Even when <code>nltk.pathsec.ENFORCE</code> is set to <code>True</code>, the security control is rendered ineffective. This allows for non-blind SSRF, enabling attackers to exfiltrate data from internal interfaces, administrative consoles, or cloud metadata services (e.g., 169.254.169.254), leading to potential credential theft or deeper network penetration.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker sets up a malicious authoritative DNS server for a domain (e.g., rebind.attacker.test) with a TTL of 0.</li>
<li>Attacker provides the malicious domain as an input to a function utilizing <code>nltk.pathsec.urlopen</code>.</li>
<li><code>nltk.pathsec</code> calls <code>_resolve_hostname</code>, which performs the first DNS lookup; the attacker's server returns a benign public IP.</li>
<li>The validation logic compares the benign IP against blocklists, deems the URL safe, and allows the request to proceed.</li>
<li><code>urlopen</code> passes the raw hostname to the <code>urllib</code> connection layer.</li>
<li><code>urllib</code> initiates a second DNS lookup to establish the actual TCP connection.</li>
<li>The attacker's DNS server returns a loopback or internal private IP for this second resolution.</li>
<li>The application establishes a connection to the sensitive internal resource and returns the response body to the attacker.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>The vulnerability facilitates full-response (non-blind) SSRF. Attackers can read data from internal services protected by perimeter firewalls. In cloud-hosted environments, this is frequently leveraged to query instance metadata services for IAM roles, API keys, and service tokens, leading to full compromise of the affected application's identity and subsequent unauthorized access to broader cloud infrastructure.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Update NLTK to the latest patched version that pins the resolved IP address across the validation and connection phases.</li>
<li>If patching is not immediately possible, restrict outbound network access from servers running NLTK processing tasks to prevent connections to internal RFC1918 and link-local address spaces.</li>
<li>Implement host-level egress filtering (e.g., using <code>iptables</code> or local firewall rules) to explicitly block NLTK-related service accounts from initiating connections to 127.0.0.1 or 169.254.169.254.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>ssrf</category><category>dns-rebinding</category><category>vulnerability</category><category>path-traversal</category><category>arbitrary-file-read</category><category>library-vulnerability</category></item></channel></rss>