llama-server sleep mode: use-after-free with remote code execution risk, fixed in b12340 (CVE-2026-131837)
TL;DR When llama-server runs with --sleep-idle-seconds, a request that arrives just as the server goes idle can keep using memory the server has already freed. ZDI rates it 8.1, with no authentication needed. The fix landed on Nov 12 and is in build b12340 and later. Servers that don't use sleep mode don't run this code.
In plain words: llama-server has an optional “sleep” mode that unloads the model after a period of no use to free memory. If a request arrives at exactly the wrong moment, the server can unload the model while that request is still using it. An attacker who can reach the server could use that moment to crash it or try to run their own code. A fix has been out since mid-November.
What happened
The Zero Day Initiative published ZDI-26-1079 / CVE-2026-131837 on Nov 24: a use-after-free in llama.cpp’s server, triggered “during the server’s sleep transition”. It is rated CVSS 8.1 (network, high attack complexity, no authentication, no user interaction). It was reported to the project in May.
The fix, pull request #32133, keeps the server awake until every request in flight has finished. It was merged on Nov 12 and first shipped in build b12340. The PR describes the bug: with --sleep-idle-seconds, a request that arrives just before the idle timer fires can still be using the model’s vocabulary when the server frees it. In the PR author’s test, a slow /tokenize request sent right after startup read freed memory in three out of three runs without the fix.
No exploitation in the wild has been reported.
Who is affected
- Anyone running
llama-serverwith--sleep-idle-secondson a build older than b12340, where untrusted clients can reach the HTTP port. - Servers started without sleep mode don’t take this code path. Build-number checks alone can be misleading for forks and prebuilt bundles.
Why it matters
Sleep mode is attractive on shared home or office machines, where one GPU serves several tools and memory has to be given back when idle. Those are also the setups where the server port is often left open on the LAN. Together with the RPC server bug fixed in b12658 this week, it is a reminder that local inference servers are network services and need the same patching discipline.
What to do
- Check whether any of your
llama-serverlaunch scripts or services use--sleep-idle-seconds. - Update llama.cpp to b12340 or newer. To also cover the RPC server fix (CVE-2026-137567), go to b12658 or newer.
- If you can’t update yet, remove
--sleep-idle-seconds. - Bind
llama-serverto localhost or a private interface, or put an authenticated reverse proxy in front of it. Don’t expose it to the internet. - If you use a fork or a bundled build, ask its maintainer whether it includes PR #32133.