jdhart81/koboldcpp-ggml-poc
0
koboldcpp Legacy GGML Loader PoC
Vulnerability
CWE-121 Stack Buffer Overflow + CWE-190 Integer Overflow in all 10 legacy model loaders.
Target
LostRuins/koboldcpp - otherarch/*.cpp
Usage
python3 generate_poc.pyThis generates:
- pocstackoob.bin - triggers stack buffer overflow via n_dims=8 on ne[2]
- pocintoverflow.bin - triggers integer overflow via n_embd=46341
Reproduction
make LLAMA_SANITIZE_ADDRESS=1
./koboldcpp --model poc_stack_oob.binASan will report stack-buffer-overflow in the ne[2] write loop.
Affected Files
All share identical vulnerable pattern (int32t ne[2] with unbounded ndims loop):
- otherarch/gpt2_v1.cpp
- otherarch/gpt2_v2.cpp
- otherarch/gpt2_v3.cpp
- otherarch/gptj_v1.cpp
- otherarch/gptj_v2.cpp
- otherarch/gptj_v3.cpp
- otherarch/neox_v2.cpp
- otherarch/neox_v3.cpp
- otherarch/mpt_v3.cpp
- otherarch/rwkv_v2.cpp
