Black Hat USA 2025 | Advanced Bypass Techniques and a Novel Detection Approach
Why It Matters
As enterprises increasingly adopt third‑party AI models, undetected malicious code can compromise critical systems; a robust detection approach is essential to secure the AI supply chain.
Key Takeaways
- •Third‑party AI models can execute malicious code at load or inference.
- •Static scanners rely on deny lists, which cannot cover all unsafe functions.
- •Embedded bytecode and pickle opcodes enable bypasses that evade detection.
- •Model architecture serialization often uses unsafe formats like pickle or lambdas.
- •Novel dynamic detection approach promises to mitigate static scanner shortcomings.
Summary
The Black Hat USA 2025 presentation by Itai Ravia of AIM Security highlighted a growing crisis in AI supply‑chain security: third‑party models can execute malicious code during loading or inference, and back‑door inputs can be silently injected by model authors. Ravia explained that model files contain not only massive weight tensors but also complex architecture definitions, often serialized with unsafe formats such as Python pickle, dill, or embedded lambda bytecode, which can hide arbitrary OS commands.
Current defenses rely on static scanners that inspect model byte streams for known dangerous imports like os.system. The talk demonstrated why this approach is fundamentally flawed: deny‑list scanners cannot enumerate the millions of possible Python functions, and they fail to analyze embedded bytecode or the full semantics of pickle opcodes. Using an AI‑driven agent, the researchers uncovered dozens of wrapper functions that bypass scanners, and they showed concrete exploits—e.g., leveraging the Emlflow projects backend or crafting minimal bytecode that imports os and calls system—undetected by Hugging Face’s own scans.
Ravia cited real‑world examples where Hugging Face’s pickle scanner flagged a model as unsafe for one import but marked another with identical imports as “unknown,” leaving data scientists to decide manually. He also detailed how pickle’s stack‑based opcodes (IMPORT, PUT, GET, INSTANTIATE, CALL) can be orchestrated to desynchronize scanner expectations, creating a stealthy execution path that static analysis cannot reliably emulate.
The implication is clear: organizations must move beyond static signature checks toward dynamic, behavior‑based detection that can safely execute and monitor model loading in a sandbox. Ravia’s novel detection framework promises to simulate the full pickle execution flow, catching hidden malicious logic and restoring confidence in the rapidly expanding model marketplace.
Comments
Want to join the conversation?
Loading comments...