BONKbot’s Secure Signer Architecture: Dedicated TPM-based System with WASM signing verification vs. TEEs
Overview
At BONKbot, we’ve developed a non-custodial signer system that combines a custom Trusted Computing Device with user-authorized WASM modules for transaction validation. Our goal is to achieve CEX-like execution speeds on Solana while maintaining non-custodial security.
Terminology
- TPM: Trusted Platform Module
- HSM: Hardware Security Module
- TEE: Trusted Execution Environment
Our Approach: Dedicated TPM-based System vs. TEEs
We run a dedicated system with TPM as the basis vs. other isolation methods (TEEs, VMs with SVE etc) on top of things.
-
Dedicated Hardware Environment: Unlike TEEs, which are typically used in shared or untrusted environments, our system operates on dedicated hardware. This allows for a more comprehensive and tailored security model. For example, using the TPM to verify the integrity, the platform key and the OS that is being run.
-
Side-Channel Attack Resistance: Our TPM-based approach is inherently more resistant to on-device side-channel attacks. TEEs, including SGX and TDX, have a history of vulnerabilities in this area and require specific measures to prevent such attacks.
-
Verifiability: TEEs essentially provide deep insulation of code within an untrusted environment. Our system, built on a custom minimal Linux kernel with TPM, offers better verifiability of the entire security stack.
-
Customization: The dedicated hardware and software environment allows for implementation of tailored security measures that aren’t possible with general-purpose TEEs. For example, being able to write a custom linux kernel with added security measures.
-
Less resource constraints: Bandwidth in/out of TEEs and their allocatable memory are severely limited. Using a dedicated system gives us as much RAM as we want.
-
TPM and TEE roles: Base layer TPMs (dTPM or fTPM), if correctly designed, give a high assurance about the code running and manage access to keys based on the state of the system (hardware, firmware, configuration, OS, application…). TEEs isolate execution from host environments, and sometimes add state-measurement for key access as well (or use TEE-unique keys to do this).
-
TEE advantages and limitations: The upside of the TEE is the reduction of the code required for the application to be useful, since hardware is abstracted away behind a message passing interface with the host environment. This makes TEE code far easier to audit IFF the host environment were trustworthy - which it likely isn’t. To get a trustworthy environment, the host needs to be measured against a known good configuration as well. And the known good configuration must be established first.
-
Use cases for TEEs vs TPMs: This means that TEEs are a quick way to trusted execution IFF one is willing to trust the host environment but does not control it (like cloud instances), and TPMs on dedicated systems provide the host trust. Unikernels are then the efficient way to translate trusted hosts into trusted applications.
-
Cost considerations: TEEs are cheaper to run, given the known tradeoffs.
-
Our decision rationale: We decided to use the TPM-unikernel-dedicated-host approach to prevent vendor lock-in, cloud-provider lock-in, and reliance of not well understood third party stacks, while playing it safer on the sidechannel risk (which is extremely hard to mitigate).
-
Security approach: We consider it easier to secure a unikernel host and app, vs a general purpose host and a TEE.
-
TEE usage: Now, this doesn’t mean that we do not use any TEE functionality - but we don’t rely on it as integral parts of our architecture.
Auditable Security of Trading Intent
-
WASM-based Transaction Validation: User-authorized WASM modules define and verify the “shape” of each transaction type. This ensures that every transaction matches the user’s intent precisely.
-
Sub-millisecond Verification: Our WASM modules perform transaction verification in under 0.5ms, enabling high-speed, intent-based execution.
-
Isolated Execution: WASM modules run in a WASI-targeted, sandboxed environment, communicating only via shared memory.
-
Constraint-based Intent Definition: Each transaction type is defined by a set of constraints. This allows for precise intent capture and validation.
Link to full technical blog post for more details
Link to twitter thread also diving into WASM modules
We welcome feedback and discussion.