Downloads · 30 days
0
0% of all-time downloads
frostb1te/keras-hub-safe-mode-huntr-poc
keras-hub-safe-mode-huntr-poc is a machine learning model from frostb1te. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for keras.
This repository contains harmless proof-of-concept .keras files for a KerasHub tokenizer safe-mode bypass.
Downloads · 30 days
0
0% of all-time downloads
All-time downloads
55
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py3.7 KB · 45%
From the Hugging Face model README
This repository contains harmless proof-of-concept .keras files for a
KerasHub tokenizer safe-mode bypass.
The included model files are crafted so that keras.models.load_model() with
default safe_mode=True instantiates KerasHub tokenizer layers whose config
contains local file paths under /tmp. The repro script creates canary files at
those paths before loading the models.
python3 -m venv .venv
. .venv/bin/activate
pip install keras==3.15.0 keras-hub==0.29.1 tensorflow==2.20.0 tensorflow-text==2.20.1 h5py==3.14.0
python repro.py
Expected result:
PARSEQ FILE READ CONFIRMED
WHISPER JSON FILE READ CONFIRMED
The Python audit-hook output proves the victim process opened the canary paths
during keras.models.load_model() with default safe mode.
parseq_safe_mode_file_read.keras: PARSeqTokenizer vocabulary points to
/tmp/keras_hub_huntr_parseq_canary.txt.whisper_safe_mode_file_read.keras: WhisperTokenizer special_tokens and
language_tokens point to JSON canaries under /tmp.repro.py: creates canaries, loads both model files, and verifies re-save
leakage into model artifacts.