Llama.cpp Heap Overflow Exploit: A 30-Hour Journey to RCE

2025-03-26
Llama.cpp Heap Overflow Exploit: A 30-Hour Journey to RCE

This write-up details a 30-hour journey exploiting a heap overflow in Llama.cpp to achieve remote code execution (RCE). Llama.cpp's unique heap management system thwarted classic ptmalloc exploitation techniques. The author cleverly leveraged Llama.cpp's implementation logic, bypassing multiple security checks to achieve a heap overflow. Through intricate manipulations, RCE was gained. The article provides an in-depth analysis of the vulnerability details, mitigations, and the final exploitation, offering valuable insights for security researchers.

Development heap overflow