Cointime

Download App
iOS & Android

TEE-enabled Social Games: An Experiment with Bobu’s Magic Show

From flashbots by socrates1024

by Xyn Sun, Ryan MacArthur, Roshan Palakkal and Andrew Miller

This week we used TEEs to help Azuki carry out a magic show performance livestreamed to Youtube 6 using the Teleport prototype 14. This post outlines the technical implementation behind it.

Background: Bobu the Magnificent’s magic show

Azuki has a character called Bobu that is governed by ERC-1155 tokens, where holders can vote on proposals on how to use the character’s IP. Because Bobu is all about community ownership and co-creation, the magic trick was one where audience volunteers acted as both the magician’s assistants and the rabbit in a hat. Each of the volunteers used their delegated twitter credentials to tweet out collectively, the digital equivalent of a “Flash Mob.” This collective tweet was a twist on our first trick 4 where a Bobu community member was tweeting from Bobu’s account via on-chain interactions (see 2pmflow’s walkthrough post 4 for details).

|441.37057728119186x299731×497 315 KB

Desiderata

Posting from a bunch of Twitter accounts is, on its own, not too demanding of a magic trick. Like many web2 account providers, Twitter allows users to delegate read/write access to third party applications. Volunteers for the show were explicitly invited to opt-in to the show’s app and offer “Read/Write” access. Users had to specifically click “Authorize Bobu to access your account”, post to their account, follow/unfollow, everything.

695×677 58.7 KB

But, Bobu only needs to post one tweet for his magic trick. We don’t need all the rest of the authority that Read/Write gives you. And users don’t like to give this away! This is an instance of “over-authorizing”, and it’s the main problem we use TEE to address.

What’s the worst that could happen?

In a normal Twitter app web service, the app owner retains raw access to the OAuth credentials. Even though the show only wanted to Tweet once, the app owner could hang on to the oauths after the show. They’d be tempted to use the oauths for just one more purpose. Lose them to malware where they’re sold to unscrupulous advertisers. Bots will shill their scam coins from your account and boot misinformation. Like in the $OPENAI hack.

Where do TEEs come in?

Basically we use TEE to proactively show none of those bad outcomes could have happened. We can show a chain-of-custody that explains the entirety of the software that was running, guaranteeing the following:

  • We never have access to the raw oauth credentials, they’re kept within a TEE only.
  • We show a chain of custody of the TEE program that uses the oauths, but only to post one tweet.
  • Users were shown a consent notice presenting a more refined-version of the authentication we are given before they volunteered.

What is in the notice?

In this case, we create an on-chain event log of everything that happens during the show, including the twitter ID and Bobu’s tweet. This is on the Arbitrum blockchain, which is practically immutable. And that users were given a pointer to further mitigations, e.g., educating them that you can withdraw your consent at any time from the X settings page and tweets can be deleted.

665×592 56.9 KB

How do we ensure the chain of custody?

  • The Teleport TEE backend is implemented in Rust and run in a TEE using Gramine-SGX. Bobu’s magic show was on its own independent instance: GitHub - Account-Link/teleport-gramine-rs at bobu 1
  • An Ethereum private key is generated within the enclave and stored as a sealed file. The corresponding public key is authorized as the “minter” for the smart contract.
  • One-time posting is enforced by having the Arbitrum rollup Smart contract 1 serving as a monotonic counter so you cannot “double spend” the credentials.
  • A TLS private key is also generated from within the enclave, and a certificate signing request CSR is output. We get a certificate issued from Let’s encrypt for this. The Certificate Transparency logs can be used to enumerate all the certificates that were active from the signup period through the show.
  • The remote attestation is included in the github repository, showing that the given address and the public key contained in the certificate were generated from the TEE.
  • We include a script for examining the certificate transparency logs, so we can enumerate all the certificates issued for the domain https://bobutee.account.link/ 2. Auditors can match each of these with the quotes provided.
  • The docker image used to build the enclave is published to dockerhub, so that the packages and system libraries used can be inspected by auditors, even retroactively.

What’s the threat model?

Our goal is to produce a robust audit log, then the threat model includes malware on the server, the server getting hacked, malicious system administrators on the server. None of these should be able to scoop up all the Oauth codes. The “excessive use,” where we’re tempted to “make just one more post” and stretch the policy, is more of a salient attack than the “nation state misinformation campaign” attacker.

What are the other caveats?

This is just a prototype. We haven’t gone through a security audit yet! The performance is considered low-stakes, so we kept developing close to the demo. Some limitations are clear. There are dependencies on the QuickNode API provider, and the Arbitrum blockchain itself. The finality of this blockchain is responsible for the one-time use. So for example, malicious data from the QuickNode API could also disrupt this. Ideally, the TEE would be running a light client for a chain that’s resistant to re-orgs like what we did in Sirrah 1.

Where’s the ZK?

A cool blockchain-native trick with privacy… surely this must be enabled by trendy ZK tech? We frequently get this question, since ZK is a flexible set of privacy enhancing tools. The answer is “No”, and in fact ZK wouldn’t work for this. You simply can’t manage “Write” access to a web2 account with ZK alone. It is a little complicated to unpack. ZK and TEE are often substitutes (you can use either of them for a rollup proof) and usually complements too (if you use both, like multiprover, it’s defense in depth). But here, for handling credentials, ZK isn’t suitable at all (the prover would be able to steal the credentials). Sometimes MPC can split across, but still have to trust them not to collude. In principle “ZK, TEE, and MPC” all fit together in the future. But the present implementation of the Bobu magic show based on Teleport uses just TEE. We can’t rule out nation state attackers, or mistakes. But, we also aren’t using it to store your private keys. It’s appropriate for improved handling of Twitter credentials.

How about zkTLS?

In our view, zkTLS would not have been able to achieve the Bobu stunt. In zkTLS, if you require the user to make a credible commitment to an action, users will need to do a “push” where they perform the action first, and then submit to you a zkTLS proof. This means the user i) has to submit an economic bond, which makes the barrier of entry higher, and ii) can perform a liveness attack where they refuse to perform the action (at the penalty of being slashed). However with TEEs, it becomes a “pull” model, where the user only need to click once and the TEE will automatically perform the credible action. In short, zkTLS is “credible read” and TEEs enable “credible reads AND credible writes.” In the Bobu magic show, this credibility and privacy is only to the extent of the OAuth token (the account is still “owned” by the user, only the OAuth token is fully “owned” by the TEE). This is because magic shows are relatively low-stake, so partial encumbrance 1 is enough. For other high-stake applications, we may consider full encumbrance 2 of web2 accounts.

What’s next?

Among the caveats like this, one of the most unsatisfying is: what twitter app could users have been shown? We want to make it so the X developer account owner couldn’t do a liveness attack on the show by revoking access to the keys. How can we do this? We could use account-encumbrance to show that only the bobutee.account.link url was the authorized one. It might be a good idea to serve the entire frontend from a website as well. 

So, how did it work out, and how do we critically examine the audit log?

Stay tuned for a follow up retro that digs into what the audit log reveals about how the show and our preparation for it went…… We’ll need another post to unpack it and apply the audit framework above to the actual on-chain and transparency log data sets we produced!

Comments

All Comments

Recommended for you

  • Trump: Does Not Believe Shooting Incident is Related to Iran Conflict

    On April 26, U.S. President Trump stated (when asked if the shooting incident was related to the Iran conflict) that he does not believe so. (Jinshi)

  • Latest Progress on DeFi United Ecological Rescue Initiative: Over 100,000 ETH Raised at Designated Donation Address

    On April 26, the DeFi United ecological rescue initiative, led by Aave, continues to advance. The Arbitrum DAO has released 30,765 ETH that was frozen after the rsETH incident on April 18. Currently, the designated donation address has raised a total of 100,360 ETH to address the collateral asset gap caused by the rsETH incident. The plan aims to restore the backing assets of rsETH through multi-party collaboration, stabilize the market, and prevent the spread of bad debts across protocols. The funds will be used to support the restoration of collateral rates and to gradually normalize the market in conjunction with relevant protocols. Key contributors or participants currently include: Arbitrum DAO releasing 30,765 ETH frozen after the rsETH incident, Mantle proposing to contribute 30,000 ETH, Aave DAO proposing to contribute 25,000 ETH, Aave founder Stani Kulechov confirming a contribution of 5,000 ETH, EtherFi proposing to provide 5,000 ETH, Lido proposing to provide 2,500 stETH, and the Golem Foundation and related projects contributing a total of 1,000 ETH, among others. Additionally, LayerZero, Ethena, Frax Finance, and Ink Foundation have also confirmed their participation, although the specific amounts have not yet been disclosed. It is important to note that the progress of this rescue initiative still relies on several external key conditions, including KelpDAO's restoration of rsETH redemptions and the Arbitrum Security Council's release of frozen assets, resulting in uncertainty regarding the overall recovery time and effectiveness.

  • Trump Evacuated from White House Correspondents' Dinner Due to Security Incident

    On April 26, local time April 25, U.S. President Trump was urgently evacuated from the White House Correspondents' Dinner due to a security incident. (CCTV News)

  • Shooting Incident at White House Correspondents' Dinner; Gunman Dead

    On April 26, local time on April 25, a shooting incident occurred in the hall of the White House Correspondents' Dinner, and the gunman is now deceased. (CCTV News)

  • Trump States He Will Not Allow Banks to Undermine Cryptocurrency Market Legislation

    On April 26, CoinDesk reported, citing attendees at a Trump cryptocurrency event, that Trump stated he would not allow banks to undermine cryptocurrency market legislation.

  • Iranian Officials to Depart Pakistan Without Meeting U.S. Representatives

    On April 25, according to a reporter from the New York Post: The Iranian delegation is set to leave Islamabad, the capital of Pakistan, and has consistently emphasized that they did not meet with U.S. officials during their brief visit.

  • Foreign Media: Second Round of Iran-U.S. Talks Scheduled for April 27

    On April 25, according to New Delhi Television: The second round of talks between Iran and the United States is scheduled to take place on April 27.

  • Iranian Lawmaker: Comprehensive Plan for Managing the Strait of Hormuz Formed

    On April 25, according to a report by Iran's Mehr News Agency, Iranian Islamic Parliament member Behnam Saidi stated that Iran has developed a comprehensive plan for managing the Strait of Hormuz. In an interview with Mehr News Agency, Saidi mentioned that an important aspect of this plan is the exclusive recognition of the name 'Persian Gulf' in all correspondence and commercial documents, rejecting any other names. Vessels and ships navigating in the region must obtain permission from Iran. Sovereignty over the Strait of Hormuz will be entirely under Iran's control. He also stated that vessels identified as hostile by the Supreme National Security Council or the General Staff of the Armed Forces of Iran are not allowed to pass through the Strait of Hormuz, and Israeli vessels are absolutely prohibited from entering the area. Ships passing through the region must pay relevant fees concerning safety, environmental protection, shipping management, and licensing, with priority given to payments in rials.

  • DeepSeek Plans to Raise $1.8 Billion with a Valuation of Approximately $20 Billion

    Sources reveal that the main reason for DeepSeek's current fundraising effort is the significant recent talent loss. Several core researchers have left the company to join ByteDance, Tencent, Xiaomi, and autonomous driving company Yuanrong Qihang. Meanwhile, competitors Zhiyu Technology and MiniMax have listed on the Hong Kong Stock Exchange, and the company Dark Side of the Moon has completed three rounds of financing in the first three months of this year, with a valuation more than quadrupling since the end of last year.

  • Iran Warns U.S. Against Continuing Piracy Actions

    On April 25, according to CCTV International News, Iran's Khatam al-Anbia Central Command issued a statement today warning that if U.S. forces continue to implement 'blockades, maritime interceptions, and piracy actions' in the region, they will face a strong counterattack from the Iranian armed forces. The statement emphasized that the U.S. should recognize that Iran's military capabilities and preparedness in safeguarding national sovereignty, territorial integrity, and national interests are stronger than ever, as demonstrated in previous conflicts. The statement also noted that Iran will continue to monitor enemy actions and movements and maintain control over the Strait of Hormuz. Should the enemy take further actions, Iran will respond with even harsher strikes.