CVE-2025-4330: Extraction filter bypass for linking outside extraction directory
Allows the extraction filter to be ignored, allowing symlink targets to point outside the destination directory, and the modification of some file metadata.
You are affected by this vulnerability if using the tarfile module to extract untrusted tar archives using TarFile.extractall() or TarFile.extract() using the filter= parameter with a value of "data" or "tar". See the tarfile extraction filters documentation
Other sources
Extraction filter bypass for linking outside extraction directory
— Microsoft
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
When using Python's tarfile module to extract untrusted tar archives with TarFile.extractall() or TarFile.extract(), do NOT set the filter parameter to "data" or "tar". Use an extraction filter that prevents symlink targets from being linked outside the destination directory and avoids the related metadata modification risk.
Python tarfile module TarFile.extractall()/TarFile.extract() filter parameter = use a restrictive extraction filter instead of "data" or "tar" when extracting untrusted tar archives - Configuration
For Python 3.14 or later, review usages of TarFile.extractall()/TarFile.extract() that rely on the default filter behavior: the default changed from "no filtering" to "data". If you extract untrusted tar archives and do not explicitly set a safe filter, your usage is affected.
Python tarfile module default extraction filter (Python 3.14+) = ensure you account for filter default change from "no filtering" to "data"
Event History
Frequently Asked Questions
What is the severity of CVE-2025-4330?
CVE-2025-4330 is rated as a medium severity vulnerability due to its potential to allow unauthorized symlink manipulation.
How do I fix CVE-2025-4330?
To fix CVE-2025-4330, upgrade to a patched version of Python that addresses the vulnerability in the tarfile module.
What software is affected by CVE-2025-4330?
CVE-2025-4330 affects the Python software, particularly versions 3.12 and potentially below that utilize the tarfile module.
What are the consequences of exploiting CVE-2025-4330?
Exploiting CVE-2025-4330 allows an attacker to manipulate file metadata and create symlinks that point to arbitrary locations on the filesystem.
How can I mitigate the risks associated with CVE-2025-4330?
To mitigate the risks of CVE-2025-4330, avoid extracting untrusted tar archives or implement additional validation and sanitization on the extracted files.