Skip to content
CVE-2026-137567 Elastic Security · Elastic

Detect llama.cpp ggml RPC Server Out-of-Bounds Write (CVE-2026-137567) in Elastic Security

Detects exploitation attempts and exposure of the ggml RPC server in llama.cpp builds b11450 through b12657 (fixed in b12658), which contains an out-of-bounds write (CWE-787) in the RPC copy-tensor handler. The RPC server accepts unauthenticated connections and deserializes attacker-controlled tensor metadata. An attacker can learn buffer base addresses with BUFFER_GET_BASE, then send a COPY_TENSOR request with a zero-element destination tensor pointing below the buffer base to write to an arbitrary heap address, enabling memory corruption and potential remote code execution. Detection focuses on network exposure of the default RPC port (50052), anomalous process crashes of the rpc-server/llama-server binary, and unauthenticated inbound connections to the RPC listener.

MITRE ATT&CK

Tactic
Initial Access Execution

Elastic Detection Query

Elastic Security (Elastic)
eql
// df00tech DF00-8e571e1859 · https://df00tech.com/detections/CVE-2026-137567 · licence: https://df00tech.com/detections/licence
sequence by host.name with maxspan=5m
  [ network where destination.port == 50052 and network.direction == "inbound" and process.name in ("rpc-server","llama-server") ]
  [ process where event.type == "end" and process.name in ("rpc-server","llama-server") and (process.exit_code != 0 or endsWith(process.name, "rpc-server")) ]
high severity low confidence

Detects an inbound RPC connection to the ggml server followed by abnormal process termination, consistent with OOB-write-induced crashes.

Data Sources

Elastic DefendAuditbeat

Required Tables

logs-endpoint.events.networklogs-endpoint.events.process

False Positives & Tuning

  • Legitimate restarts of the RPC server during cluster scaling
  • Benign client disconnects causing graceful shutdown
  • Automated deployment tooling cycling the service

Other platforms for CVE-2026-137567


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.

  1. Test 1 Expose ggml RPC server on default port (lab)

    Expected signal: Listening socket on 0.0.0.0:50052 and inbound NetworkConnection events to the rpc-server process.

  2. Test 2 Unauthenticated TCP connection to RPC listener

    Expected signal: Inbound connection-accepted event on port 50052 recorded by EDR/network sensors.

  3. Test 3 Send malformed copy-tensor-style RPC payload (lab)

    Expected signal: RPC server segfault/core dump in dmesg/syslog correlated with the inbound connection.


Response Playbook

Triage

  1. Identify the affected host and confirm the running llama.cpp build version (check `rpc-server --version` or release tag); flag any build in the range b11450 through b12657 as vulnerable.
  2. Determine whether the ggml RPC server port (default 50052) is reachable from untrusted networks by reviewing firewall rules and listening-socket inventory (`ss -ltnp | grep 50052`).
  3. Correlate the source IP(s) of inbound RPC connections against known-good distributed-inference worker/client inventory; treat any external or unexpected source as suspicious.
  4. Review process-crash, segfault, and core-dump artifacts on the host around the time of the connection for signs of successful memory corruption.

Containment

  1. Restrict access to port 50052 to trusted management/inference subnets via host and network firewall rules, or bind the RPC server to localhost only.
  2. Stop the exposed rpc-server/llama-server process if it is internet-facing and not required, pending upgrade to b12658 or later.

Evidence Collection

  1. Capture a full packet capture of traffic to port 50052 and preserve any RPC request payloads for the copy-tensor handler.
  2. Collect core dumps, process memory, and system logs (dmesg/syslog) referencing rpc-server/llama-server crashes.
  3. Preserve the llama.cpp binary and build metadata to confirm the vulnerable version.

Escalation Criteria

  • !Escalate to incident response if a crash/core dump coincides with an external inbound RPC connection, indicating probable exploitation of the OOB write.
  • !Escalate if follow-on activity (new child processes, outbound C2, or persistence) is observed from the host running the RPC server.

Investigation Guide

Forensic Artifacts

  • >Core dumps and segfault entries in dmesg/syslog for rpc-server/llama-server
  • >Packet captures of RPC copy-tensor requests to port 50052
  • >llama.cpp build/version metadata and release tag
  • >Listening-socket records binding port 50052

Tuning Guidance

Baseline legitimate distributed-inference worker and client IPs and exclude them from alerting, focusing on connections from outside the trusted inference subnet. Prioritize alerts that correlate inbound RPC connections with process crashes. If the RPC server is intentionally exposed, reduce severity for internal sources but keep critical alerting for external/unknown sources until all hosts are upgraded to b12658+.


Hunting Queries

Enumerate all hosts exposing or receiving traffic on the ggml RPC port 50052 to scope exposure.

Hunting — KQL
kql
// df00tech DF00-8e571e1859 · https://df00tech.com/detections/CVE-2026-137567 · licence: https://df00tech.com/detections/licence
DeviceNetworkEvents | where LocalPort == 50052 or RemotePort == 50052 | summarize by DeviceName, InitiatingProcessFileName, RemoteIP, LocalPort
Hunting — SPL
spl
``` df00tech DF00-8e571e1859 · https://df00tech.com/detections/CVE-2026-137567 · licence: https://df00tech.com/detections/licence ```
index=* (dest_port=50052 OR src_port=50052) | stats count by dest_ip src_ip dest_port

Atomic Red Team Tests

Test 1 Expose ggml RPC server on default port (lab)
linux

Start a vulnerable-range llama.cpp rpc-server bound to all interfaces to validate network-exposure detection.

Command

bash
./rpc-server -H 0.0.0.0 -p 50052 &

Cleanup

bash
pkill -f 'rpc-server' || true

Expected Telemetry

Listening socket on 0.0.0.0:50052 and inbound NetworkConnection events to the rpc-server process.

Expected Detection

KQL/SPL/CQL network rules flag inbound connections to port 50052 from the rpc-server process.

Test 2 Unauthenticated TCP connection to RPC listener
linux

Establish a raw TCP connection to the ggml RPC port to simulate unauthenticated client probing.

Command

bash
timeout 5 bash -c 'cat < /dev/null > /dev/tcp/127.0.0.1/50052' ; echo connected

Cleanup

bash
true

Expected Telemetry

Inbound connection-accepted event on port 50052 recorded by EDR/network sensors.

Expected Detection

Network and EDR rules record an unauthenticated connection to the vulnerable RPC listener.

Test 3 Send malformed copy-tensor-style RPC payload (lab)
linux

Send an oversized/garbage payload to the RPC port to simulate a crafted copy-tensor request and induce a crash in a lab build.

Command

bash
python3 -c "import socket; s=socket.socket(); s.connect(('127.0.0.1',50052)); s.sendall(b'\xff'*4096); s.close()"

Cleanup

bash
pkill -f 'rpc-server' || true

Expected Telemetry

RPC server segfault/core dump in dmesg/syslog correlated with the inbound connection.

Expected Detection

Correlation rules flag an inbound RPC connection followed by abnormal rpc-server termination.

Related Detections