CVE-2025-71321
JSON

9.3critical

picklescan - Arbitrary File Writing via distutils Module Bypass

Severity
9.3critical CVSS:4.0 by VulnCheck
Exploit likelihood
0.82% (higher than 58% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
VulnCheck
Also known as
GHSA-m273-6v24-x4m4PYSEC-2026-1791

Description

picklescan before 0.0.33 contains an arbitrary file writing vulnerability that allows attackers to bypass the dangerous blocklist by using distutils.file_util.write_file. Attackers can construct malicious pickle objects to overwrite critical system files and achieve denial of service or remote code execution.

Affected

Product or packageVersionsReported by
picklescan picklescanbefore 0.0.33
Not affected: 0.0.33
CVE List
picklescan (PyPI)before 0.0.33GitHub Advisory Database, PyPA Advisory Database

All scores

VulnCheck9.3critical CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
VulnCheck9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P
PyPA Advisory DatabaseNot scored CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P

Classification

CWE-502CWE-552

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total.

What each source says

CVE List

picklescan before 0.0.33 contains an arbitrary file writing vulnerability that allows attackers to bypass the dangerous blocklist by using distutils.file_util.write_file. Attackers can construct malicious pickle objects to overwrite critical system files and achieve denial of service or remote code execution.

GitHub Advisory Database
Summary

Picklescan has got open() and shutil in its default dangerous blocklist to prevent arbitrary file overwrites. However the module distutils isnt blocked and can be used for the same purpose ie to write arbitrary files.

Details

This is another vulnerability which impacts the downstream user.

By constructing a pickle that user distutils.file_util.write_file, an attacker can overwrite critical system files (like .ssh/authorized_keys, web server configurations, or source code) to achieve DoS or escalate to RCE.

PoC
import pickle
import distutils.file_util

class FileWriteBypass:
    def __reduce__(self):
        
        target_file = "pwned_config.env"
        content = ["print('I have overwritten your config')"]
        
        return (distutils.file_util.write_file, (target_file, content))

payload = pickle.dumps(FileWriteBypass())
with open("bypass_filewrite.pkl", "wb") as f:
    f.write(payload)

print("bypass_filewrite.pkl")
image

To fix this just add disutil to the blacklist

NVD (es)

picklescan anterior a 0.0.33 contiene una vulnerabilidad de escritura arbitraria de archivos que permite a los atacantes eludir la lista de bloqueo peligrosa utilizando distutils.file_util.write_file. Los atacantes pueden construir objetos pickle maliciosos para sobrescribir archivos críticos del sistema y lograr denegación de servicio o ejecución remota de código.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-71321 changed 2026-11-08CVE Terms of Use
GitHub Advisory DatabaseGHSA-m273-6v24-x4m4 changed 2026-07-07CC-BY-4.0
NVDCVE-2025-71321 changed 2026-10-12Public domain
PyPA Advisory DatabasePYSEC-2026-1791 changed 2026-07-07CC-BY-4.0