Downloads · 30 days
0
ybgwon96/llamacpp-minicpmv-clip-bucket-coords-oob-poc
llamacpp-minicpmv-clip-bucket-coords-oob-poc is a machine learning model from ybgwon96. 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 mit.
Proof-of-concept for a huntr Model File Vulnerabilities report against ggml-org/llama.cpp @ 2d97363 — tools/mtmd/clip.cpp.
Downloads · 30 days
0
Access
Public
Updated Jul 4, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md4.1 KB · 41%
From the Hugging Face model README
bucket_coords[1024] stack overflowProof-of-concept for a huntr Model File Vulnerabilities report against
ggml-org/llama.cpp @ 2d97363 — tools/mtmd/clip.cpp.
For authorized security research (responsible disclosure via huntr).
llama.cpp's multimodal loader reads clip.vision.image_size and clip.vision.patch_size from a GGUF
mmproj file and validates each independently (image_size<=65536, 0<patch_size<65536,
clip.cpp:1684-1706) but never bounds their quotient. For the MiniCPM-V / MiniCPM-V4.6 projector
families, that quotient is the loop count pos_h/pos_w that writes into fixed 1024-element stack
arrays int bucket_coords_h[1024] / int bucket_coords_w[1024] (clip.cpp:3663-3670 / :3705-3712),
with no capacity check. Setting image_size=65536, patch_size=1 → pos≈65536 → ~256 KB written past
the 4 KB arrays → stack smash. No control over the actual input image is needed.
| file | description |
|---|---|
bucket_coords_repro.c | faithful isolation of the exact vulnerable loop; SIGSEGV at pos=65536, stack-canary abort at pos=1170. |
CRASH_PROVEN.md | build + reproduced crash (SIGSEGV / SIGABRT, lldb frame). |
patch_mmproj.py | realistic attack: set the two vision KVs of a real MiniCPM-V mmproj GGUF to image_size=65536, patch_size=1. |
cc -O2 -g bucket_coords_repro.c -o bucket_coords_repro
./bucket_coords_repro 65536 1 # pos=65536 -> EXC_BAD_ACCESS (SIGSEGV) in the bucket_coords write loop
./bucket_coords_repro 16384 14 # pos=1170 -> stack smashing detected (SIGABRT)
Patch a real MiniCPM-V mmproj's two KVs and run any image through mtmd:
python3 patch_mmproj.py minicpmv-mmproj.gguf evil-mmproj.gguf # image_size=65536, patch_size=1
llama-mtmd-cli -m minicpmv-text.gguf --mmproj evil-mmproj.gguf --image any.png -p "describe"
# -> stack overflow in clip_image_batch_encode's bucket_coords write loop
Reported privately via huntr. Suggested fix: bound image_size/patch_size at hparams sanity-check time
(and/or bound the loop indices, or size bucket_coords_h/w dynamically instead of fixed [1024]).