Cross-engine TEE security study · 4 stock engines · 1 December 2026

The 4-Engine Silent Log-Leak & KV-Cache Trap: SGLang, vLLM, llama.cpp & Ollama

Hardware memory encryption (AMD SEV-SNP, Intel TDX, NVIDIA Confidential Computing) stops a cloud hypervisor from reading RAM—it does not stop a stock inference engine from printing user prompts, tool calls, JSON schemas, or media URLs straight to stdout/stderr, or silently reusing another tenant's KV cache. Prompted by Modal's 30 November 2026 SGLang ZDR redaction PRs (85 files), we audited all four major open-source LLM inference engines used inside confidential-AI enclaves—SGLang, vLLM (02e6ff8), llama.cpp llama-server (e5cd6e3), and Ollama (97e8beb)—and found that 4 / 4 stock engines leak sensitive prompt/output data or cross-tenant KV prefixes even when request logging is turned off.

Key Findings Across All 4 Stock Engines (1 December 2026, Exact file:line Citations):

  • SGLang (85 files across 3 open upstream PRs): Even with --log-requests OFF, watchdog stalls dump full batch input_ids/output_ids/schemas; 47 tool-parser files log raw model tool calls; error paths dump raw schemas, stop_regex, image URLs, and logger.exception tracebacks (§2).
  • vLLM (02e6ff8 — 95+ unguarded sites): Even with --no-enable-log-requests, enable_log_outputs=False, and log_error_stack=False, stock vLLM has zero global log-redaction filter—unconditionally logging raw client media URLs (including presigned S3 tokens & Confer's ek= AES keys) at WARNING, dumping SamplingParams/token IDs/torch.Tensor reprs via dump_engine_exception, logging raw tool-call text across 54 parser sites, and bypassing log_error_stack=False in 23 logger.exception handlers (§3).
  • llama.cpp (llama-server @ e5cd6e3): At default verbosity (3), dumps full GBNF grammar + generation prompt, unparsed assistant/tool-call output, user tool JSON, Anthropic system strings, and full remote media URLs. CRITICAL bypasses: json-schema-to-grammar.cpp:1052 writes raw fprintf(stderr, ...) bypassing --log-disable; --no-cache-prompt is bypassable via client JSON "cache_prompt": true (server-schema.cpp:33, 500) while 8 GiB prompt_cache saves idle slots unconditionally; default-on GET /slots exposes integer n_prompt_tokens_cache (and plaintext prompts if host sets LLAMA_SERVER_SLOTS_DEBUG=1); and global /v1/stream buffers 4 MiB of SSE output across tenants (§4).
  • Ollama (97e8beb — powering Secret AI & Marlin Oyster): Now spawns llama-server unconditionally with --log-verbosity 4 (TRACE) even at OLLAMA_DEBUG=0 and forwards all child stdout/stderr to os.Stderr; a runner-global 8 KiB StatusWriter.lastErrMsg buffer leaks Tenant A's error lines into Tenant B's HTTP response; CachePrompt: true is hardcoded with zero opt-out alongside an exact integer prompt_eval_cached_count oracle; POST /api/pull (insecure: true) enables unauthenticated SSRF; and :cloud models silently proxy out of the TEE to ollama.com (§5).

1. Side-by-Side 4-Engine Vulnerability Matrix

Engine & Revision Default-Verbosity Prompt / Output / URL Leaks “No-Log” / Quiet Mode Bypasses Per-Tenant cache_salt Cross-Tenant KV Sharing & Opt-Out TEE Surface Traps
SGLang
PRs #51356, #54176, #54177
Yes (85 files)
Watchdog stalls dump batch input_ids/output_ids/schemas; 47 tool parsers + error URLs/regexes
--log-requests OFF still emits watchdog dumps, tool-parser warnings & logger.exception tracebacks No
(Global RadixAttention tree)
ON by default
Requires --disable-radix-cache; --enable-cache-report leaks cached_tokens
Debug/flush/profile HTTP routes unless stripped at AST build time (Confidential.ai pattern)
vLLM
02e6ff8
Yes (95+ sites)
Media URLs at WARNING; dump_engine_exception tensors/schemas; 54 tool-parser sites; 23 logger.exception
--no-enable-log-requests + enable_log_outputs=False + log_error_stack=False leave all 95+ sites active Yes
cache_salt (must be enforced & stripped by TEE proxy)
V1 APC ON by default
Must pass --no-enable-prefix-caching (Confer bug!) or enforce tenant cache_salt
Unbounded multimodal URL fetch + media-cache uuid sharing unless stripped (Maple pattern)
llama.cpp
llama-server @ e5cd6e3
Yes (8+ sites)
Grammar+prompt (sampling.cpp:316), unparsed output (chat.cpp:1971), tool JSON, Anthropic system, media URLs
json-schema-to-grammar.cpp:1052 raw fprintf(stderr) bypasses --log-disable; host env vars override verbosity None Bypassable opt-out
Client JSON "cache_prompt": true overrides --no-cache-prompt; 8 GiB RAM cache saves unconditionally
Default-on GET /slots (LLAMA_SERVER_SLOTS_DEBUG=1 dumps plaintext!), GET /props, global 4 MiB /v1/stream, public URL fetch ignores --offline
Ollama
97e8beb
Yes (Amplified)
Unconditionally runs llama-server --log-verbosity 4 (TRACE) & forwards all stderr; cross-tenant lastErrMsg
No quiet flag disables llama-server --log-verbosity 4; OLLAMA_DEBUG_LOG_REQUESTS=1 writes bodies to /tmp/; os.Environ() inherited None Hardcoded ON
CachePrompt: true hardcoded (llama_server.go:1750, 2373); returns integer prompt_eval_cached_count
Zero built-in auth; unauth SSRF on POST /api/pull (insecure: true); silent :cloud proxy to ollama.com; unauth localhost child; DefaultServeMux/pprof

2. Stock SGLang (85 files across 3 still-open upstream PRs)

As part of Modal's 30 November 2026 ZDR audit, Modal opened three upstream PRs against sgl-project/sglang (#51356, #54176, #54177) touching 85 files. Even when operators explicitly pass --log-requests OFF, stock SGLang still logs customer payloads on non-happy paths: the watchdog stalls handler dumps full active batch input_ids, output_ids, and JSON schemas to logs; 47 tool-call parser files emit raw generated tool-call text on parse failures; request validation errors log raw schemas, stop_regex, and image URLs; and unredacted logger.exception calls leak local frame strings.

3. Stock vLLM (vllm-project/vllm @ 02e6ff8 — 95+ unguarded leak sites)

Auditing stock vLLM (02e6ff8) revealed the exact same architectural flaw with zero global log-redaction filter. Even with --no-enable-log-requests, enable_log_outputs=False, and log_error_stack=False:

4. Stock llama.cpp (llama-server @ e5cd6e3)

5. Stock Ollama (ollama/ollama @ 97e8beb)

Stock Ollama (powering Secret AI and Marlin Oyster examples) retired its legacy runners for GGUF models and now spawns upstream llama-server (b12816) as a managed subprocess—inheriting and amplifying every llama-server leak above:

6. Concrete TEE Builder Hardening Checklist

How to actually stop engine log & KV leaks inside a confidential VM:

  1. Discard raw engine stdout/stderr in RAM: Never ship inference engine logs or journald off-enclave. Wrap the engine under a RAM-only pipe supervisor that drops raw engine bytes (like Confidential.ai's wait_for_model.py:287–400 or tee.launch_policy.log_redirect="never") and emit only closed-vocabulary metric enums.
  2. Scrub & measure the full child environment: Clear os.Environ() before spawning engine subprocesses so host-injected debug vars (LLAMA_ARG_LOG_VERBOSITY, LLAMA_SERVER_SLOTS_DEBUG, OLLAMA_DEBUG_LOG_REQUESTS) cannot turn on plaintext dumps without changing the measured attestation digest.
  3. Enforce KV isolation at the TEE proxy boundary: For vLLM/SGLang, strip caller cache_salt and multimodal media-cache uuids and inject HMAC-derived tenant salts (or disable prefix caching via --no-enable-prefix-caching / --disable-radix-cache). For llama-server, pass --no-cache-prompt --cache-ram 0 --no-cache-idle-slots --slot-prompt-similarity 0.0 -np 1, strip client cache_prompt/id_slot/X-Conversation-Id headers at the proxy, block /slots & /props & /v1/stream, and erase slot 0 after every request (as in our llmverify/tee.py demo).
  4. Disable outbound media fetching & cloud proxies inside the enclave: Reject non-data: image URLs (or use a strict dial-time IP-pinned client with ip.Unmap() and zero redirects) and never expose unauthenticated engine ports on non-loopback interfaces.

Automate this check in CI or enclave entrypoints:

llmverify privacy --engine sglang -- --disable-radix-cache
llmverify privacy --engine vllm -- --disable-log-requests
llmverify privacy --engine llama-server -- --log-disable
llmverify privacy --engine ollama --env GIN_MODE=release --env OLLAMA_DEBUG=0

Related audits & offline verifiers

Landscape scorecard · 20 stacks
State of Confidential AI (21-Provider Audit) →

Side-by-side audit across Tinfoil, Maple, Privatemode, Confer, Confidential.ai, TrustedRouter, Oasis ROFL, LibertAI/Aleph, OpenGradient, Phala, 0G, Secret AI, Nillion, Proton Lumo, Darkbloom, Marlin Oyster, Targon SN4, NEAR, Chutes & Venice.

Live reference · 4/4 Silicon Roots
Offline Browser Verifier (SEV-SNP, TDX, GPU & Nitro) →

Verify live AMD SEV-SNP, Intel TDX DCAP v4/v5, NVIDIA Hopper/Blackwell SPDM + signed XML-DSig RIMs, and AWS Nitro COSE_Sign1 100% locally in WebCrypto.

Interactive simulator · 7 levels
Break the Confidential AI Enclave! →

Toggle real defenses against 7 live-modeled TEE glue-code & cross-root GPU-splice attacks (including the silent engine stderr trap) right in your browser.

Part of LLM Verification · 21-Provider TEE Scorecard · All case studies · GitHub