Skip to main content

llama.cpp CVE-2026-43632

| EUVDEUVD-2026-54287 CRITICAL
Time-of-check Time-of-use (TOCTOU) Race Condition (CWE-367)
2026-08-06 disclosure@vulncheck.com GHSA-3f2h-96vw-c84x
9.2
CVSS 4.0 · Vendor: vulncheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Reach exposed llama-server (--sleep-idle-seconds set)
  2. Delivery
    Flood /tokenize during idle window
  3. Exploit
    Win TOCTOU race on freed vocab
  4. Execution
    Trigger use-after-free on worker thread
  5. Impact
    Crash 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.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
No patch listed yet 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

llama.cpp b7492 ≤b9060

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

Vendor (vulncheck) PRIMARY 9.2 CRITICAL
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
vuln.today AI 8.1 HIGH

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.

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
4.0 AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
SUSE HIGH
Red Hat 8.1 HIGH

Primary rating from Vendor (vulncheck).

CVSS VectorVendor: vulncheck

Attack Vector
Network
Attack Complexity
High
Attack Requirements
Present
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

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

Why It Matters

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.

Business Impact: High
Compensating Controls

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

EPSS Score
0.3%
Top 78% exploitable
Prevalence
High
llama.cpp is a leading open-source LLM inference runtime, very widely deployed
Data Quality
9 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment Vendor CIRCL GitHub VulDB

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.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS 0.3%
Patch available No
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

46
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +46
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

CVE-2024-42479 CRITICAL POC
10.0 Aug 12

Arbitrary memory write in llama.cpp's RPC server allows remote unauthenticated attackers to corrupt arbitrary memory add

CVE-2024-21802 HIGH POC
8.8 Feb 26

Remote code execution in llama.cpp (commit 18c2e17) is possible when a user opens a malicious .gguf model file, triggeri

CVE-2026-21869 HIGH POC
8.8 Jan 08

Llama.cpp server endpoints fail to validate the n_discard parameter from JSON input, allowing negative values that trigg

CVE-2024-21825 HIGH POC
8.8 Feb 26

Remote code execution in llama.cpp (commit 18c2e17) is possible when a victim loads a malicious .gguf model file, trigge

CVE-2024-23605 HIGH POC
8.8 Feb 26

Remote code execution in llama.cpp (GGUF library) allows attackers to achieve arbitrary code execution by tricking a use

CVE-2024-23496 HIGH POC
8.8 Feb 26

Remote code execution in llama.cpp (commit 18c2e17) occurs when the GGUF library's gguf_fread_str function parses a mali

CVE-2024-21836 HIGH POC
8.8 Feb 26

Heap-based buffer overflow in llama.cpp's GGUF library header parser (commit 18c2e17) enables code execution when a vict

CVE-2025-52566 HIGH POC
8.6 Jun 24

CVE-2025-52566 is a signed vs. unsigned integer overflow vulnerability in llama.cpp's tokenizer (llama_vocab::tokenize f

CVE-2026-34159 CRITICAL
9.8 Apr 01

Remote code execution in llama.cpp RPC backend allows unauthenticated attackers with TCP access to achieve arbitrary mem

CVE-2024-42478 MEDIUM POC
5.3 Aug 12

llama.cpp provides LLM inference in C/C++. Rated medium severity (CVSS 5.3), this vulnerability is remotely exploitable,

CVE-2026-43629 CRITICAL
9.2 Aug 06

Heap buffer overflow in llama.cpp's server KV cache state-restore path (builds b4882 through b9058) lets an attacker who

CVE-2026-118375 CRITICAL
9.2 Oct 28

Stack-based out-of-bounds write in llama.cpp's ggml-rpc RDMA receive path (builds b8841 through b11865) lets unauthentic

Vendor StatusVendor

SUSE

Severity: Important

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy