Downloads · 30 days
18
35% of all-time downloads
shaq4prez/malicious-olmo3-poc
malicious-olmo3-poc is a machine learning model from shaq4prez. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This is a proof-of-concept malicious model created for responsible security disclosure.
Downloads · 30 days
18
35% of all-time downloads
All-time downloads
51
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md5.8 KB · 87%
From the Hugging Face model README
This is a proof-of-concept malicious model created for responsible security disclosure.
Purpose: Demonstrate arbitrary code execution vulnerability in Hugging Face Transformers
Program: Huntr Bug Bounty (MFV - Model File Vulnerabilities)
Severity: CRITICAL (CVSS 9.6)
Status: Responsibly disclosed
This model contains a weaponized .metadata pickle file that executes arbitrary code when
loaded by the transformers library's OLMo3 conversion script without any user warning or
TRUST_REMOTE_CODE validation.
File: src/transformers/models/olmo3/convert_olmo3_weights_to_hf.py
Lines: 259-260
with (Path(model_path) / ".metadata").open("rb") as metadata_file:
metadata = pickle.load(metadata_file) # ❌ UNSAFE - No validation!
keys = [key for key in metadata.state_dict_metadata.keys() if key.startswith("model.")]
When this model is converted using the official conversion script:
python src/transformers/models/olmo3/convert_olmo3_weights_to_hf.py \
--model-path ./malicious_olmo3_poc \
--output-dir ./converted
What happens:
.metadata using pickle.load()__reduce__ magic method/tmp/huntr_poc_exploited.txt)Result: Full arbitrary code execution with process privileges.
CVSS Score: 9.6 (Critical)
Attack Vector: Network (AV:N)
Attack Complexity: Low (AC:L)
Privileges Required: None (PR:N)
User Interaction: Required (UI:R)
Scope: Changed (S:C)
Confidentiality: High (C:H)
Integrity: High (I:H)
Availability: High (A:H)
Impact:
This vulnerability bypasses HuggingFace's ProtectAI security scanner because:
.pkl weight files, not .metadata files.) often ignored by scannersTRUST_REMOTE_CODE validation in this code pathResult: Malicious model can be uploaded to HuggingFace Hub and bypass automated security checks.
Immediate Fix:
# BEFORE (UNSAFE):
with (Path(model_path) / ".metadata").open("rb") as metadata_file:
metadata = pickle.load(metadata_file)
# AFTER (SAFE):
import json
with (Path(model_path) / ".metadata.json").open("r") as metadata_file:
metadata = json.load(metadata_file) # Safe - no code execution
Long-term Fix:
TRUST_REMOTE_CODE checks if pickle is necessary.metadata files# 1. Clone transformers repository
git clone https://github.com/huggingface/transformers.git
cd transformers
# 2. Clone this PoC model
git lfs install
git clone https://huggingface.co/<USERNAME>/malicious-olmo3-poc
# 3. Run conversion script (triggers exploit)
python src/transformers/models/olmo3/convert_olmo3_weights_to_hf.py \
--model-path ./malicious-olmo3-poc \
--output-dir ./converted
# 4. Verify exploitation
cat /tmp/huntr_poc_exploited.txt
# Expected output: "VULNERABILITY EXPLOITED - Arbitrary code executed via pickle deserialization"
✅ Arbitrary code execution during model loading
✅ No user warning or consent required
✅ Bypasses security scanning
✅ Affects real-world usage scenarios
Security Researcher: [Your Name/Handle]
Disclosure Platform: Huntr (https://huntr.com)
Project: Hugging Face Transformers
Maintainer Contact: [email protected]
This model is for security research and responsible disclosure only.
Use in accordance with applicable laws and ethical guidelines.
This PoC is provided for security research under responsible disclosure principles. The Transformers library is licensed under Apache 2.0.