The vulnerability, CVE-2023-42434, in picklescan is a case of incomplete detection, where the tool failed to identify ensurepip._run_pip as a dangerous function that could be used for remote code execution in a malicious pickle file. The root cause was an omission in the dangerous_globals dictionary, which serves as a denylist for the scanner.
The patch, found in commit 1931c2d04eaca8d20597705ff39cab78ba364e4b, directly addresses this by adding "ensurepip": {"_run_pip"} to this denylist in src/picklescan/scanner.py.
My analysis identified two key functions that would be active during the exploitation of this vulnerability:
Scanner.is_dangerous_global: This is the core function that contained the logic flaw. Its purpose is to check if a given function name is in the denylist. Because ensurepip._run_pip was missing from the list, this function would incorrectly return False, thereby failing to detect the threat.
Scanner.scan_pickle_bytes: This function is the entry point for processing the pickle data. It parses the pickle file and uses Scanner.is_dangerous_global to check the safety of the contents. During an attack (i.e., scanning a malicious pickle), this function would be at the top of the call stack related to the failed detection.
Therefore, a security engineer with this CVE in their environment should be aware that any process using picklescan to scan pickle files before the patch was vulnerable to this bypass. The identified functions are the specific parts of the codebase that were processing the malicious input and failed to correctly identify it as a threat.
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| picklescan | pip | < 0.0.30 | 0.0.30 |