HDF5 Trigger Backdoor PoC

This repository contains a benign security research proof of concept for an HDF5 model-file vulnerability report.

Files:

  • control_hdf5_classifier.h5
  • malicious_hdf5_trigger.h5
  • reproduce.py

The malicious HDF5 file is loaded with h5py.File(). It behaves like the control file for normal inputs, but hidden datasets in the file change the model output during inference for a trigger input.

Tested runtime:

  • h5py==3.14.0
  • HDF5==1.14.6
  • numpy==2.4.6
  • trigger entrypoint: h5py.File(path, "r"); numpy inference

Scanner result:

  • modelscan==0.8.8
  • scanner: H5LambdaDetectScan
  • result: No issues found!
  • skipped reason: Model Config not found

Public files:

  • Control: https://huggingface.co/hacnho/hdf5-trigger-backdoor-poc/resolve/main/control_hdf5_classifier.h5
  • Malicious: https://huggingface.co/hacnho/hdf5-trigger-backdoor-poc/resolve/main/malicious_hdf5_trigger.h5
  • Reproducer: https://huggingface.co/hacnho/hdf5-trigger-backdoor-poc/resolve/main/reproduce.py

Reproduction:

python -m venv /tmp/hdf5-trigger-poc-venv
. /tmp/hdf5-trigger-poc-venv/bin/activate
pip install 'numpy' 'h5py' 'modelscan==0.8.8'

curl -L -o control_hdf5_classifier.h5 \
  https://huggingface.co/hacnho/hdf5-trigger-backdoor-poc/resolve/main/control_hdf5_classifier.h5
curl -L -o malicious_hdf5_trigger.h5 \
  https://huggingface.co/hacnho/hdf5-trigger-backdoor-poc/resolve/main/malicious_hdf5_trigger.h5
curl -L -o reproduce.py \
  https://huggingface.co/hacnho/hdf5-trigger-backdoor-poc/resolve/main/reproduce.py

python reproduce.py control_hdf5_classifier.h5 malicious_hdf5_trigger.h5

Expected output:

"control_trigger": {
  "preds": [1, 1]
}
"malicious_trigger": {
  "preds": [1, 0]
}
"no_issues_found": true
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support