NEAR AI GPU TEE: KV-cache side-channel, ignored opt-outs, and blind secret extraction
Hardware GPU Trusted Execution Environments (Intel TDX + NVIDIA H200 Confidential Computing) protect
encrypted VRAM from the host operator—not from co-tenants sharing an unpartitioned prefix cache inside the
enclave's inference server. While our cross-provider probes confirm that near-ai genuinely runs its
own isolated TEE GPUs (0% bleed against Venice, Baseten, DeepInfra, CoreWeave, and AkashML),
all 4 of 4 live NEAR AI endpoints on OpenRouter leave automatic KV prefix caching on at
94.2–99.9% for at least 3 full minutes idle, silently ignore all 6 standard
opt-out/isolation flags, and allow 100% blind extraction of templated secrets using either
cached_tokens or pure TTFT timing—including 1-of-12 M&A stock tickers for $0.0033
in 13.95 s.
Executive Summary — Key Findings at a Glance:
94.2%–99.9%Cross-Tenant KV-Cache Bleed Inside Live GPU TEEs: All4 / 4live NEAR AI GPU TEE endpoints on OpenRouter leave shared prefix caching active for≥3–4 minutesidle—even across completely separate OpenRouter accounts on different networks (full table).100%Blind Timing-Only Secret Extraction ($0.0033): Using pure TTFT latency with zero overlap (AUC = 1.000)—nocached_tokensfield needed—an attacker extracted a 1-of-12 M&A stock ticker for$0.0033in13.95 sand3 / 3templated medical codes (interactive replay).- All
7 / 7Opt-Out & Isolation Flags Silently Ignored: Passingcache_salt,store: false,user, or provider cache-disable controls on OpenRouter has zero effect on KV bleed (details). - Why GPU TEEs Still Leak (Root Cause & Who's Exposed): Hardware TEEs protect memory from the host operator, not from co-tenants sharing one unisolated GPU prompt cache—so anyone routing through a shared org key (such as OpenRouter) or using NEAR AI's third-party Chutes/Tinfoil TEE models leaks prompt-prefix hits across separate customers, letting another user detect whether you just sent a known template or secret (code audit · fleet X-ray).
- Honest Credit & Verified Defense: NEAR-native enclaves genuinely run isolated Intel TDX + NVIDIA H200 TEEs (
0%cross-provider bleed against Venice/Baseten/DeepInfra/CoreWeave/AkashML) and cryptographically bind pinned@sha256container digests into Intel TDXmr_config_id; prepending a random client-side nonce cuts KV bleed to0.0%(fix).
- Why a GPU TEE still leaks KV-cache state (threat boundary diagram)
- Source-code root cause: auditing
nearai/cloud-api,inference-proxy, & live TDX/H200 attestation - Live 65-model fleet X-ray:
attested 3pChutescache_saltomission, GPU packing, &gpt-oss-120bHTTP 400 - Interactive replay: 1-of-12 ticker & 3/3 medical-code extraction (cache + timing only)
- Zero-overlap timing oracle (
AUC = 1.000) & 3–4 minute uncontaminated idle TTL - All 4/4 NEAR AI TEE models & all 7/7 silently ignored opt-outs (incl.
cache_salton OpenRouter) - 7-axis security & fidelity battery: live multi-turn role forgery, ignored
stop, & logprob honesty - Practical threat model: what attackers CAN and CANNOT read
- Verified client-side defense (
0.0%bleed) & exact Rust/OpenRouter fix - Scope, honest boundaries, and open questions
94.2–99.9% cached tokens across distinct user IDs (16, 64, and 128-token blocks)user, prompt_cache_key, cache_salt, cache_prompt: false, store: false, zdr: true, temperature)13.95 s) to blindly extract 1-of-12 stock tickers (GOOG) inside the TEE via cache or TTFT timing alone (525 ms vs 946–1,338 ms)99.5% hot at 180.0 s idle; evicted by 240.0 s)—dropped to 0.0% by a leading 128-bit nonce1. Why a GPU TEE still leaks KV-cache state
NEAR AI Cloud's documentation states that its confidential endpoints run vLLM / SGLang inside Intel TDX
confidential VMs attached to NVIDIA H200 GPUs in confidential-computing mode, with automatic prefix caching
enabled by default and no documented cache_salt, per-tenant partitioning, or opt-out flag.
Hardware confidential computing encrypts GPU/CPU memory against the host OS, hypervisor, and cloud operator. Inside the attested enclave, however, the inference engine must hold decrypted tokens and live KV attention tensors in HBM. When multiple users share that inference process (for example, every OpenRouter user routed under OpenRouter's shared upstream key, or every end-user of a multi-tenant app behind one NEAR AI API key), an unsalted global KV prefix cache turns the TEE into a live cross-tenant oracle:
2. Source-code root cause: auditing nearai/cloud-api, inference-proxy, & live attestation
Rather than guessing how NEAR AI isolates direct customers internally, we inspected NEAR AI's live public
attestation endpoint (GET https://cloud-api.near.ai/v1/attestation/report?model=Qwen/Qwen3.8-27B,
243 KB, returning real Intel TDX quotes, 98 KB NVIDIA H200 evidence, and Dstack dstack-0.5.12
measurements) alongside NEAR AI's public open-source Rust repositories
(nearai/cloud-api and nearai/inference-proxy@37c3f6d). What we found gives credit
where credit is due—and pinpoints the exact root cause of the live exploit:
- Credit where due — separate direct NEAR AI organizations are isolated in source: Both
nearai/cloud-api/crates/services/src/completions/cache_salt.rsandnearai/inference-proxy/src/cache_salt.rsexplicitly derive an upstream vLLMcache_salt = hex(SHA-256(domain || organization_id || client_cache_salt)). Two completely separate direct NEAR AI Cloud organizations therefore land in cryptographically distinct KV-cache namespaces. - Root Cause A — OpenRouter collapses every OpenRouter user into one NEAR AI org and strips
cache_salt: OpenRouter routes all OpenRouter users to NEAR AI under OpenRouter's single NEAR AIorganization_id. Even when a caller explicitly passes distinctcache_saltstrings through OpenRouter (alice-salt-111111vs.bob-salt-999999), OpenRouter strips/drops the field—and Bob STILL hits3,840 / 3,861(99.5%,851 ms → 552 ms)! Every OpenRouter user onnear-aitherefore shares one unpartitioned KV-cache namespace—confirmed directly across two completely separate OpenRouter customer accounts AND two separate networks/ASNs (residential ISP → cloud VM,experiments/cross_openrouter_account_kv_audit.py): Account B immediately hit99.3%–99.4%onqwen3.8-27b(3,568/3,593, 3/3),97.6%–97.8%ondeepseek-v4.1-flash-1017(2,432/2,487, 3/3),95.8%–97.5%onz-ai/glm-5.3-flash(2/2), and98.4%on a fresh1280×960PNG image (1,200/1,219)! - Root Cause B —
cloud-apiignores standard OpenAI fields (prompt_cache_key,user,cache_prompt: false) & pools workspaces/keys within one org: Incloud-api/crates/services/src/completions/cache_salt.rs(lines 45–88),scope_to_organization()reads only the non-standard vLLM fieldcache_salt—even thoughcloud-apialready parsesprompt_cache_keyfor backend routing affinity inaffinity.rs! Its own doc comment confirms: "Only the organization and the client salt are inputs, so every workspace, key and request of one organization that sends the same salt shares one namespace." Any multi-user app or aggregator behind one NEAR AI org key that relies on standard OpenAIuser,prompt_cache_key, orcache_prompt: falsegets zero isolation. - Root Cause C —
attested 3p(Chutes & Tinfoil) never callapply_upstream_cache_salt(): Insidenearai/cloud-api/crates/inference_providers/src/attested/, onlyattested/nearai/mod.rs(lines 2009 & 2184) callsapply_upstream_cache_salt(). Neitherattested/chutes/norattested/tinfoil/calls it—and percache_salt.rslines 65–69, non-NEAR providers receivecache_saltonly if the client manually sent one. For default OpenAI-SDK requests to NEAR AI'sattested 3pChutes models (deepseek/deepseek-v3.2,moonshotai/kimi-k2.6,moonshotai/kimi-k3), even two completely separate direct NEAR AI organizations forward zerocache_saltunder NEAR AI's shared upstreamCHUTES_API_KEY(and we measuredchuteslive at99.0%caching with up to−2,189 ms / 2.34×TTFT drops). - Root Cause D — Cross-tenant replica & DP-rank co-location magnet
(
vllm_dp_affinity.rs&backend_affinity.rs): Even on multi-replica / multi-DP-rank clusters,inference-proxy/src/vllm_dp_affinity.rs(lines 82–129) derivesconversation_key()by hashing only(model, messages[..=first_user], tools, chat_template, …)with noorg_id,workspace_id,cache_salt, oruser. As a result,BackendConversationAffinityandVllmDpAffinityactively pin two different tenants sharing a prompt prefix onto the exact same physical backend replica and vLLM data-parallel rank! Meanwhile,inference-proxy/src/cache.rs(SignatureOwner { org_id, workspace_id }) already enforces workspace-level isolation for chat signatures—provingworkspace_idis already available inRequireAuthto harden bothcache_salt.rsandconversation_key(). - Latent OHTTP edge case (verified clean on
cloud-api, caveat on directinference-proxy): Oncloud-api,POST /ohttpdecapsulates into loopback auth +cache_salt::scope_to_organization(). Oninference-proxy/src/routes/ohttp.rs(lines 202–207), however, if an OHTTP relay authenticates withTrustedConfigToken, the proxy stripsX-Request-Hash,X-NearAI-Priority, andx-nearai-replica—but does not strip or re-derive innerbody["cache_salt"]. (Meanwhile, E2EEencryption.rswas verified clean: v3 bindsnearai-e2ee-request-v3+ canonical reply key + field name in AAD, rejects weak Ed25519 points, anddecrypt_request_fieldscannot overwritecache_salt.)
2C. Local raw-byte Intel TDX v4 hardware quote, nonce-freshness & compose verification
To verify NEAR AI's hardware TEE claims independently of any third-party verifier service, we wrote a local binary
Intel DCAP TDX v4 quote parser (llmverify.forensics.verify_intel_tdx_v4_quote(),
experiments/nearai_tdx_enclave_and_multiturn_audit.py, $0.00 cost) and checked 8 live models on
cloud-api.near.ai/v1/attestation/report across two distinct fresh 32-byte nonces. Credit
where due: all four NEAR-native enclaves passed 100% of cryptographic checks (valid TDX v4 header,
DEBUG = 0, live per-request nonce binding on both n1 and n2, and exact
mr_config_id == 0x01 || sha256(app_compose) binding pinned @sha256 container digests),
while exposing exact live cluster sizes (1, 2, and 4 × 8×H200 nodes) and Chutes's separate sek8s
8×H200 / 8×B300 TDX quote format:
Model on cloud-api.near.ai | Backend | Nodes × GPUs | TDX v4 / DEBUG=0 | Fresh n1 & n2 in report_data | mr_config_id = app_compose | Signer / Instance ID |
|---|---|---|---|---|---|---|
| Qwen/Qwen3.8-27B | NEAR native | 1 × 8×H200 | TDX v4 · DBG=0 | addr + n1 + n2 ✓ | Exact match ✓ | 0x835ab53d20… |
| Qwen/Qwen3.8-27B-abliterated | NEAR native | 1 × 8×H200 | TDX v4 · DBG=0 | addr + n1 + n2 ✓ | Exact match ✓ | 0x979121f480… |
| deepseek-ai/DeepSeek-V4.1-Flash-1017 | NEAR native | 2 × 8×H200 | TDX v4 · DBG=0 | addr + n1 + n2 ✓ | Exact match ✓ | 0xfe00718955… |
| z-ai/glm-5.3-flash | NEAR native | 4 × 8×H200 | TDX v4 · DBG=0 | addr + n1 + n2 ✓ | Exact match ✓ | 0x3b753b4406… |
| deepseek/deepseek-v3.2 · kimi-k3 · kimi-k2.6 | Chutes (sek8s) | 8×H200 / 8×B300 | TDX v4 · DBG=0 | Custom sek8s rd (fresh per instance) | n/a (quote_b64) | 58c0f98b… / 5c5a9255… |
| deepseek/deepseek-v4.1-flash-1017 · z-ai/glm-5.3 | 3P slug | — | HTTP 503 ("Provider error: Failed to fetch attestation report") | |||
2D. Full-stack TEE architecture audit: Gateway TDX, OHTTP Ed25519, open-source compose-manager, 65-model census & E2EE v1/v2 tools gap
Going beyond the model-level quote, we cryptographically verified NEAR AI's entire public attestation chain
across all 65 listed models (experiments/nearai_full_stack_tee_audit.py &
experiments/nearai_65model_enclave_census.py, $0.00) alongside
nearai/inference-proxy, nearai/compose-manager, and
nearai/cvm-compose-files:
- Credit where due — Gateway TDX, OHTTP Ed25519, AND public open-source deploy repos all check out:
cloud-api.near.aiterminates TLS directly inside its own Intel TDX v4 enclave (nearaidev/cvm-ingress@sha256:9e9aac…+ Let's Encrypt, pinned inside a publicly embedded 28.5 KBapp_composematchingmr_config_id,DEBUG = 0, freshnonce). Its RFC 9458 OHTTP endpoint (GET /.well-known/ohttp-gateway, HTTP 200, 45 bytes) matchesohttp_key_configbyte-for-byte, and its Ed25519ohttp_attestation.signatureverified cryptographically against the gateway's attested key (40599fb284…). Likewise, bothgithub.com/nearai/compose-managerandgithub.com/nearai/cvm-compose-filesare public open-source repos: downloading all 3 / 3 live GPU cluster compose YAMLs at their attested commits (gpu13prod/pack-small-models.yaml @ 351acd44,gpu04prod/deepseek-v4.1-flash-1017-vllm-dep4x2.yaml @ b0f89e45, andgpu23prod/pack-glm-53-flash-pd2-long.yaml @ f7f20827;experiments/nearai_gpu_compose_audit.py) matched their live TDX-signedfile_sha256bit-for-bit, confirming strong engine hygiene across all 3 clusters (HF_HUB_OFFLINE=1,engine-egress-probe,--log-requests-level 0,0docker.sockmounts inside model workloads,10/10pinned images ongpu04,16/16pinned images ongpu23, and27/29ongpu13). - Complete 65-model attestation & co-hosting census: Querying
/v1/attestation/reportacross all 65 catalog models yields: 12 / 65 NEAR-native TDX v4 models running on 3 physical GPU hosts—gpu13co-hosting 9 models inside one 8×H200 CVM (Qwen3.8-27B,Qwen3.8-27B-abliteratedsharing the same SGLang process via rank-1 LoRA,Qwen3.6-35B,Qwen3-VL-30B,Qwen3-Embedding,Qwen3-Reranker,whisper-large-v3,FLUX.2-klein-4B,privacy-filter),gpu04(2×8×H200:DeepSeek-V4.1-Flash-1017+ abliterated), andgpu23(4×8×H200:z-ai/glm-5.3-flash); 3 / 65 Chutessek8sTDX v4 models (deepseek-v3.2,kimi-k2.6,kimi-k3); and 50 / 65 returning HTTP 503 (unattested frontier/3P models proxied throughcloud-api). - Residual operator & supply-chain trust gap on GPU enclaves (
compose-manager+compose-manager-launcher): Even with public GitHub repos and append-only TDX-signedactions[]logs, live GPU nodes are not immutable static enclaves—an attacker who compromises NEAR's GitHub/CI maintainer keys +BEARER_TOKENstill holds four concrete capabilities: (1) Zero-timelock hot-deploy (CM_MIN_TAG_AGE_HOURS=0) & runtime override: a newly pushed commit innearai/cvm-compose-filescan be deployed into a live prod GPU TEE immediately with zero cooldown and without changing basemr_config_id—and even if a non-zero cooldown were configured,compose-manager/src/env_overrides.rs(line 50) exposesPUT /admin/envallowing the sameBEARER_TOKENholder to overrideCM_MIN_TAG_AGE_HOURSstraight back to0at runtime without rebooting the CVM! (Experimental benchmarks likeexperiments/GLM-5.3-gpu23-local-engine-bench.yamlandexperiments/GLM-5.3-Flash-gpu23-tiering-pd-test.yaml @ 9bdfb1caalso ran on live prod nodes—the latter temporarily exposingengine_logs:/logs:rovia an unauthenticatedpython3 -m http.server 8000 --directory /logson port8006before teardown.) (2) Root + KMS container privileges:compose-managerruns withpid: host,cap_add: [SYS_ADMIN, SYS_PTRACE],/var/run/docker.sock,/var/run/dstack.sock, and/dstack/.host-shared/.decrypted-env, whilecompose-manager-launcherauto-updatescompose-manageritself from any Cosign-signed workflow innearai/compose-manager/.github/workflows/.*without rebooting the CVM (andpre_launch_scriptomits the strict digest regex check onCOMPOSE_MANAGER_IMAGEthat it applies toOTELCOL_MANAGEMENT_IMAGE). (3) Shareddstack.sockKMS blast radius across 9 co-hosted models:prod/pack-small-models.yamlmounts/var/run/dstack.sockinto 11 co-hosted containers ongpu13(vs. 2 ongpu04and 4 ongpu23); becauseinference-proxy/src/signing.rsderives per-model ECDSA & Ed25519 signing/E2EE keys viadstack.get_key("{model_name}/..."), any compromise of a single co-hosted proxy (orcompose-manager) shares KMS reach across all 9 models. (4) 2 unpinned images insideprod/pack-small-models.yaml(privacy-filter-hf,vllm-with-audio-v0330-langfix), whereasgpu04andgpu23are 100% pinned. - E2EE v1/v2/v3 field-coverage &
X-Request-Hashaudit (encryption.rs&routes/chat.rs): Credit where due: E2EE v3 (X-Encryption-Version: 3) bindsAAD = "nearai-e2ee-request-v3" || suite || canonical_reply_key || 0x00 || field, enforces full-field encryption, sanitizes upstream errors, rejectsprompt_logprobs/return_token_ids, and whitelists response fields viaretain_completion_fields(). Three concrete caveats remain: (1) In default E2EE v1 (no version header) or v2 withoutX-Encrypt-All-Fields: true,tools,tool_calls,name,logprobs, and non-string multimodalcontentarrays (image_url,encryption.rs:1059–1066) pass through in plaintext with zero error. (2) Even in E2EE v3,response_format(json_schema),stop,documents, andcache_saltare never encrypted—andusage.prompt_tokens_details.cached_tokensis explicitly whitelisted inretain_completion_fields()(line 883), leaving the KV-cache oracle visible even under full E2EE v3 + OHTTP whenever two callers share a namespace. (3) On trusted-gateway calls (routes/chat.rs:396–420),inference-proxysigns any 32-byteX-Request-Hashsupplied bycloud-api(so request-hash binding relies oncloud-api's gateway TDX enclave;ohttp.rs:420properly scrubs innerx-request-hashon OHTTP relays). - Telemetry & external storage boundary: Both gateway and model CVMs run
otelcol-contribshipping container Docker JSON logs (/var/lib/docker/containers/*/*-json.log) tohttps://telemetry.infra.near.ai, whilecloud-apiconnects to external AWS RDS/S3—making strict zero-body log hygiene and E2EE v3 / OHTTP essential for high-sensitivity workloads.
2B. Live 65-model fleet X-ray from public TEE attestations
Querying only NEAR AI's public unauthenticated GET /v1/models and
GET /v1/attestation/report?model=… endpoints
(experiments/nearai_attestation_fleet_xray.py, $0.00 cost) maps NEAR AI Cloud's entire 65-model
catalog and live physical 8× NVIDIA H200 (Hopper) Intel TDX deployment topology:
Fleet Tier (cloud-api.near.ai) | Models | Live Hardware / Compose Stack | cache_salt Isolation | Notes |
|---|---|---|---|---|
1P GPU TEE — PHYS-1 (Small Pack + GLM node 2) | 10 | 1× 8×H200 TDX · prod/pack-small-models.yaml@351acd44 | Direct orgs isolated | Co-hosts Qwen3.8-27B, -abliterated (rank-1 LoRA), Qwen3.6-35B, Qwen3-VL-30B, FLUX.2, whisper, privacy-filter, embeddings/reranker, plus z-ai/glm-5.3-flash (node 2, SGLang + 325 GiB HiCache) on the exact same 8 H200 dies (11 dstack.sock mounts) |
1P GPU TEE — PHYS-2/3 (DeepSeek) | 2 | 2× 8×H200 TDX · deepseek-v4.1-flash-1017-vllm-dep4x2.yaml@b0f89e45 | Direct orgs isolated | 16 unique H200 dies; vLLM DEP4×2 hosting DeepSeek-V4.1-Flash-1017 & -abliterated (10/10 images pinned) |
1P GPU TEE — PHYS-4/5 (GLM-5.3-Flash) | 1 | 2× 8×H200 TDX (+ PHYS-1) · pack-glm-53-flash-pd2-long.yaml@f7f20827 & glm-5.3-flash-vllm-pd2x2.yaml@c3598d40 | W4AFP8 vs OR "fp8" | 4 model_attestations collapse to 3 physical 8×H200 servers (PHYS-4 runs dual proxy-glm53 + proxy-glm53-long with 406 GiB HiCache on the same 8 H200s; PHYS-5 runs vLLM PD2×2). All 3 load graphistry/GLM-5.3-Flash-W4AFP8 despite OpenRouter's near-ai/fp8 tag! |
| Attested 3P (Chutes) | 4 | provider: "chutes" (deepseek-v3.2, kimi-k2.6, kimi-k3; glm-5.3 503) | Never calls apply_upstream_cache_salt() | Default OpenAI-SDK requests send no cache_salt under NEAR's shared CHUTES_API_KEY |
| External non-TEE passthrough | 49 | OpenAI (22), Anthropic (14), Google (6), xAI (2), DeepSeek (2), Moonshot (1), Levanto (1), Typesafe (1) | Outside TEE | E2EE rejected by reject_e2ee_if_unsupported() |
| OpenRouter-only listing | 1 | openai/gpt-oss-120b (near-ai/fp4 on OpenRouter) | No public attestation (HTTP 400) | Absent from cloud-api.near.ai/v1/models; /v1/attestation/report?model=openai/gpt-oss-120b returns HTTP 400 |
2E. NVIDIA H200 silicon X.509 tomography, TDX-attested fp8→W4AFP8 mismatch & single-shot cross-account agent tool bleed
Going down to the raw GPU silicon layer (experiments/nearai_deep_tee_v2_audit.py, $0.0016 total), we
decoded the factory-fused NVIDIA Hopper GH100 X.509 certificate chains
(CN=GH100 A01 GSP FMC LF signed by GH100 A01 GSP BROM, 5 certs/chain) and checked
fresh 32-byte nonce binding at binary offset 4..36 inside every NVIDIA SPDM firmware evidence blob
across all 12 NEAR-native models, then ran clean single-shot two-account OpenRouter probes
(Account A → Account B, zero self-hit confounding):
- Credit where due — 40 / 40 physical NVIDIA H200 dies pass live SPDM freshness: Every single GPU
across all 5 physical 8×H200 servers bound both fresh nonces
n1andn2at binary offset4..36with newly signed firmware evidence bytes on every call (0replayed GPU payloads). All 4 / 4 live compose YAMLs (351acd44,b0f89e45,f7f20827, andc3598d40) matched their TDX-attestedfile_sha256bit-for-bit against publicgithub.com/nearai/cvm-compose-files. - Exact physical silicon fleet census (5 servers = 40 unique H200 dies, all sharing one KMS
app_id): Deduplicating factory-fused GH100 X.509 serial numbers across all 12 NEAR-native models reveals that the entire fleet runs on exactly 5 physical 8×H200 servers (40 unique H200 GPUs)—not 7—all sharing onedstackapp_id(2c0a0c96cb6d…):z-ai/glm-5.3-flash's 4model_attestationscollapse to 3 physical servers becausePHYS-4(inst=cc796618bcd5) runs bothproxy-glm53(node 0) andproxy-glm53-long(node 3) on the exact same 8 H200 dies,PHYS-5(inst=19aea1693533,glm-5.3-flash-vllm-pd2x2.yaml@c3598d40) runs vLLM PD2×2 (node 1), and node 2 runs onPHYS-1(gpu13,pack-small-models.yaml@351acd44) co-hosted with all 9 small models (10 models on one 8×H200 box). - TDX-hardware-attested
fp8→W4AFP8quantization mismatch & hetero-engine serving: OpenRouter listsz-ai/glm-5.3-flashasnear-ai/fp8(quantization: "fp8"), yet 100% of all 3 physicalglm-5.3-flashservers cryptographically attest to loadinggraphistry/GLM-5.3-Flash-W4AFP8(4-bit weights, FP8 activations)—while mixing two completely different inference engines under one slug: SGLang with325 GiB/406 GiBhost-RAM HiCache (--enable-hierarchical-cache+SGLANG_GHOST_CACHE=1) onPHYS-1&PHYS-4alongside vLLM 0.34.0 PD2×2 onPHYS-5. Those hundreds of GiB of host-RAM HiCache explain why cross-tenant KV prefixes persist far beyond GPU VRAM eviction! - Single-shot cross-account
cache_saltfailure & Agentrole: "tool"bleed (85.7%–99.5% on Try 1): On clean single-shot Account A → separate Account B probes: (1) sending distinctcache_saltvalues still bled98.9%onqwen/qwen3.8-27b(4,224/4,270,$0.000175 → $0.000083, −52.5% cost) and99.5%onz-ai/glm-5.3-flash(3,392/3,410,779.5 → 407.7 ms, 1.91× faster,$0.000274 → $0.000044, −83.9% cost) across a 3-server cluster; and (2) multi-turn Agent conversations carrying 6toolsschemas + assistanttool_calls+ confidentialrole: "tool"payloads bled85.7%onqwen/qwen3.8-27b(4,928/5,753) and99.3%onz-ai/glm-5.3-flash(4,800/4,832,2,084.4 → 774.3 ms, 2.69× faster, −84.0% cost) on the very first probe!
2F. Hybrid Mamba/DeltaNet all-or-nothing KV cliff, privileged: true proxy containers & live Gateway TLS SPKI verification
Probing deeper into NEAR AI's live container runtime, Gateway TDX TLS binding, and prefix-cache physics
(experiments/nearai_mamba_and_w4afp8_xray.py, $0.0092) turned up four crisp architectural findings:
- Credit where due — Gateway TDX is immutable and cryptographically pins live TLS SPKI on both prod IPs:
Unlike the GPU CVMs,
cloud-api.near.ai's Gateway TDX enclave embeds a static 28.6 KBapp_composewith nocompose-manager, 4 / 4 pinned@sha256images,cap_add: [],public_logs: false, and 0-bytepre_launch_script. Both live DNS A records (40.160.65.237&40.160.77.67) serve a Let's Encrypt certificate whose SPKI SHA-256 (73862c254372091c…) matchesgateway_attestation.tls_cert_fingerprintbit-for-bit and verifiesSHA256(signing_address_bytes || spki_bytes) == report_data[0..32]alongside our fresh 32-byte nonce inreport_data[32..64]. (cvm-ingressmountsdstack.sockto KMS-protect Let's Encrypt cert sync across replicas viaINGRESS_S3_BUCKET.) - First-ever Hybrid Mamba/DeltaNet all-or-nothing KV-bleed cliff (
Qwen3.8-27Bvs. pure-AttentionGLM-5.3-Flash): On single-GPUqwen/qwen3.8-27b @ near-ai/fp8(--max-mamba-cache-size 96in SGLang0.5.23-near-secure), Account A wrote a 7,217-token prompt ([7,200-tok system doc] + "Confirm ready."). Separate Account B appending a turn after"Confirm ready."immediately hit7,200 / 7,236(99.5%)—yet changing even the final 2 tokens ("Confirm ready."→"Reply NOW.", or mutating any block 16..112 of 128) dropped cached tokens straight to0 / 7,217(0.0%)! Replicated on a 3,469-token system prompt: even same-account single-turn callA2(same 3,450-tok system prompt, different 2-tok user turn) got0 / 3,469(7,211 mscold prefill!) while cross-account append-onlyB2hit3,440 / 3,486(98.7%,683 ms). By contrast, pure-Attention/MLAz-ai/glm-5.3-flashhit5,504 / 5,515(99.8%,945 → 564 ms) even when the final 2 tokens changed! Because Mamba/DeltaNet recurrent states are non-rewindable, SGLang only saves a state checkpoint at exact finished-request leaves—giving single-turn prompts accidental partial-prefix resistance while leaving append-only multi-turn chats 99.5% open (and costing single-turn system-prompt users 0% cache hits!). - 100% of internet/media-facing
vllm-proxy-rscontainers runuser: root+privileged: true+/var/run/dstack.sock: Insideprod/pack-small-models.yaml(lines 28–37) and all 3 other live compose files, model engines correctly drop all capabilities (cap_drop: [ALL],no-new-privileges:true)—yet all 10vllm-proxy-rscontainers onPHYS-1(and every proxy onPHYS-2/3/4/5) run withuser: root+privileged: true+/var/run/dstack.sock, even thoughvllm-proxy-rsparses untrusted JSON, decrypts E2EE/OHTTP, and fetches remotehttp(s)://media (VLLM_PROXY_INLINE_MEDIA=1), and even thoughgpu_evidence_delegate.rsexists to avoid giving every proxy direct NVML access (currently unset onPHYS-1). Sinceohttp_gateway.rsandsigning.rsderive ECDSA, Ed25519, E2EE X25519, and OHTTP HPKE keys fromdstack.sockunder one sharedapp_id, any RCE in a single proxy container escapes container isolation into full CVM root + all 10 co-hosted models' keys. - Unpinned inline supply chain inside live
PHYS-1(privacy-filter-hf) & heterogeneousglm-5.3-flashstack: Inprod/pack-small-models.yaml(lines 341–360),privacy-filter-hfbuilds inside the live 10-model TEE CVM from mutable Docker Hub tagFROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime+ unhashedpip install(6 packages, zero--hash=sha256:pinning, nocap_drop: [ALL])—unlikevllm-with-audio-v0330-langfix(lines 2529–2538), which pins both@sha256base and wheel hashes. MeanwhilePHYS-4mixes two KV dtypes (bfloat16+fp8_e4m3), two speculative decoders (EAGLE+MTP-4), and SGLang + vLLM under onez-ai/glm-5.3-flashslug (causingT=0self-divergence across repeats and misaligned</think>tokens leaking intologprobs.contenton 11/16 calls).
2G. Hardware RTMR3 replay, 7-day auto-pruning of compose-manager logs, Mamba vision cliff & cross-account <think> bleed
Finally, we cryptographically replayed Intel TDX hardware RTMR3 across all 6 live CVMs, audited
all 3 Chutes sek8s Hopper/Blackwell enclaves, and ran single-shot two-account multimodal and
chain-of-thought probes (experiments/nearai_rtmr3_mamba_vision_and_reasoning_audit.py, $0.00081 total):
- Smoking gun — 0 / 263 hot-deploys in hardware
RTMR3+ 7-day auto-pruning ofactions.json(compose-manager/src/main.rs:145–156, 1175–1226): Replaying everydstackevent_logentry matched hardwareRTMR3bit-for-bit on 6 / 6 CVMs (Gateway +PHYS-1..5)—proving that out of 263 livecompose-manageractions across the 5 GPU servers (31 onPHYS-1, 50 + 8 onPHYS-2/3, 56 incl. 33experiments/non-prod deploys onPHYS-4, and 118 hot-deploys onPHYS-5), exact count0 / 263were extended into hardwareRTMR3—even thoughPHYS-4andPHYS-5actively extend runtimenearai-replica-report-key-v1events intoRTMR3! Instead,compose-managerpersistsactions.jsonas a mutable file on disk (silently resetting to empty on corruption, lines 145–156), automatically deletes old deploys after 7 days (ACTION_LOG_RETENTION_DAYS = 7,prune_actions()) so historical unauthorized or experimental deploys vanish completely fromcompose_manager_attestation, and signs the pruned JSON via/var/run/dstack.sockGetQuote—the exact same socket mounted into all 10user: root+privileged: truevllm-proxy-rscontainers onPHYS-1. - Credit where due — Chutes
sek8sunified CPU+GPU binding verified on Hopper & Blackwell: All 3 / 3 Chutessek8smodels oncloud-api.near.ai(deepseek/deepseek-v3.28×HOPPER,moonshotai/kimi-k2.68×HOPPER, andmoonshotai/kimi-k38×BLACKWELL) passedDEBUG = 0,report_data[0..32] == SHA256(nonce || e2e_pubkey), and 8 / 8 NVIDIA SPDM GPU evidence blobs bindingreport_data[0..32]at offset4..36. - Hybrid Mamba multimodal cliff confirmed on live PNG images (
0.0%vs.96.3%): Onqwen/qwen3.8-27b @ near-ai/fp8, Account A uploaded a fresh1280×960PNG +"Confirm image received."(1,258 tokens). Separate Account B sending the exact same PNG with a different question ("Name one color.") hit0 / 1,258(0.0%)—yet Account B appending Turn 2 after"Confirm image received."immediately hit1,232 / 1,279(96.3%), proving that the Hybrid Mamba leaf-checkpoint cliff governs multimodal vision caches identically to text. - Cross-account chain-of-thought (
<think>) KV-cache bleed (98.2%–99.5%+ 2.71× blind timing): Account A sent a multi-turn conversation carrying a confidential ~2.2k–2.7k-token<think>reasoning trace containingMERCURY-77. Separate Account B probing with wrong thoughtNEPTUNE-99hit0%on both models, while probing withMERCURY-77immediately hit2,688 / 2,736(98.2%) onqwen/qwen3.8-27band2,176 / 2,188(99.5%,1,292.7 → 476.3 ms, 2.71× faster!) onz-ai/glm-5.3-flash.
3. Interactive replay: live blind template-secret extraction inside the TEE
How practical is secret extraction? Whenever an enterprise, medical, financial, or agent app wraps a low-entropy
secret inside a standard prompt template ([Header] + SECRET + [Long Boilerplate Suffix]), a wrong
guess breaks KV prefix matching at the header boundary (e.g. token 880 or 1,328), while
the true secret matches all the way through the multi-thousand-token suffix. Toggle between
Cached Tokens and Blind Timing-Only (TTFT ms) below to inspect five real live extractions run
against near-ai/fp8 (qwen/qwen3.8-27b):
Multi-replica honesty note: Look at the 1-of-12 ticker replay above:
7 of 12 probes (GOOG + 6 wrong tickers at 880 cached tokens) hit the warm replica,
while 5 wrong tickers hit a separate cold replica (0 cached tokens). In a separate 2-stage test
(4 sectors × 4 actions), all 4 Stage-1 probes happened to miss the warm replica (0 cached), while
all 4 Stage-2 probes hit the warm replica cleanly (BUY: 8,448 / 820 ms vs.
SELL/HOLD/SHORT: 4,016 / 1,165–1,231 ms). On a ~2-replica cluster, repeating each candidate 2–3×
raises warm-replica hit probability above 85% while keeping total attack cost under a penny.
4. Zero-overlap timing oracle (AUC = 1.000) & 3-minute uncontaminated idle TTL
Even if NEAR AI removed cached_tokens from API responses completely, streaming prefill latency
alone cleanly separates cached vs. uncached prompts. Across 5 paired 7.5k–8.0k token cold-vs-warm trials on
near-ai/fp8 (user=alice → bob), every cold call took 1,029–1,397 ms and
every warm call took 512–610 ms (a 419 ms zero-overlap gap, median
−561 ms / 2.06×, AUC = 1.000). Across seven independent uncontaminated TTL
prompts (each seeded once at t = 0 and probed once with zero touches in between), Alice's secret
remained 99.5% hot at 180.0 s (3 full minutes idle!) and evicted between 3 and 4
minutes:
5. All 4/4 NEAR AI TEE models & all 7/7 ignored opt-out flags
Scanning all 442 models on OpenRouter surfaced four live near-ai endpoints. Every single one
bleeds 94.2–99.9% cached tokens across user="alice" → "bob", exhibits a consistent
cold-to-warm TTFT speedup even at 5k tokens, and exposes its exact KV block granularity (16,
64, or 128 tokens). Even role: system secrets bleed identically
(5,024 / 5,049 = 99.5%), and all seven opt-out/isolation parameters—including NEAR AI's own
cache_salt field—are silently ignored or stripped via OpenRouter:
| Model @ NEAR AI Endpoint | Cross-provider isolation | user bleed (3 trials) | KV block size | 5k–8k Cold → Warm TTFT | Verdict |
|---|---|---|---|---|---|
| qwen/qwen3.8-27b @ near-ai/fp8 | 0% vs deepinfra | 99.3–99.6% (3/3) | 16 tok | 1,137 → 553 ms (2.06×, 5/5) | Bleeds + AUC 1.0 |
| openai/gpt-oss-120b @ near-ai/fp4 | 0% vs venice/cw/ak | 99.4–99.9% (3/3) | 16 tok | 735 → 575 ms (1.29×, 3/3) | Bleeds (48-tok prewarm) |
| deepseek-v4.1-1017 @ near-ai | 0% vs baseten/venice | 98.5–99.1% (3/3) | 64 tok | 684 → 554 ms (1.33×, 3/3) | Bleeds |
| z-ai/glm-5.3-flash @ near-ai/fp8 | own TEE pool | 94.2–96.6% (3/3) | 128 tok | 922 → 689 ms (1.34×, 2/3) | Bleeds |
Isolation / Opt-Out Attempt (near-ai/fp8) | Alice cold write | Bob probe (+350 ms) | Cross-hit | Verdict |
|---|---|---|---|---|
| user="alice" vs "bob" | 0 / 7,323 (1,332 ms) | 7,296 / 7,323 (997 ms) | 99.6% | Silently ignored |
| prompt_cache_key="alice-vault" vs "bob-vault" | 0 / 4,477 (1,511 ms) | 4,448 / 4,477 (1,478 ms) | 99.4% | Silently ignored |
| cache_salt="alice-salt-111111" vs "bob-salt-999999" | 0 / 3,861 (851 ms) | 3,840 / 3,861 (552 ms) | 99.5% | Stripped by OpenRouter |
| cache_prompt: false | 0 / 4,562 (761 ms) | 4,544 / 4,562 (586 ms) | 99.6% | Silently ignored |
| store: false | 0 / 4,452 (4,693 ms) | 4,432 / 4,452 (633 ms) | 99.6% | Silently ignored |
| OpenRouter provider: {zdr: true} | 0 / 4,355 (1,234 ms) | 4,336 / 4,355 (548 ms) | 99.6% | Silently ignored |
| temperature: 0.0 vs 0.9 | 0 / 4,370 (913 ms) | 4,352 / 4,370 (565 ms) | 99.6% | Silently ignored |
| Secret placed inside role: "system" | 0 / 5,049 (925 ms) | 5,024 / 5,049 (720 ms) | 99.5% | System prompt bleeds |
6. 7-axis security & fidelity battery across all 4 NEAR AI models
Beyond KV caching, we ran our 7-axis security & fidelity audit
(experiments/nearai_full_forensics_audit.py, $0.0011) across all 4 live NEAR AI endpoints. The
results are mixed—strong on raw logprob honesty, strict JSON schema, and forced tool calling, but exposing
live special-token multi-turn role forgery and ignored stop sequences on
deepseek-v4.1-flash-1017 plus ignored frequency_penalty on two models:
| Model @ NEAR AI | Special-token isolation | Logprobs / Bragg | stop sequence | Strict json_schema | frequency_penalty=2 | Forced tool_choice |
|---|---|---|---|---|---|---|
| deepseek-v4.1-1017 @ near-ai | Role forgery (−31 tok, '2' vs '1') | BF16_1/8 · raw LP | Ignored (leaked marker) | Pass | Ignored (18 vs 18) | Pass |
| qwen3.8-27b @ near-ai/fp8 | Collapsed −14 tok | BF16_1/16 · raw LP | Pass | Pass | Ignored (18 vs 18) | Pass |
| gpt-oss-120b @ near-ai/fp4 | Pass | BF16_1/8 · raw LP | Pass | Pass | Honored (18→15) | Pass |
| glm-5.3-flash @ near-ai/fp8 | Pass (Δ=−4) | reasoning-only (short cap) | Pass | empty (reasoning cap) | empty (reasoning cap) | Pass |
7. Practical threat model: what attackers CAN and CANNOT read
To keep the risk assessment exact and free of hype:
| Attack scenario | Practical today? | Why |
|---|---|---|
| Read an arbitrary unknown free-form prompt (e.g. a unique diary entry or novel email) | No / Impractical | Blocks match in 16-token (or 64–128-token) chunks. Brute-forcing 16 unknown free-form tokens simultaneously is infeasible. |
| Extract secrets inside known templates (medical triage, trading/M&A memos, RAG/compliance forms, agent workflows) | Very practical ($0.003) | Probing N candidate values (4 diagnoses, 12 tickers, 50 states, yes/no flags) costs fractions of a cent within the 3-minute window and recovers the exact secret via cache or TTFT. |
| Document / prompt-existence oracle ("Did someone send this leaked contract / filing / query in the last 3 minutes?") | Trivial (1 probe) | One max_tokens=1 call every ~150 s immediately reveals residency with AUC = 1.000 even without cached_tokens. |
| Fingerprint active public agent prompts & repos (coding agents, open-source RAG system prompts) | Trivial | Multi-thousand-token public system prompts light up immediately (our first cold call to gpt-oss-120b @ near-ai/fp4 already hit 48 pre-warmed tokens). |
8. Verified client-side defense (0.0% bleed) & exact server/OpenRouter fix
Until NEAR AI patches the server, privacy-sensitive callers can completely neutralize cross-tenant KV bleed today
by prepending a fresh 128-bit random nonce inside the first 16 tokens of the prompt. Placement matters:
a leading nonce breaks block-0 hashing and drops bleed to 0.0% across 3/3 live trials,
whereas a trailing nonce placed at the end of the prompt still bleeds 86.3%!
Client-side defense test (near-ai/fp8) | Alice write | Bob probe (+350 ms) | Cross-hit | Result |
|---|---|---|---|---|
| Leading 128-bit nonce (Trial 1) | 0 / 5,828 (1,157 ms) | 0 / 5,827 (1,087 ms) | 0.0% | 100% isolated |
| Leading 128-bit nonce (Trial 2) | 0 / 5,977 (930 ms) | 0 / 5,978 (891 ms) | 0.0% | 100% isolated |
| Leading 128-bit nonce (Trial 3) | 0 / 5,973 (1,112 ms) | 0 / 5,972 (890 ms) | 0.0% | 100% isolated |
| Trailing 128-bit nonce (anti-pattern) | 0 / 5,707 (1,057 ms) | 4,928 / 5,708 (765 ms) | 86.3% | Still leaks! |
Unprotected 2-turn chat (assistant reply turn!) | 0 / 3,782 | 3,136 / 3,781 (diff asst: 0) | 82.9% | Assistant turn bleeds! |
| Leading 128-bit nonce in Turn 1 (2-turn chat) | 0 / 4,047 | 0 / 4,047 | 0.0% | Assistant turn isolated |
Multimodal 1280×960 PNG (same text, distinct user) | 0 / 1,219 | 1,200 / 1,219 (recomp PNG: 0) | 98.4% | Image KV bleeds! |
Immediate developer workaround (breaks cross-tenant prefix matching at block 0; reuse the same
session_salt across turns of a single private conversation if you want single-user multi-turn
caching without cross-user bleed):
import secrets
session_salt = secrets.token_hex(16) # fresh per private user/session (first 16 tokens!)
messages = [{"role": "system", "content": f"[session:{session_salt}]\n" + system_prompt}, ...]
Exact 5-line fixes for OpenRouter & NEAR AI:
- For OpenRouter: Inject a per-OpenRouter-account
cache_salt(SHA256(openrouter_account_id || secret)) when forwarding requests tonear-ai, and forward client-suppliedprompt_cache_key/cache_saltinstead of stripping them. - For NEAR AI (
nearai/cloud-api/crates/services/src/completions/cache_salt.rs): Includeworkspace_id/api_key_id(or fall back to OpenAI's standardprompt_cache_key/userwhencache_saltis absent) inscope_to_organization(), and honorcache_prompt: falseby substituting a fresh per-request random UUID asupstream_cache_salt.
9. Scope, honest boundaries, and open questions
- Direct separate NEAR AI Cloud organizations (credit verified in source): Auditing
nearai/cloud-apiandnearai/inference-proxyconfirms that NEAR AI does derive organization-scopedcache_saltdigests for direct Cloud API orgs—so two separate direct NEAR AI organizations are isolated by design when running vLLM. (Direct two-org live verification outside OpenRouter is still worth confirming on SGLang-backed models if any do not support vLLM'scache_salt.) - What is 100% proven live today: Every OpenRouter user routing to
near-ai(because OpenRouter shares one NEAR AI org and stripscache_salt)—and every end-user, workspace, or API key inside a single NEAR AI organization that does not manually pass non-standardcache_salt—shares a live ≥3-minute KV-cache secret-extraction oracle across all 4 models, with 100% blind timing-only extraction verified on structured templates. - Hardware TEE integrity itself is not disputed: Live attestation returns valid Intel TDX + 98 KB NVIDIA
H200 evidence, and cross-provider probes confirmed
0%bleed betweennear-aiand Venice, Baseten, DeepInfra, CoreWeave, and AkashML.
More from LLM Verification
Stripped cache_salt & logprobs, 97.8–99.5% Try-1 two-account bleed across 65 instances, and verified sek8s hardware.
Bidirectional 90–99.4% KV-cache bleed across Venice, Baseten, and DeepInfra on three models.
Full SVG topology graph comparing reseller bleed, shared tiers, and verified isolated clusters.
Baseten's fp32/fp8 alias and Wafer's identical-pool regional price arbitrage.
15/18 providers ignore opt-outs (OpenAI 1P & DeepSeek 1P isolate), plus blind O(log N) reseller detection & CLI.
Single-call FP16 vs BF16 diffraction spectra and blind hidden-temperature recovery.
experiments/precision_alias_and_tee_ttl_audit.py,
experiments/nearai_tee_deep_forensics.py,
experiments/nearai_tee_part2_extraction_and_defense.py,
experiments/nearai_tdx_enclave_and_multiturn_audit.py,
experiments/nearai_full_stack_tee_audit.py,
experiments/nearai_65model_enclave_census.py,
experiments/nearai_gpu_compose_audit.py,
experiments/nearai_deep_tee_v2_audit.py,
experiments/nearai_mamba_and_w4afp8_xray.py,
experiments/nearai_rtmr3_mamba_vision_and_reasoning_audit.py). Corrections or patch confirmations from
NEAR AI or OpenRouter are welcome and will be re-tested and reflected here.
Method & limits