Get the latest tech news
Heap-overflowing Llama.cpp to RCE
Retr0's Threat Research
Despite the fact that we still hold no libc/ ggml-base base addresses, we are able to partial write other buffer->iface member that have entirely controllable first-parameter register and receivable return, essential factors that make leaking possible, theoretically. If you wonder why we need to leak another library, the answer is in order for us to receive a reverse shell via the heap-overflow, where we don't have direct control over a rwx segment as we do in stack-overflows, the best way is to execute commands via system() and pass in command-stored address as an argument. Converting the theoretical exploitation into reality needs an extra bit of consideration and tricks; To begin with, we do not replace the original buffer structure yet, since we still depends on the buffer->iface pointer manipulations to redirect the execution-flow.
Or read this on Hacker News