llama.cpp ggml-rpc RDMA Stack Overflow (CVE-2026-118375)
llama.cpp before b11865 copies up to 256 KiB of RDMA data into a 1-byte stack variable, letting a remote peer corrupt the RPC server (Critical 9.2).
TL;DR
- A missing bounds check in the ggml-rpc RDMA receive path copies up to 256 KiB into a 1-byte stack variable.
- The CVE record lists llama.cpp builds b8841 through b11864 as affected. The fix shipped in b11865 on 2026-10-24.
- The record scores the flaw CVSS v4.0 9.2 Critical. No exploitation in the wild is known, and it is not in CISA KEV as of 2026-11-20.
- Upgrade to b11865 or later, or start the RPC server with
GGML_RPC_NO_RDMA=1until you can.
Am I affected?
All of these conditions must hold for a deployment to be exposed:
- You run a llama.cpp build in the range b8841 through b11864, or an older build that carries the RDMA transport.
- The build has the RPC backend and the Linux RDMA transport enabled:
GGML_RPC=ON,GGML_RPC_RDMA=ON, andlibibverbsfound at configure time. - A
ggml-rpc-serverprocess is reachable by an untrusted peer over TCP, not only from localhost. - The server has an RDMA-capable device, and the peer can complete an RDMA handshake with its own queue pair.
| Branch | Affected builds | Fixed build |
|---|---|---|
| llama.cpp | b8841 through b11864 | b11865 |
The record starts at b8841, the build that moved the RPC transport into transport.cpp. The build immediately before it, b8840, carries the same unchecked memcpy in ggml-rpc.cpp. The lower bound marks the refactor, not a change in the code's safety, so upgrade any build older than b11865 that has the RDMA transport.
The standalone ggml 0.27.0 tag still has the vulnerable loop. The 0.28.0 release on 2026-10-28 carries the check.
RDMA is negotiated during HELLO. The server switches to the RDMA receive path only when both sides advertise non-zero capabilities, so a TCP-only build does not reach this bug. The server binds to 127.0.0.1:50052 by default and prints a warning when the host is not 127.0.0.1. The project's RPC README calls the backend a proof-of-concept and says never to run the server on an open network.
Check the build and the transport:
# Build number of the source checkout
git -C llama.cpp describe --tags --always
# Was the RPC backend and RDMA compiled in?
cmake -LA -N build | grep -E 'GGML_RPC(:BOOL|_RDMA:BOOL)'
# Does the server link an RDMA provider?
ldd build/bin/ggml-rpc-server | grep -E 'ibverbs|rdma'
# Is the server listening beyond loopback?
ss -lntp | grep ':50052'
The RPC server does not print a build number. The release archive name, the package version or the source checkout is the reliable source.
How do I fix it?
Upgrade to llama.cpp b11865 or later and restart every RPC server process. The current release on 2026-11-20 is b12590.
- Update the source checkout and rebuild the server and its clients:
git -C llama.cpp fetch --tags
git -C llama.cpp checkout b12590
cmake -S llama.cpp -B build -DGGML_RPC=ON
cmake --build build --config Release
- If you use release binaries, replace
ggml-rpc-serveron every RPC host with the b11865 or later archive, then restart the service. - If you use containers, pull the new image and recreate the container. A restart alone keeps the old binary.
- Confirm the new process is running and the RPC port is still reachable only where you expect it.
If you cannot upgrade yet, disable the RDMA transport on the server:
- Start the server with RDMA turned off:
GGML_RPC_NO_RDMA=1 ggml-rpc-server -H 127.0.0.1 -p 50052
- Or rebuild with
-DGGML_RPC_RDMA=OFF. - Keep the RPC port on loopback or a trusted network. The protocol has no authentication, so network isolation is the only access control.
The workaround removes the RDMA receive path, so the vulnerable memcpy is not reached. It gives up RDMA latency and throughput, and it does not fix other RPC issues.
The fix is commit 9a0fde9 in pull request #30399.
What is the root cause?
The RDMA receive function copies a completion of wc.byte_len bytes into the caller's buffer without checking that the completion fits. When the caller asks for 1 byte, a completion of up to 256 KiB overflows the 1-byte stack variable and underflows the remaining-byte counter.
ggml-rpc is the transport that lets a llama.cpp process use devices on another machine. A client sends tensors and graph commands to ggml-rpc-server, and the server runs them on its local GPU or CPU. On Linux, the transport can upgrade from TCP to RDMA over RoCE or InfiniBand after the HELLO handshake.
The receive loop is in ggml/src/ggml-rpc/transport.cpp:440-453 at the b8841 tag:
bool socket_t::impl::rdma_recv(void * data, size_t size) {
rdma_conn * c = rdma.get();
uint8_t * dst = (uint8_t *)data;
size_t rem = size;
while (rem > 0) {
struct ibv_wc wc;
if (!rdma_poll(c->rcq, &wc)) return false;
int slot = (int)wc.wr_id;
size_t got = wc.byte_len;
memcpy(dst, c->rx_slot(slot), got);
if (!c->post_rx(slot)) return false;
dst += got;
rem -= got;
}
return true;
}
data and size are the caller's buffer and the exact byte count it expects. rem tracks how many bytes are still missing. rdma_poll returns one completion from the receive queue. wc.byte_len is the length of the message the remote peer sent, not the length the caller asked for.
The memcpy uses got without comparing it to rem. Then dst += got moves the write pointer past the caller's buffer. rem -= got wraps to a huge value when got is larger than rem.
The caller is the first read of the RPC command loop in ggml/src/ggml-rpc/ggml-rpc.cpp:2437-2438:
uint8_t cmd;
if (!sock->recv_data(&cmd, 1)) {
return;
}
cmd is a single byte on the stack. recv_data dispatches to rdma_recv when the connection was upgraded, so size is 1 while the completion can be 256 KiB. Each receive slot is RDMA_CHUNK bytes, and RDMA_CHUNK is 256 * 1024.
The upgrade is decided by the HELLO request. rpc_msg_hello_req carries a 24-byte capabilities block: a queue pair number, a packet sequence number and a 16-byte GID. A peer that sets those fields to non-zero values makes the server call rdma_activate and switch recv_data to the RDMA path.
How is it exploited?
An attacker who can reach an RDMA-enabled RPC server completes the HELLO handshake with non-zero capabilities, then sends one completion that is larger than the 1-byte command buffer.
- Reach the RPC server's TCP port. The default endpoint is 127.0.0.1:50052. A deployment that binds
-H 0.0.0.0or a routable address exposes it to the network. - Send a HELLO with non-zero RDMA capabilities. The client sends command 14, the 8-byte size of the HELLO request (24), and a 24-byte capabilities block with a real queue pair number, packet sequence number and GID.
- Let the server activate its queue pair.
update_capsmoves the server's QP to the ready-to-receive and ready-to-send states using the attacker's values. - Send one RDMA SEND completion of up to 256 KiB. The server's receive ring has 24 slots of 256 KiB each, and one slot is enough.
- The next
recv_data(&cmd, 1)copies the whole completion into the 1-bytecmd. The stack is overwritten before any check. - The server crashes, or continues with corrupted stack state. The remaining-byte counter underflows, so the loop does not stop after the first copy.
The fix author reproduced the overflow with AddressSanitizer on a SoftRoCE device. Sending more than 1 byte for cmd produced a stack-buffer-overflow in memcpy without the check. With the check, the connection drops cleanly.
SoftRoCE (rxe) is a software RDMA provider in the Linux kernel, so an attacker does not need a physical RoCE NIC. The server still needs an RDMA device.
How does the attack flow?
An attacker who can reach an RDMA-enabled RPC server advertises RDMA in HELLO and sends a 256 KiB completion. The unchecked copy then overflows the 1-byte command variable on the server's stack.
What can an attacker do?
A single completion can crash the RPC server, which drops every client that depends on its remote devices.
The overwrite is attacker-controlled and can be up to 256 KiB. The CVE record says it can potentially execute code in the server process. No public exploit demonstrates code execution.
Code execution would run with the RPC server's privileges. The server can access the accelerator devices it exposes and the local cache it was started with.
Every condition from "Am I affected?" applies here in full: an RDMA-enabled build, an RDMA-capable server, an RDMA-capable peer, network reachability and a server bound beyond loopback. The protocol has no authentication, so any peer that can connect can attempt the handshake.
The demonstrated impact is a stack-buffer-overflow and a crash. Code execution is potential, not demonstrated.
Why does the fix work?
The fix rejects a completion that is larger than the caller's remaining buffer before the copy, so the stack write never happens.
The patch, from transport.cpp at b11865:
int slot = (int)wc.wr_id;
size_t got = wc.byte_len;
+ if (got > rem) {
+ LOG_ERROR("RDMA recv overrun: got=%zu rem=%zu\n", got, rem);
+ c->post_rx(slot);
+ return false;
+ }
memcpy(dst, c->rx_slot(slot), got);
if (!c->post_rx(slot)) return false;
rem is the exact number of bytes still expected. got > rem means the completion is larger than the caller's buffer. The check runs before memcpy, so the copy never happens. It reposts the slot so the receive ring is not depleted when the connection is rejected. It returns false, so recv_data fails and rpc_serve_client returns, which closes the connection.
The check is complete for this function on Linux. Every RDMA receive goes through rdma_recv, and the TCP path reads exactly the requested size. The fix does not change the protocol or the handshake. A fixed server still accepts RDMA peers and still rejects a completion that is larger than the caller's buffer.
How do I check if I was compromised?
Start with the exposure and crash checks, then review the server log for the RDMA upgrade.
# Was the server reachable beyond loopback?
ss -lntp | grep ':50052'
# Did the process crash? (systemd-coredump)
coredumpctl list ggml-rpc-server
# Did the server negotiate RDMA? This is a normal log line, not an attack indicator.
journalctl -u ggml-rpc-server | grep 'RDMA activated'
No public indicators of compromise are published for CVE-2026-118375. An RDMA activated line shows the server took the vulnerable path at least once. It does not prove an attack. A crash immediately after an inbound connection is a lead. A single oversized completion can leave no other trace.
If the server never negotiated RDMA, the vulnerable receive path was not used. Check the logs from before the upgrade.
Timeline
- 2026-04-19: llama.cpp b8841 is released, and the RPC transport moves into
transport.cpp. - 2026-10-12: Sohaib Harraoui opens fix pull request #30399.
- 2026-10-24: Pull request #30399 merges as commit 9a0fde9, and b11865 is released.
- 2026-10-28: CVE-2026-118375 is published, and ggml 0.28.0 is released.
- 2026-11-03: CISA publishes its Vulnrichment assessment: Exploitation none, Automatable no, Technical Impact total.
- 2026-11-20: CISA KEV catalog 2026.11.18 is checked, and it has no entry for the CVE.
FAQ
Does CVE-2026-118375 affect llama-server or only ggml-rpc-server?
The vulnerable listener is ggml-rpc-server. llama-server and llama-cli are clients that connect to it with --rpc. If you run llama-server without an RPC backend, you do not expose this listener.
Is RDMA enabled by default?
Yes, on Linux, when CMake finds libibverbs at configure time. The GGML_RPC_RDMA option defaults to ON in that case. The transport is negotiated at HELLO, so both peers must support RDMA for the connection to upgrade.
Can an attacker exploit it over plain TCP?
No, this bug is in the RDMA receive path. The TCP recv_data loop reads exactly the requested number of bytes. The RPC protocol still has no authentication, so other risks remain on a TCP connection.
Does a stack protector stop the attack?
A stack canary may turn the overwrite into an abort, but the memcpy runs before the canary check. It does not prevent the overflow. Whether the process aborts or the corrupted state is exploitable depends on the build and the memory layout.
Is CVE-2026-118375 exploited in the wild?
No exploitation in the wild is known as of 2026-11-20. CISA's Vulnrichment record says Exploitation none and Automatable no, and the CVE is not in the CISA KEV catalog.
What if I cannot upgrade right away?
Set GGML_RPC_NO_RDMA=1 on the server and restart it, or rebuild with -DGGML_RPC_RDMA=OFF. Keep the RPC port on loopback or a trusted network until you can install b11865 or later.
Find vulnerable llama.cpp builds with Ostorlab
Sohaib Harraoui found and fixed this flaw, and Ostorlab's software composition analysis inventories the open-source components and versions in your repositories, so you can find llama.cpp and ggml builds that predate b11865. Start at Ostorlab SCA and SBOM.
References
- CVE-2026-118375 record, VulnCheck: https://www.cve.org/CVERecord?id=CVE-2026-118375 (checked November 20, 2026)
- llama.cpp fix pull request #30399, "rpc : add bounds check in rdma_recv": https://github.com/ggml-org/llama.cpp/pull/30399 (checked November 20, 2026)
- Fix commit 9a0fde9967fa1a35b6e5dd1f47e1a3648b6fecc1: https://github.com/ggml-org/llama.cpp/commit/9a0fde9967fa1a35b6e5dd1f47e1a3648b6fecc1 (checked November 20, 2026)
- llama.cpp b11865 release notes: https://github.com/ggml-org/llama.cpp/releases/tag/b11865 (checked November 20, 2026)
- llama.cpp b8841 release notes: https://github.com/ggml-org/llama.cpp/releases/tag/b8841 (checked November 20, 2026)
- Vulnerable
rdma_recvat b8841: https://github.com/ggml-org/llama.cpp/blob/b8841/ggml/src/ggml-rpc/transport.cpp (checked November 20, 2026) - Same unchecked copy in b8840: https://github.com/ggml-org/llama.cpp/blob/b8840/ggml/src/ggml-rpc/ggml-rpc.cpp (checked November 20, 2026)
- Fixed
rdma_recvat b11865: https://github.com/ggml-org/llama.cpp/blob/b11865/ggml/src/ggml-rpc/transport.cpp (checked November 20, 2026) - RPC command loop at b11865: https://github.com/ggml-org/llama.cpp/blob/b11865/ggml/src/ggml-rpc/ggml-rpc.cpp (checked November 20, 2026)
- RPC transport capabilities at b11865: https://github.com/ggml-org/llama.cpp/blob/b11865/ggml/src/ggml-rpc/transport.h (checked November 20, 2026)
- RPC build options at b11865: https://github.com/ggml-org/llama.cpp/blob/b11865/ggml/src/ggml-rpc/CMakeLists.txt (checked November 20, 2026)
- RPC server source and default endpoint at b11865: https://github.com/ggml-org/llama.cpp/blob/b11865/tools/rpc/rpc-server.cpp (checked November 20, 2026)
- RPC README, including the RDMA section and the warning: https://github.com/ggml-org/llama.cpp/blob/b11865/tools/rpc/README.md (checked November 20, 2026)
- ggml 0.28.0 release: https://github.com/ggml-org/ggml/releases/tag/v0.28.0 (checked November 20, 2026)
- llama.cpp repository, 135,844 stars on 2026-11-20: https://github.com/ggml-org/llama.cpp (checked November 20, 2026)
- CISA Known Exploited Vulnerabilities catalog, version 2026.11.18: https://www.cisa.gov/known-exploited-vulnerabilities-catalog (checked November 20, 2026)