Zero-Day Use-After-Free in llama.cpp Server Component Allows Unauthenticated Remote Code Execution
A critical use-after-free vulnerability in the llama.cpp server component, disclosed by Zero Day Initiative, permits unauthenticated remote attackers to execute arbitrary code.

A critical use-after-free vulnerability has been discovered in the popular open-source large language model inference library, llama.cpp. The flaw, detailed by the Zero Day Initiative (ZDI) and assigned CVE-2026-131837, resides within the server_context_impl destroy vocab function. This vulnerability allows remote attackers to execute arbitrary code on affected installations without requiring any form of authentication, posing a significant risk to systems running the llama.cpp server.
The vulnerability stems from an improper handling of HTTP requests during the server's sleep transition. Specifically, the code fails to validate the existence of an object before attempting to perform operations on it. This oversight creates a window where an attacker can trigger a use-after-free condition, leading to a crash or, more critically, the execution of malicious code within the context of the service account running the llama.cpp server.
The potential impact of this vulnerability is severe. Successful exploitation could grant an attacker full control over the compromised system, allowing them to steal sensitive data, deploy further malware, or disrupt services. Given that llama.cpp is a widely used library for running large language models locally, many installations could be at risk if not promptly updated.
The Zero Day Initiative reported that the vulnerability has a CVSS score of 8.1, classifying it as critical. The advisory highlights that authentication is not a prerequisite for exploitation, making it an attractive target for threat actors seeking to compromise AI infrastructure or systems leveraging these models.
Fortunately, the developers of llama.cpp have already released a patch to address this vulnerability. The fix is available through a pull request on their GitHub repository, specifically pull request #32133. Users and organizations relying on llama.cpp are strongly advised to apply this update as soon as possible to mitigate the risk of exploitation.
The disclosure timeline indicates that the vulnerability was initially reported to the vendor on May 22, 2026. Following coordinated disclosure efforts, the advisory was publicly released on November 24, 2026, with an update on the same day. The research leading to the discovery of this flaw is credited to Nicholas Zubrisky of TrendAI Research.
This incident underscores the ongoing security challenges associated with rapidly evolving open-source AI libraries. As these tools become more integrated into critical infrastructure, the security of their components, including server functionalities, becomes paramount. Prompt patching and vigilant monitoring are essential to protect against such threats.