The vulnerability, CVE-2025-5175, is described as an 'Incorrect Privilege Assignment' in erdogant/pypickle affecting the Save function in pypickle/pypickle.py. The core issue is that pypickle.Save can be used to serialize arbitrary Python objects via pickle.dump. If a malicious object (designed to execute code upon unpickling) is saved, it creates a dangerous pickle file.
The actual 'improper authorization' (typically arbitrary code execution) occurs when this malicious pickle file is deserialized by the pypickle.load function in versions prior to 2.0.0. The pre-patch load function had significant weaknesses:
- It exposed an
safe=False option, which directly called load_unsafe, a thin wrapper around pickle.load, offering no security.
- Its default
safe=True mode relied on SafeUnpickler, which the patch 14b4cae704a0bb4eb6723e238f25382d847a1917 completely removed and replaced, indicating it was insufficient for preventing exploitation.
The patch primarily fortifies the load function by introducing a new, more robust validation mechanism (ValidateUnpickler and associated helper functions like get_allowed_modules, get_risk_modules, get_validate_modules) and making this secure validation the default. While the Save function itself only received a minor, functionally unrelated change (fix_imports parameter) in this patch, it is cited as the affected function because it's the entry point for creating the malicious payload.
Therefore, pypickle.Save is vulnerable as it enables the creation of the exploit. The pre-patch pypickle.load, pypickle.load_unsafe, and pypickle.SafeUnpickler.find_class are vulnerable as they are the functions that would process the malicious pickle file and lead to code execution during exploitation. These loading functions would appear in a runtime profile when the vulnerability is triggered.