Incident report
Keras Arbitrary Code Injection via Malicious Lambda Layers in Legacy Models
CVE-2024-3660 (published April 16, 2024, disclosed by Oligo Security and JFrog) highlighted arbitrary code execution in TensorFlow Keras (`< 2.13`) when deserializing `.h5` or Keras models containing weaponized `Lambda` layers. Because Keras Lambda layers serialize arbitrary marshaled Python bytecode directly inside the neural network graph definition, calling `load_model()` executed attacker commands automatically on load. Legacy enterprise ML pipelines continuing to load third-party H5 models faced silent supply-chain compromise. Upgrading to Keras 2.13+ with `safe_mode=True` enabled by default and scanning model layers remediated the baseline risk.
Incident record
- Reported
- Severity
- Critical
- Vector
- Supply Chain
- Affected system type
- TensorFlow / Keras H5 & SavedModel Pipelines
- Reference
CVE-2024-3660- Reference URI
https://nvd.nist.gov/vuln/detail/CVE-2024-3660
Defensive lesson
Prohibit Keras Lambda layers in third-party model ingestion pipelines, enforce safe_mode=True, and scan all H5/SavedModel artifacts in CI.
Referenced techniques
- Supply Chain Compromise: Model Repository AML.T0010.003
- User Execution: Unsafe AI Artifacts AML.T0011.000
- Manipulate AI Model: Modify AI Model Architecture AML.T0018.001
- Manipulate AI Model: Embed Malware AML.T0018.002
- Publish Poisoned AI Artifacts: Models AML.T0115.001