How to use from the
Use from the
Keras library
# !pip install -U keras tensorflow huggingface_hub
# Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here;
# "jax" and "torch" also work for computation once TensorFlow is installed.
import os
os.environ["KERAS_BACKEND"] = "tensorflow"

import keras

model = keras.saving.load_model("hf://missamehdi/model-keras-lambda-rce")

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

PoC: Keras Lambda Layer ACE

Vulnerability

Arbitrary Code Execution via Keras Lambda Layer Deserialization

Format

Keras Native (.keras)

Impact

  • Full system compromise when model loaded with safe_mode=False
  • Arbitrary code execution
  • Bounty: $3,000-$4,000

Test

keras.config.enable_unsafe_deserialization()
model = keras.models.load_model('malicious_keras_ace.keras')  # RCE!
Downloads last month
1
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support