TensorFlow.js optimizer weightSpecs amplification PoC
This repository contains a benign security research proof of concept for a TensorFlow.js model.json that appends a very large number of zero-length optimizer weight specs.
Files
model.json- TF.js layers-model file with extra optimizer-group weight specsweights.bin- tiny 8-byte control weights bufferbuild-meta.json- entry count and artifact sizespackage.json- minimal dependency on@tensorflow/tfjs 4.22.0reproduce_from_files.js- local replay helper
What it demonstrates
loadLayersModel() decodes the full weightSpecs list before deciding whether optimizer weights are relevant.
With 1000000 zero-length optimizer specs:
model.jsonis about68.56 MB- local replay drives about
1.3 GBRSS - the model still loads successfully
Quick repro
npm ci
node --expose-gc reproduce_from_files.js .
Expected output shape:
{
"entries": 1000000,
"json_mb": 68.56,
"ms": 2876,
"rss_before": 554.7,
"rss_after": 1313.7,
"pred": [[1.975830834697992e-43]]
}
This PoC is intended for defensive validation and bug bounty triage only.
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support