Python pickle is a built-in serialization format used to turn Python objects into bytes and later rebuild them. It is convenient for saving data or passing objects between trusted Python components, but it is not designed for untrusted input. During unpickling, the loader may invoke object constructors or other code paths, which means a malicious payload can execute code instead of merely restoring data.
In cyber security, this makes pickle a common source of remote code execution when it is exposed to network input, file uploads, message queues, or cache transports. Attackers look for services that accept pickled data without strong trust boundaries, then supply crafted objects to trigger arbitrary commands. Defenders avoid this risk by never unpickling data from untrusted sources, replacing pickle with safer formats such as JSON when possible, and isolating any unavoidable deserialization behind authentication and tight network controls.


