Loading AI models: Why unknown pickle files can execute code
Python explicitly warns against untrusted pickle data. Review the file format and any accompanying model software separately.
Revisione editoriale:
In questa versione del sito il testo dell’articolo è disponibile in inglese.
Contesto e fonti
Pickle serialises and reconstructs Python objects. Python’s documentation warns that maliciously constructed pickle data can execute arbitrary code when unpickled. A model download containing such objects is therefore not necessarily passive numerical data. Consequences depend on the processing account’s permissions and reachable resources. [1]
Ambito e limiti
Not every pickle file is malicious. The format warning establishes neither a count of infected models nor automatic administrator access. [1]
Spiegato in modo semplice
A downloaded box may contain both numbers and instructions executed while opening it. Provenance and the environment used to open it matter.
Raccomandazioni pratiche
Our recommendation: evaluate unfamiliar models in a separate environment without production credentials. Review provenance, versions, startup scripts and dependencies. Where practical, prefer formats for numerical weights that do not require arbitrary Python objects. Still inspect any separately loaded code: a different weight format does not make the complete package trustworthy.