Study model serialization risks
Jump & context
Week 3: Memory Security, Trajectory Ledger Contract, Supply-Chain SBOM & Vector Foundations
The five hours
- 01
Concepts & system design
60 min· read · map the mechanismR12 — Safetensors format & security
R11 — Hugging Face remote code & revision pinning
Read the assigned sections; map the mechanism, threat model and trade-offs.
- 02
Project implementation
120 min· build · integrate · debugStudy model serialization hazards (
picklearbitrary code execution vs.safetensorsformat) andtrust_remote_coderisks.Build, integrate, debug and improve the increment in the active project.
- 03
Security lab
60 min· attack your own systemIn an isolated disposable container, compare a safe tensor load against a benign demonstration of
pickledeserialization behavior; enforce safe-loading policy in code.Test the abuse case, failure path, authorization bypass or resource limit.
- 04
Verification & evidence
30 min· test · record evidenceSafe-loading architecture decision record (ADR) and scanner policy rejecting unsafe weight formats.
Add or run regression tests; record the 9-point evidence record.
- 05
Deliberate practice & Socratic review
30 min· explain aloud · update gapsAnswer the 8 Socratic questions without notes: What? Why? How? What if? Why not? How can I prove it? Where can it break? What have I learned?
Re-explain the hardest concept aloud, inspect one edge case, update the gap log.
- total5 h
Read today · inside the concepts block
R11 R12Model cards, tokenizer/config files, embedding usage, and repository commit-hash revision pinning.
Zero-copy safe tensor format overview vs. unsafe pickle deserialization risks.
Read only the named sections needed for today's task. Reading sits inside the 60-minute concepts block; it is not extra time.
Free resources for this day
5 curated- docsHugging Face Safetensors Documentation · reference docsSafetensors
Defines the format as a JSON header plus raw tensor buffers with no executable content, which is exactly the property that removes pickle deserialization RCE from model loading.
R12R11checked 2026-11-11 - videoYannic Kilcher · 20 minThe hidden dangers of loading open-source AI models (ARBITRARY CODE EXPLOIT!)
Builds a malicious model file step by step to show how a pickle __reduce__ payload executes on torch.load, the exact arbitrary-code-execution path the day asks you to reason about.
R11R12checked 2026-11-11 - videoBlack Hat · 27 minBlack Hat Europe 2025 | Pickle Exploitation Techniques And Their Detection Using SaferPickle
Covers nested-pickle payloads, allowlist-based detection and the limits of static scanning, useful for judging what a pickle scanner can and cannot prove before you trust a checkpoint.
R12checked 2026-11-11 - articleHugging Face Hub Documentation · security docPickle Scanning
Explains how the Hub extracts GLOBAL/REDUCE opcode imports without executing them and admits the scan is not foolproof, giving you the threat-model caveats for scanner-based controls.
R11checked 2026-11-11 - repoTrail of Bits (GitHub) · tool + CLItrailofbits/fickling: A Python pickling decompiler and static analyzer
Decompiles pickle bytecode and enforces an import allowlist at load time, a hands-on way to see trust_remote_code and pickle payloads caught before deserialization.
R12checked 2026-11-11
Evidence record · 9-point standard
A lab is complete only when it produces evidence. Installing PyRIT, Garak, Presidio or TransformerLens is not completion. Saved on this device only.
Day notes
emptyThe two source formulations
verbatim · nothing summarisedProject & Deliverable Target
P2 | `D12` (AI Supply-Chain SBOM Scanner) | M1
Core Implementation
Study model serialization hazards (pickle arbitrary code execution vs. safetensors format) and trust_remote_code risks.
Security Lab
In an isolated disposable container, compare a safe tensor load against a benign demonstration of pickle deserialization behavior; enforce safe-loading policy in code.
Verification & Evidence
Safe-loading architecture decision record (ADR) and scanner policy rejecting unsafe weight formats.
Read Today (60m Concepts Block)
R12 (Safetensors format & security), R11 (Hugging Face remote code & revision pinning).
---