Video thumbnail

TEE Shield

TEE Shield: Protect Web3 users from frontend tampering using on-chain hashes.

Project Description

TEE Shield is a decentralized security solution that addresses one of the most significant yet overlooked vulnerabilities in the Web3 ecosystem: frontend tampering.

While blockchain transactions are secure and transparent, the frontend interfaces that users interact with remain vulnerable to manipulation. Centralized hosting solutions create a critical attack vector where malicious actors can modify frontend code to trick users into approving dangerous transactions or connecting to phishing sites.

Our solution creates a trustless verification system where dApp developers can deploy the frontend of their app into a Trusted Execution Environment (TEE) while commiting the cryptographic hash of their authentic frontend to a verified smart contract. Through our Chrome extension, users receive real-time verification that the frontend of the dApp they're interacting with matches the authentic version registered on-chain.

By leveraging Trusted Execution Environments (TEEs), we ensure that the verification process itself cannot be compromised. When users visit a dApp, our extension automatically compares the current site's hash against the registered hash from the smart contract. Users receive immediate alerts if any discrepancy is detected, protecting them from interacting with potentially compromised interfaces.

TEE Shield bridges a critical security gap in the Web3 ecosystem, allowing users to interact with dApps with confidence while maintaining the decentralized ethos of blockchain technology.

How it's Made

The system consists of these core components:

  1. A public verified smart contract: Developers of a dApp will commit the hash of their authentic frontend into this contract via a dashboard. The contract serves as a trustless record of the legitimate frontend. We also implemented access control mechanisms using OpenZeppelin libraries to ensure only authorized developers can update their dApp's hash. We used Foundry framework.
  2. A developer dashboard/landing page: developers can use this registering and updating frontend hashes of their dapps. Developers can also deploy their frontend into a TEE, while committing the hashes of their frontend into the smart contract. This was built with Javascript using the React framework.
  3. A user-facing Chrome extension: End-users install this extension to assist in verifying the integrity of the frontend they are visiting. The Chrome extension periodically fetch the hash of the smart contracts so as to act as source of truth. We used Javascript to build the Chrome extension.

Besides those core components, we have these intermediary services:

  • A Node.js backend is part of the project. This backend serves as an intermediary or provides functionalities for the dashboard/landing page used by developers to commit their frontend hash to the smart contract
  • A serverless function, written in JavaScript, is deployed on the Marlin serverless platform. This function is responsible for comparing the PCR2 value (a measurement of the TEE's state) read from the IP address of the frontend running in the TEE with the one stored in the smart contract.
  • We also leverage Nillion SecretLLM to enable the extraction of the deployed TEE's data so that developers can understand and use in our dashboard. Nillion SecretLLM is important because we need to protect the integrity of the deployed TEE's data to make sure that it's private and can serve as ground of truth.

The main challenge that we discovered in this project was that we didn't have enough time to handle the Implementation of a function to extract the value of the digest from the deployed TEE IP's attestation. It's too time-consuming and complex to be done in a weekend hackathon. But we found a workaround to make the project still feasible and showcase the true potential of this security application.

background image mobile

Join the mailing list

Get the latest news and updates