Views
No views yet
_verify_dataset() only checks dataset.external (ExternalLink)
but NOT dataset.is_virtual (VirtualDataset). A malicious model using HDF5 Virtual
Datasets transparently reads data from external H5 files on the victim's filesystem,
bypassing safe_mode=True.| Loading Method | VDS Works? | Notes |
|---|---|---|
load_model('model/') unzipped dir | YES | HuggingFace Hub format |
model.load_weights('file.weights.h5') | YES | Always disk-backed |
load_model('model.h5') legacy format | YES | Direct H5 load |
HuggingFace from_pretrained() | YES | Downloads to disk |
Large .keras zip (>available RAM) | YES | Extracted to temp dir |
KERAS_BACKEND=numpy python3 poc_final.py1# keras/src/saving/saving_lib.py, _verify_dataset()
2# Checks this: dataset.external -> None for VDS (PASSES!)
3# Misses this: dataset.is_virtual -> True for VDS (NOT CHECKED)
4# VDS reads from: dataset.virtual_sources() -> external file refsdataset.is_virtual check to _verify_dataset():1if dataset.is_virtual:
2 raise ValueError("Virtual datasets referencing external files are not allowed")