This repository contains a proof of concept for a scanner bypass in .keras model files.
Vulnerability
The open-source protectai/modelscan Keras logic only inspects serialized model layers.
That misses a second deserialization surface that Keras also loads from .keras archives:
compile_config
A malicious .keras file can hide a serialized dangerous __lambda__ inside the compiled loss configuration while keeping the model layers completely benign.
Keras still treats the lambda as unsafe and rejects it in safe_mode=True, but modelscan returns no findings because it never inspects compile_config.
Primary PoC
The main PoC file is:
artifacts/compile_lambda.keras
The payload is harmless. When the model is loaded unsafely and evaluated, it writes a local marker file at: