Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessReach exposed llama-server (--sleep-idle-seconds set)
-
DeliveryFlood /tokenize during idle window
-
ExploitWin TOCTOU race on freed vocab
-
ExecutionTrigger use-after-free on worker thread
-
ImpactCrash server or potential code execution
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture TOCTOU prevention
|
| Exploitation Conditions | Exploitation requires that llama-server be started with the --sleep-idle-seconds option enabled - this is the specific configuration that triggers main-thread destruction and freeing of ctx_server.vocab and is NOT a default setting. The attacker must send requests to one of the six vulnerable tokenization endpoints (/tokenize, /detokenize, /infill, /apply-template, /rerank, or /anthropic/count_tokens) and win a Time-of-Check-Time-of-Use race, hitting the window after the synchronization lock is released but before the handler finishes using vocab, precisely as the idle timer frees it. Limiting factors: the race is timing-dependent and difficult to win reliably (reflected in CVSS AC:H and AT:P), the server must be network-reachable, and non-idle-sleep deployments are not exploitable at all. No authentication (PR:N) or user interaction (UI:N) is required against a vulnerable instance. |
| Impact | The signals are mixed and should be read together. The CVSS 4.0 vector (AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H) yields 9.2 driven by network reach, no authentication, and high CIA impact, but the AC:H and AT:P metrics explicitly encode that exploitation requires winning a narrow timing race and meeting an environmental precondition - this is not a trivially reliable exploit. There is no EPSS score, no CISA KEV listing, and no confirmed public proof-of-concept in the provided data, so there is no evidence of active or automatable exploitation; the RCE tag reflects worst-case potential, not demonstrated code execution. Critically, the vulnerability is gated on the non-default --sleep-idle-seconds option, so most deployments are not exposed. Realistic outcome is a remotely triggerable crash (denial of service); the 'potential code execution' claim is plausible for a heap use-after-free but not independently demonstrated. Net: treat as a genuine high-severity issue for internet-exposed llama-server instances running idle-sleep, but a lower operational priority for default configurations. |
| Exploit ScenarioDerived | An attacker who can reach an internet-exposed llama-server started with --sleep-idle-seconds sends a high volume of rapid requests to a tokenization endpoint such as /tokenize while timing them to coincide with the idle-teardown window. If a request is being processed on a worker thread at the moment the main thread frees vocab, the handler dereferences freed memory, crashing the server or, in the worst case, corrupting heap state toward code execution. No authentication or user interaction is required, but success depends on winning the timing race, and no public proof-of-concept is currently known. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 06, 2026
Use-after-free in the llama-server component of llama.cpp (builds b7492 through b9060) lets remote unauthenticated attackers crash the server or potentially execute code by racing six tokenization endpoints (/tokenize, /detokenize, /infill, /apply-template, /rerank, /anthropic/count_tokens) that read ctx_server.vocab directly on HTTP worker threads instead of going through the task queue. The flaw is only reachable when the server is started with --sleep-idle-seconds, since idle-driven vocab teardown on the main thread is what frees the object mid-handler. No public exploit identified at time of analysis and it is not listed in CISA KEV; the CVSS 4.0 base score is 9.2 but real-world exploitation is constrained by a hard-to-win TOCTOU race.
RemediationAI
Patch available per third-party advisory: the referenced repository https://github.com/Vladimir-tokarev-cyera/llama-cpp-security-patches provides fixes routing the six endpoints through the task queue rather than accessing ctx_server.vocab directly; a specific patched llama.cpp build/tag was not provided and could not be independently confirmed, so upgrade to the latest official build once the fix is merged upstream and verify the tokenization endpoints no longer bypass synchronization. As an immediate compensating control, do not run llama-server with --sleep-idle-seconds - removing that flag eliminates the vocab teardown that frees the object mid-request and closes the race entirely, at the cost of keeping the model resident in memory (higher idle RAM/VRAM usage). Additionally, restrict network exposure of llama-server: bind to localhost or place it behind an authenticating reverse proxy and block direct internet access to /tokenize, /detokenize, /infill, /apply-template, /rerank, and /anthropic/count_tokens, since the endpoints are unauthenticated by design.
Affected VersionsENISA
Affects your stack
Find out whether the stacks and servers you run are on an affected version.
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
llama.cpp is a widely used C/C++ inference runtime for GGUF LLM models, and llama-server is its bundled HTTP server exposing REST endpoints for tokenization, templating, reranking, and generation. The root cause is CWE-367 (Time-of-Check Time-of-Use race condition): six endpoints short-circuit the normal task-queue synchronization and dereference the shared ctx_server.vocab object directly from HTTP worker threads. When --sleep-idle-seconds is configured, the main thread tears down and frees the model context (including vocab) after an idle window. Because the worker thread reads vocab after the synchronization lock is released but before it finishes using the pointer, the main thread can destroy and free that memory underneath an in-flight request, turning a benign read into a use-after-free on freed heap memory.
Know when Llama Cpp gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Network-reachable and unauthenticated (AV:N/PR:N), but AC:H reflects the hard-to-win TOCTOU race plus the non-default --sleep-idle-seconds precondition; heap UAF supports high CIA potential.
Primary rating from Vendor (vulncheck).
CVSS VectorVendor: vulncheck
DescriptionCVE.org
llama.cpp builds b7492 through the latest b9060 contains a use-after-free vulnerability in llama-server affecting six tokenization endpoints (/tokenize, /detokenize, /infill, /apply-template, /rerank, and /anthropic/count_tokens) that bypass the task queue and access ctx_server.vocab directly on HTTP worker threads. Attackers can exploit a time-of-check-time-of-use race condition where the main thread destroys and frees vocab after the synchronization lock is released but before the handler finishes using it, causing a crash or potential code execution when --sleep-idle-seconds is configured.
Executive ViewAI
llama.cpp's tokenization service components contain a use-after-free vulnerability (CVE-2026-43632, CVSS 9.2) affecting builds b7492 through b9060 that could allow remote attackers to crash the server or execute code. Organizations running llama-server with the --sleep-idle-seconds parameter are at risk of service disruption or system compromise affecting any AI inference workloads dependent on the affected service.
No vendor-released patch identified at time of analysis. Interim mitigation: immediately disable the --sleep-idle-seconds startup parameter on llama-server instances, which prevents the vulnerability trigger condition (idle-driven vocabulary teardown), and restrict network access to llama-server endpoints to trusted internal systems only.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
Arbitrary memory write in llama.cpp's RPC server allows remote unauthenticated attackers to corrupt arbitrary memory add
Remote code execution in llama.cpp (commit 18c2e17) is possible when a user opens a malicious .gguf model file, triggeri
Llama.cpp server endpoints fail to validate the n_discard parameter from JSON input, allowing negative values that trigg
Remote code execution in llama.cpp (commit 18c2e17) is possible when a victim loads a malicious .gguf model file, trigge
Remote code execution in llama.cpp (GGUF library) allows attackers to achieve arbitrary code execution by tricking a use
Remote code execution in llama.cpp (commit 18c2e17) occurs when the GGUF library's gguf_fread_str function parses a mali
Heap-based buffer overflow in llama.cpp's GGUF library header parser (commit 18c2e17) enables code execution when a vict
CVE-2025-52566 is a signed vs. unsigned integer overflow vulnerability in llama.cpp's tokenizer (llama_vocab::tokenize f
Remote code execution in llama.cpp RPC backend allows unauthenticated attackers with TCP access to achieve arbitrary mem
llama.cpp provides LLM inference in C/C++. Rated medium severity (CVSS 5.3), this vulnerability is remotely exploitable,
Heap buffer overflow in llama.cpp's server KV cache state-restore path (builds b4882 through b9058) lets an attacker who
Stack-based out-of-bounds write in llama.cpp's ggml-rpc RDMA receive path (builds b8841 through b11865) lets unauthentic
EUVD-2026-54287
GHSA-3f2h-96vw-c84x
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB