Sealed tools: web search and paid APIs inside an attested Intel TDX enclave
Web search and 4,000+ tools in our tool catalog are now run inside an attested Intel TDX confidential virtual machine. (Previously, these tools were run on our server.) These tools can be used in signed-in chats in Obscurify.ai, the Android app and obscurify-code.
Before any data is sent to the enclave, your device verifies the Intel hardware quote for the enclave, the measured container configuration, and the boot registers for the guest OS.
Each request is authorized with a stateless Ed25519 signature (a “lease”) from an unlinkable private session and padded to a fixed byte bucket. Free web searches and lookups of tool descriptions in the catalog do not call Obscurify.ai or create database rows – so Encrypted mode (model names tee/*) now supports web search and tools!
When an AI model searches the web or calls an external API, some machine must perform that network request. Until today, that machine on Obscurify.ai was (drumroll) our server. So if you asked a model to lookup a company’s latest filing or search the web for recent news, our server would see your search terms (and the results) in memory. In Encrypted mode prompts are encrypted end to end to a key in an enclave, and our server can’t even read your chat. This is why web search and tools in our catalog were switched off in Encrypted mode – we couldn’t run them on our server without exposing what you were asking about!
For signed-in accounts, web search and pay-per-use tool calls in our catalog now run in an Intel TDX Confidential Virtual Machine (CVM) (hosted on Phala Cloud, instance type tdx.small 1vCPU, 2GB RAM, 20 GB ephemeral disk, dstack-0.6.7 “non-dev” OS). The processor used to run this CVM encrypts the RAM of the CVM with a hardware key (which neither Phala nor Obscurify.ai have access to) and signs a hardware proof (“attestation”) that the exact code and operating system that we intend to boot has in fact been booted. Your device (browser, phone, or terminal) will verify this hardware proof before sending a single tool call to the CVM.
What runs inside the enclave
The measured docker-compose.yml file only runs two containers:
tool-runneris anode:22-alpinedocker container (pinned by sha256 hash), running 2 self-contained JavaScript files (no third-party npm dependencies!) that are themselves embedded in thedocker-compose.ymlfile. This means that the entire source code of the tool runner is covered by the hardware hash.egressis asing-boxcontainer (also pinned by sha256 hash) that runs a user-space Wireguard VPN tunnel to a Cloudflare WARP server at162.159.192.1port 2408 (the server’s public key is pinned in the publicdocker-compose.ymlfile; the only sealed secrets are the client Wireguard private key and the interface addresses). All outgoing network requests made by the tool runner are routed through this encrypted tunnel (including DNS over HTTPS to 1.1.1.1), so that Phala’s server network interface cannot see any DNS queries or TLS SNI (host names).
Inside the enclave, five tools are available:
web_searchis free and searches our search provider and returns the top web search results and a short summary. The URL of the search provider is committed (via a salted SHA256 hash) in the measured docker compose file.fetch_url(free) is used to fetch a public (https:) web page. DNS is resolved via DNS over HTTPS (1.1.1.1) inside the Wireguard tunnel. Loopback, private, link local, CGNAT and cloud metadata addresses are refused. This tool is available in theobscurify-codecommand line tool as well as in the API Clients. (In web chat and Android Code Mode, direct network calls from inside the local Python and JavaScript sandbox are blocked, so code reaches the internet only throughweb_searchand the catalog tools routed to the sealed VM.)market_search(free) searches 4000+ third party APIs (from Monid and treg) that are available in our catalog. Catalog entries are cached in enclave RAM.market_inspect(free) is used to inspect an API in our catalog.market_call(paid) is used to call an API in our catalog. API keys (from Monid and treg) are pre-paid by Obscurify.ai and stored sealed inside the VM. Before calling the API, we refuse the call if the tool could exceed either themax_cost_usdparameter specified by you or your remaining lease credit. Among image generation APIs, only carefully moderated ones are currently available viamarket_call. Calls to uncensored image or video generators or any parameters such as “safety off” are rejected inside the sealed VM (and not billed).
There is no per-request logging (at all!). Anyone is free to look at the (public) log of the VM; it will consist of a single line printed at startup, specifying the port the server is listening on, and the hash of the keyset that was used.
Four attestation checks before anything leaves your device
We have to assume that Phala Cloud (the TEE provider we rent the VM from) and Obscurify.ai could collude. The threat model assumes that we can see everything that our server and the Phala host machines can see.
So we perform more checks than just the measured compose hash of the application’s containers (this is stored in the Intel TDX measurement register RTMR3). If we only checked this, a malicious host could choose a modified version of the guest operating system that replays a fake RTMR3 to the attestation request.
Before we encrypt a tool call to the remote enclave, we verify the hardware of the remote machine. We use the tool obscurify-tee-verify, distributed as WebAssembly (which runs in your browser) and compiled natively into Android and obscurify-code.
It generates a random nonce (64 hex characters) and sends this to the /aci/attestation endpoint of the remote enclave. Then it performs four checks:
tdx_hardware- Verify we are running on Intel TDX hardware, and that the Intel signature chain, Intel TCB collateral andTDATTRIBUTES.DEBUG == 0checks pass.nonce_bindingande2ee_key- Check that the ephemeral in-RAM secp256k1 public key of the enclave is bound to the random nonce that was just generated by your device.gateway_code- Replays theRTMR3event log in the TEE report and checks it matches an exact pinned hash (633b4353cf739f0744ae3618308c9cbe1c517d9da0bde1f1c2140c1446906a01) of the compose file (this locks the JavaScript source, image digests, Wireguard peer key, search commitment)guest_os- Hashessha256(MRTD || RTMR0 || RTMR1 || RTMR2), taken directly from Intel’s hardware signedTDReport10field, and checks it is pinned to the exact boot registers (5116a21bf8d014d61cfbbfa57ed567336731447d45139cde3102515ec9d38905) of the exactdstack-0.6.7image we use (locks virtual firmware, Linux kernel, command line, initrd)
If a check fails the client aborts and doesn’t send anything.
How tool leases and billing work
The natural implementation is to call back to the billing server from the enclave on each search – but this would leak the exact time and number of tools searched for each time to Obscurify.ai. To avoid this, authorization uses short lived Ed25519 “leases” (tkt2_<payload>.<sig>) that are verified in enclave RAM (against a public key SEALED_TICKET_PUBKEY, 96298041faf85f8592623384b6a2a0f0d951b76eaa2fe087c11893e03968b6d0).
When a signed-in chat wants to use tools, by default your device asks for a short-lived “lease” from POST /web/tools/ticket over the chat’s private session. These sessions are funded with RFC 9474 blind-signed vouchers that prevent our server from linking it to your account. The server returns a signed lease containing {lid, exp, fee, cap, credit}. These are a random lease ID, a timestamp when the lease expires, a fee multiplier, a maximum amount that can be charged per call and some USD credit pre-held for paid tools. Note that there is no user ID, account code or session secret in this lease!
Your client will then put the lease in a JSON object {lease, name, arguments, request_id?} and pad the JSON plaintext to a specific size (either 4 KB, 16 KB, 64 KB or 256 KB) and encrypt that to the enclave’s attested public key (using secp256k1, HKDF-SHA256 and AES-256-GCM). The HTTP request doesn’t have an Authorization header. When the response comes back it is padded to the same set of byte buckets and encrypted to your device. There is no price field in the clear!
For the free tools (web_search, fetch_url, market_search and market_inspect) we check the ed25519 signature and do rate limiting purely in RAM, inside the enclave. In fact these tools make zero callbacks to Obscurify.ai and write zero database rows. Once we issue a tools lease to your device we have no way of knowing if you made 20 web_search calls or 0.
Paid catalog tool calls (e.g. market_call) deduct the cost of the call from the credit field in the enclave RAM. The cost is the sum of the underlying vendor rate from the catalog plus our standard tool fee (/pricing, /models). Running totals are maintained in the enclave RAM. Our server will check for updates to the enclave total on a randomized timer from 15 to 45 seconds, and whenever a private session ends. The Enclave never initiates connections to us. You will only see items in your Chat session ledger like tool:sealed with the accumulated batch sum at the end. Our billing will not record what catalog tools you called!
In Encrypted mode (the tee/* models) tool calls are encrypted in the message stream (as tooltext in obscurify-tee-verify). Your device decrypts the model’s encrypted tool call request, then either executes Python or JavaScript code directly on your device, or executes web search or catalog tools against the TDX tool VM. Then it sends the encrypted tool result back to the model enclave. We can’t read the prompt text in the model enclave or the search queries you send to the tool enclave.
Who sees what
| Party | Search words / URL / tool input and output? | Which tool, individual price of call? | Your identity? |
|---|---|---|---|
| Obscurify.ai + Phala host infrastructure (pooled) | No (for signed-in tool calls): encrypted to the enclave’s RAM in fixed size buckets of 4KB to 256KB. Outbound DNS queries and TLS SNI are within our Wireguard connection (162.159.192.1:2408) | Free tools: Nope. (0 callbacks, 0 DB rows) Paid tools: Only the total (in USD) for the batch (tool:sealed), every 15 - 45 seconds. | Unlinkable “private” session on Obscurify.ai. Phala’s HTTPS ingress server knows your client IP address (unless you use a VPN or Tor) |
| TDX confidential VM | Yes: only within the hardware-encrypted RAM (no request logs) | Yes: in volatile RAM until expiry / settlement of the lease | No: only sees the anonymous {lid, exp, fee, cap, credit} lease object |
Search provider, target website, or monid / treg | Yes: the tool query or API payload (needed to answer the query) | Yes (for that upstream call) | Sees the Cloudflare WARP wireguard exit IP and our (shared) vendor organisation, but not your IP, account code, or chat |
Remaining caveats and threat model
Confidential computing proofs are limited. Here are the limits:
Phala’s ingress sees your IP address (there is no third-party relay in front of the Phala VM) unless you use a VPN or Tor. (Your browser, phone, or CLI connects directly to the HTTPS endpoint of the enclave running on Phala’s cloud. The endpoint address is shown in the curl test below.) obscurify-code supports /tor. However, on Android, Code Mode is disabled when the “always connect through Tor” option is enabled (although using a system VPN does work).
Monid and treg log execution history to the account of the organization that’s paying. All market_call commands are executed with the shared enclave credentials of Obscurify.ai for the respective tool. Hence the inputs and outputs of all paid tools end up in one unattributed pool in the accounts of these third-party vendors. (Neither the third-party vendor nor Obscurify.ai gets a cryptographic link back to your Obscurify.ai account, private session or conversation. But anyone reading the dashboard of this third-party tool can still see the unattributed inputs and outputs!) So don’t give third-party tools your name, your email address, or other private details as inputs!
We don’t publish the name of the search API provider. The measured compose file includes a SEARCH_COMMITMENT (a salted SHA-256 hash of the search API endpoint URL). (So if we wanted to switch search API providers we’d need to change this publicly visible value, but no one else can tell which search API provider we’re using.) We also make use of Phala Cloud’s KMS service. approved_release is left unchecked: Clients verify the specific 64-hex character compose_hash and boot_digest values themselves, rather than reading the value from a Base contract.
If you use the web version of the chat, your browser downloads the JS/WASM verifier, and expected measurement hashes from Obscurify.ai when the page loads. In other words, you trust the web page that is served to your browser. On the other hand, the Android app (version 0.8.69 or later), and obscurify-code have the expected compose hash and guest OS boot digest compiled into the client code.
To reduce correlation based on message size, we round message sizes to buckets (between 4 and 256 KB), and add 15-45 seconds of jitter before making the payment. To correlate based on timing, during quiet hours, Phala and Obscurify.ai (pooling what we both see) might be able to compare the lease start/stop timestamps against the ingress traffic to the service and narrow it down to when you were active.
When “Code Mode” is enabled in a signed-in standard (not Encrypted) chat, web search and ‘catalog’ tool calls are executed in the TDX VM (and Python / JavaScript code on your device). But the model’s messages still go through our server. To render both the conversation and the tools opaque to us, enable E2EE (via tee/* models). Signed-out guests (who have no account, private session or ‘tool lease’) still use our free server-side web search. Note that the security of the “enclave proof” is also predicated on Intel TDX CPU memory encryption and the Intel attestation signing keys working as specified.
Brave Leo has search in its model enclave (behind an IP-hiding relay). Tinfoil has a ‘search enclave’ next to its model enclave. Confer has a chain of attested enclaves. Apple has Private Cloud Compute (via Oblivious HTTP relays). We combined several things. The client verifies both the container compose and the boot registers of the guest operating system. And on top of that we have client-initiated (not server-side) encrypted tool calls from both Encrypted and plain chats, arbitrary webfetch (HTTPS), 4000+ APIs from existing paid marketplaces and ‘private sessions’ (paid for by RFC 9474 ‘blind voucher’).
Verify the live enclave yourself
You can fetch a live quote from our production tool enclave, and verify it yourself, using obscurify-tee-verify:
NONCE=$(openssl rand -hex 32)
curl -s "https://2f8529d5f8deaa823b88262719630eddad540043-8095.dstack-pha1-prod9.phala.network/aci/attestation?nonce=$NONCE" > quote.json
The returned JSON includes Intel’s signed TDX quote for the enclave. The (full) contents of the measured app_compose ( tool-runner.mjs , marketplace.mjs and the sing-box Wireguard configuration) are also returned as well as the ephemeral secp256k1 public key of the enclave (bound to $NONCE ).
Frequently asked questions
Do web search and paid tools work in Encrypted mode (tee/*) chats now?
Yes. Signed-in Encrypted mode (tee/*) chats on the web, obscurify-code and the Android app (0.8.69+) now support code execution and web search.
You can run Python and JavaScript code locally on your device.
You can use web search and 4,000+ other tools from the tool catalog.
Web search and the catalog tools run inside an “attested” Intel TDX “tool” VM.
Tool calls are end-to-end encrypted so the Obscurify.ai server cannot see them.
Does Obscurify.ai log which websites I fetch or what I search for?
The free tools (web_search, fetch_url, market_search and market_inspect) make no callbacks to Obscurify.ai and log nothing to a database. (They will verify an Ed25519 signed lease from Obscurify.ai in Enclave RAM first).
The Enclave sends its outbound DNS and HTTPS traffic via a Wireguard tunnel to 162.159.192.1:2408.
Paid catalog tools (like market_call) return only a batched sum of USD spent to Obscurify.ai (with the result annotated as tool:sealed). These tools will make a request to the upstream marketplace vendor (e.g. Monid, treg) that will be logged but not attributable to you (as the call is under our shared organization account). Please be aware that anyone with access to the upstream vendor logs will be able to see the raw tool call input and result.
Why does the verifier pin guest OS boot registers (MRTD and RTMR0..2) in addition to the compose hash?
In Intel TDX, RTMR3 is extended (updated) by user-space scripts inside the guest operating system. If you verified only RTMR3, then a malicious (or hacked) VM host could provide a modified guest OS image that would report the expected compose hash to the verifier. By pinning the value of sha256(MRTD || RTMR0 || RTMR1 || RTMR2) reported in the Intel hardware signed TDReport10 data structure, we ensure that the guest OS boot registers are set to values we expect for the dstack-0.6.7 non-dev build.
How do I hide my IP address from the confidential VM’s ingress?
Use a VPN or Tor.
Tool calls are sent encrypted from your client directly to the HTTPS endpoint of the enclave (which is hosted on Phala Cloud). The Phala gateway will have visibility into the source IP address of this connection, unless you route this connection via a VPN or obscurify-code’s /tor mode.