Downloads · 30 days
0
pragnyanramtha/cambricon-magicmind-header-badalloc-poc
cambricon-magicmind-header-badalloc-poc is a machine learning model from pragnyanramtha. 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 other.
This repository contains benign .magicmind model artifacts that demonstrate a Cambricon MagicMind deserializer availability issue. The PoC does not execute code, persist state, access credentials, or make network call…
Downloads · 30 days
0
Access
Public
Updated May 12, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md3.9 KB · 31%
From the Hugging Face model README
.magicmind Header bad_alloc Abort PoCThis repository contains benign .magicmind model artifacts that demonstrate a Cambricon MagicMind deserializer availability issue.
The PoC does not execute code, persist state, access credentials, or make network calls; it only demonstrates an uncaught allocation failure / process abort in a local model parser.
truncated_80b_u32_028_255.magicmind is an 80-byte MagicMind model header artifact.
It preserves the header magic and low 32 bits of the serialized protobuf-size field, but sets the high 32 bits of the 64-bit size field at header offset 0x18 to 255.
In MagicMind 1.8.0, DeserializeFromFile() reads the 80-byte model head, reads the artifact-controlled qword at offset 0x18 as the serialized protobuf size, and reaches operator new(proto_size).
The malformed artifact causes an uncaught std::bad_alloc, aborting the process.
A 79-byte artifact with the same mutated qword fails cleanly with "Read model head failed", so the 80-byte file is the minimal observed boundary that reaches the allocation path.
.magicmind)1.8.0magicmind::IModel::DeserializeFromFile(...)std::bad_allocartifacts/truncated_80b_u32_028_255.magicmind
d741473ca58d4554e061ac22bbe5b701e54a46610d09de78958049bdbeb9bd50artifacts/truncated_79b_u32_028_255.magicmind
c12814f313c3d5b9a342810db5563a7cbf45b2daf9275e6114608a91dc560990artifacts/truncated_64b_u32_028_255.magicmind
dd3a90b1a65941c76959d238ccc8f723b5cd68ee488b09dbb6f0795449f26c73Build or provide a small MagicMind deserialization harness equivalent to src/mm_deserialize_harness.cpp.
Then run:
export MM_LIB=/path/to/magicmind_wheel/magicmind
export DEP_LIB=/path/to/neuware/lib64
export LD_LIBRARY_PATH="$MM_LIB:$DEP_LIB"
python verify_magicmind_header_badalloc.py --harness /path/to/mm_deserialize_harness
Expected high-level result:
std::bad_alloc / SIGABRT.Local verification used:
1.8.09542c7c0abe9c6fe2cc3a589fbf8d7d8ce9ffbef2dcd048db278d04059a807840.8.8Captured verifier output is in evidence/header_field_verification.tsv.
ModelScan 0.8.8 reported zero issues, scanned zero files, and skipped the .magicmind artifact as unsupported.
The public libmagicmind_runtime.so.1 binary retains useful symbols.
Local disassembly of magicmind::serializer::Deserializer::Deserialize(magicmind::ModelDef*) showed that the deserializer:
0x50 bytes into magicmind::serializer::ModelHead;0x10;0x18;operator new(size) if that qword is non-zero;The seed model's qword at offset 0x18 was 0x0000000000043934.
The primary PoC changes it to 0x000000ff00043934, causing the allocation failure after the full 80-byte head is read.
This is a parser availability issue, not arbitrary code execution. The proof demonstrates a controlled process abort from a model artifact in a closed binary parser.