CVE-2026-52132
ggml-org · llama.cpp
A denial of service vulnerability in llama.cpp allows unauthenticated remote attackers to trigger memory exhaustion via a negative top_n value in POST requests to the /rerank endpoint.
Executive summary
An unauthenticated remote denial of service vulnerability exists in llama.cpp when the --reranking flag is enabled, posing a risk to service availability.
Vulnerability
This is a denial of service vulnerability triggered by an unauthenticated attacker sending a crafted POST request to the /rerank endpoint containing a negative top_n parameter. This input causes an unhandled memory allocation error (std::bad_alloc) and a subsequent HTTP 500 response, potentially crashing the application process.
Business impact
The exploitation of this vulnerability results in service downtime, which can disrupt business operations dependent on the llama.cpp inference engine. With a CVSS score of 7.5, the vulnerability is classified as high severity because it is network-accessible and requires no authentication, allowing any remote user to impact the availability of the service.
Remediation
Immediate Action: Ensure the --reranking flag is disabled if not strictly required, and monitor the upstream repository for a commit that addresses the memory allocation error.
Proactive Monitoring: Review application and web server access logs for anomalous POST requests to the /rerank endpoint, specifically looking for negative integers passed to the top_n parameter.
Compensating Controls: Deploy a Web Application Firewall (WAF) or an API gateway to sanitize incoming requests and block POST traffic to /rerank that contains negative values in the top_n field.
Exploitation status
Public Exploit Available: Unknown.
Analyst recommendation
Given the high CVSS score and the ease of exploitation over the network, organizations using llama.cpp with the reranking feature enabled must treat this as a significant availability risk. Organizations should prioritize restricting access to the /rerank endpoint or disabling the feature until a formal security patch is released by the project maintainers.