Skip to content
Path traversal Disclosed report Intermediate CVE-2025-14009

NLTK has a Zip Slip Vulnerability

The NLTK downloader extracts downloaded zip packages without validating paths, allowing a malicious package to write files outside the intended directory. If the package contains Python files such as __init__.py, these are executed on import, leading to arbitrary code execution.

nltk/nltk

Originally disclosed on huntr

Critical View original

A critical vulnerability exists in the NLTK downloader component of nltk/nltk, affecting all versions. The _unzip_iter function in nltk/downloader.py uses zipfile.extractall() without performing path validation or security checks. This allows attackers to craft malicious zip packages that, when downloaded and extracted by NLTK, can execute arbitrary code. The vulnerability arises because NLTK assumes all downloaded packages are trusted and extracts them without validation. If a malicious package contains Python files, such as init.py, these files are executed automatically upon import, leading to remote code execution. This issue can result in full system compromise, including file system access, network access, and potential persistence mechanisms.

From the GitHub Advisory Database (GHSA-7p94-766c-hgjp, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

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 downloader calls zipfile.extractall() on untrusted archives without validating entry paths or checking for unsafe content.

Impact

An attacker could achieve remote code execution and full system compromise, including file system access, network access, and persistence.

What the attacker needed

Victim downloads a malicious package

The fix

The downloader should validate archive entry paths before extraction and avoid executing untrusted Python files.

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.

When you download a zip file, it can contain file paths that point outside the folder you meant to extract into. This is called a Zip Slip. Here, the tool unpacks packages without checking those paths, so a bad package can drop a Python file that runs automatically when the package is imported, giving the attacker control of your machine.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More from nltk/nltk

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.