RCE via Pickle Deserialization

Exploit unsafe deserialization to execute arbitrary code on an ML inference server.

What you practise

Exploit unsafe deserialization to execute arbitrary code on an ML inference server. You run the attack yourself on a live model in a private sandbox set up for you, then capture the flag. Nothing to install and no API key.

Why pickle is dangerous even when you trust the source

pickle is not a data format, it's a serialized program. Loading a pickle file means executing arbitrary bytecode, and there is no 'safe' subset. The Python docs have said 'never unpickle data received from an untrusted source' for 25 years, but ML pipelines pickle everything (models, tokenizers, configs), and 'trusted source' often means 'downloaded from Hugging Face by someone on the team'. The supply chain is the threat model.

Where this has happened

  • Hugging Face malicious models (2024): JFrog reported 100+ malicious models on HF with pickle payloads that ran RCE on load. HF added a 'pickle scanner', but the format itself is the bug.
  • PyTorch torch.load CVE (2022-2024): Multiple CVEs around torch.load defaulting to unsafe pickle loading. PyTorch 2.6 finally flipped weights_only=True as the default in 2025.
  • Replicate / replit AI agents (2024): Several AI coding agents were demonstrated to execute arbitrary commands when users asked them to 'just run a quick test', the same exec()-on-LLM-output pattern as path 1 here.

Sign in to launch this lab Learn the theory in the Academy

More Knowledge & Retrieval labs

Attack labs

20 hands-on scenarios across 4 tracks. Pick a target, launch a private sandbox, capture the flag.

Active sessions

Resume a running lab or stop it before starting the next one.