Downloads · 30 days
0
htdy7703/gguf-t5-precompiled-charsmap-strlen-oob-poc
gguf-t5-precompiled-charsmap-strlen-oob-poc is a machine learning model from htdy7703. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository proves a narrow claim: loading a crafted T5 GGUF and tokenizing a matching prompt prefix triggers a heap-buffer-overflow in llama.cpp because strlen() is called on an unterminated replacement string fr…
Downloads · 30 days
0
Access
Public
Updated Jul 7, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md1.9 KB · 28%
From the Hugging Face model README
strlen() OOB read PoCThis repository proves a narrow claim: loading a crafted T5 GGUF and tokenizing a matching prompt prefix triggers a heap-buffer-overflow in llama.cpp because strlen() is called on an unterminated replacement string from tokenizer.ggml.precompiled_charsmap.
What this PoC shows:
"A" triggers an out-of-bounds heap read in native codeWhat this PoC does not show:
Verified commit:
95e5254c0ae93529b2f6c05e210b9cac5c0070fcbuild_malicious_t5_charsmap_strlen.py: helper to generate t5-precompiled-charsmap-strlen-oob.ggufpoc_vocab_tokenize_loader.cpp: minimal vocab-loading and tokenization harness using product codebuild_stubs.cpp: small helper stubs needed by the reduced harness buildThe crafted metadata blob encodes a valid XCDA leaf for the byte A and a replacement offset that points to the last byte of the attacker-controlled prefix-replacement region without a NUL terminator. The tokenizer later calls strlen() on that pointer while normalizing "A".
First generate t5-precompiled-charsmap-strlen-oob.gguf with build_malicious_t5_charsmap_strlen.py. Then build a small ASAN/UBSAN-instrumented loader from product sources together with poc_vocab_tokenize_loader.cpp and build_stubs.cpp, and run:
ASAN_OPTIONS=detect_leaks=0 \
./poc_vocab_tokenize_loader ./t5-precompiled-charsmap-strlen-oob.gguf
The expected result is an AddressSanitizer report showing:
ERROR: AddressSanitizer: heap-buffer-overflowREAD of size 2strlenllm_tokenizer_ugm_session::normalize_prefix