Skip to content
Threat Feed
high advisory

Use-After-Free Vulnerability in llama-server

A use-after-free vulnerability in llama-server allows for potential remote code execution via a TOCTOU race condition in tokenization endpoints when using the --sleep-idle-seconds configuration.

CVE search metadata

CVE search record: CVE-2026-43632. Severity: high. CVSS: 8.1. KEV: no. Product: llama-server, llama-server (b7492 through b9060). Brief: Use-After-Free Vulnerability in llama-server. Brief link: https://feed.craftedsignal.io/briefs/2026-08-06-llama-cpp-uaf/

CVE search record: CVE-2026-43631. Severity: high. CVSS: 8.1. KEV: no. Product: llama-server, llama-server (b7492 through b9060). Brief: Use-After-Free Vulnerability in llama-server. Brief link: https://feed.craftedsignal.io/briefs/2026-08-06-llama-cpp-uaf/

Triage facts

Revision 2
Applicability
llama-server, llama-server (b7492 through b9060)
Evidence
Unknown
Severity
High
Action
Elevated
Sources
2 public sources
Freshness
Revision 2Aug 6, 23:30 UTC
Vulnerabilities
2 CVEs
Source quality
A1Likely
Revision history 1 entry · Revision 2
  1. Revision 2

    Repaired a legacy canonical identity collision

    Changed: slug

CVE-2026-43632 is a use-after-free vulnerability affecting llama-server builds b7492 through b9060. The vulnerability resides in the handling of six specific tokenization-related endpoints: /tokenize, /detokenize, /infill, /apply-template, /rerank, and /anthropic/count_tokens. These endpoints bypass the standard task queue and access the 'ctx_server.vocab' memory structure directly from HTTP worker threads.

The issue stems from a time-of-check-time-of-use (TOCTOU) race condition. When the application is configured with the '--sleep-idle-seconds' flag, the main thread can destroy and free the vocabulary memory after the synchronization lock is released but before the HTTP worker thread has finished utilizing the reference. This leads to memory corruption, service crashes, or potential remote code execution if an attacker can reliably trigger the race condition while the server is transitioning into an idle state.

Impact

Successful exploitation of this vulnerability leads to denial-of-service via application crashes or potential remote code execution on the server hosting the llama-server instance. Given the prevalence of local LLM deployment, this represents a significant risk for organizations using llama-server as a backend component for AI-integrated services or private infrastructure, particularly when exposed to untrusted network traffic.

Recommendation

  • Update llama.cpp to a build version later than b9060 to mitigate CVE-2026-43632.
  • Monitor access logs for sustained, high-frequency requests to the identified tokenization endpoints, as these may indicate attempts to win the race condition.
  • Disable the '--sleep-idle-seconds' configuration flag in production environments until a patched build is deployed to eliminate the triggering condition for the race.

Immediate actions

Upgrade llama-server to build > b9060

IT Operations 48h

Mitigations

Remove --sleep-idle-seconds flag from server launch arguments

immediate IT Operations

CVE-2026-43632