Downloads · 30 days
0
htdy7703/gguf-rwkv-null-chain-oob-poc
gguf-rwkv-null-chain-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 RWKV GGUF whose vocabulary contains a token that decodes to A followed by a long run of NUL bytes triggers a stack-buffer-overflow during prompt tokenization in…
Downloads · 30 days
0
Access
Public
Updated Jul 8, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md2.2 KB · 34%
From the Hugging Face model README
This repository proves a narrow claim: loading a crafted RWKV GGUF whose vocabulary contains a token that decodes to A followed by a long run of NUL bytes triggers a stack-buffer-overflow during prompt tokenization in llama.cpp.
What this PoC shows:
"A" causes native code to read past the end of the prompt bufferWhat this PoC does not show:
Verified commit:
95e5254c0ae93529b2f6c05e210b9cac5c0070fcbuild_malicious_rwkv_null_chain.py: helper to generate rwkv-null-chain-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 buildSHA-256 of the generated rwkv-null-chain-oob.gguf artifact:
b085b41d9621ff782ab015dacee61694183d3c45a2ae362964058fa739654c7fpython3 build_malicious_rwkv_null_chain.py
That helper writes a metadata-only GGUF with:
general.architecture = "rwkv"tokenizer.ggml.model = "rwkv"tokenizer.ggml.tokens = ["A\\x00\\x00\\x00...","\\n"]The long \x00 chain is intentional. The RWKV tokenizer unescapes those bytes before building its trie, so tokenizing "A" walks through the implicit NUL terminator and then farther past the prompt buffer.
Build a small ASAN/UBSAN-instrumented loader from product sources together with poc_vocab_tokenize_loader.cpp and build_stubs.cpp, then run:
ASAN_OPTIONS=detect_leaks=0 \
./poc_rwkv_tokenize_loader ./rwkv-null-chain-oob.gguf
The expected result is an AddressSanitizer report showing:
ERROR: AddressSanitizer: stack-buffer-overflowREAD of size 1llm_tokenizer_rwkv_session::tokenizeThis PoC intentionally stays on the narrow RWKV embedded-NUL trie-walk issue. It does not claim a broader bug in every GGUF tokenizer implementation.