{"id":106953,"date":"2022-02-16T09:00:00","date_gmt":"2022-02-16T17:00:00","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/?p=106953"},"modified":"2023-08-03T13:17:23","modified_gmt":"2023-08-03T20:17:23","slug":"ice-phishing-on-the-blockchain","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/02\/16\/ice-phishing-on-the-blockchain\/","title":{"rendered":"\u2018Ice phishing\u2019 on the blockchain"},"content":{"rendered":"\n
The technologies that connect us are continually advancing, and while this brings tremendous new capabilities to users, it also opens new attack surfaces for adversaries and abusers. Social engineering represents a class of threats that has extended to virtually every technology that enables human connection. Our recent analysis of a phishing attack connected to the blockchain reaffirms the durability of these threats as well as the need for security fundamentals to be built into related future systems and frameworks.<\/p>\n\n\n\n
Credential phishing haunts our customers day in and day out in the web2 world, which is the version of the internet that most of us are familiar with and use today. It\u2019s a profitable business for cybercriminals, even if margins are slim and there\u2019s significant risk associated with monetizing credentials to a business (for example, through human-operated ransomware attacks<\/a>). Now, imagine if an attacker can \u2013 single-handedly \u2013 grab a big chunk of the nearly 2.2 trillion US dollar cryptocurrency market capitalization<\/a> and do so with almost complete anonymity. This changes the dynamics of the game and is exactly what\u2019s happening in the web3 world multiple times a month<\/a>.<\/p>\n\n\n\n Web3 is the decentralized world that is built on top of cryptographic security that lays the foundation of the blockchain (in contrast, web2 is the more centralized world). In web3, funds you hold in your non-custodial wallet are secured by the private key that is only known to you. Smart contracts you interact with are immutable, often open-source, and audited. How do phishing attacks happen with such a secure foundation?<\/p>\n\n\n\n This is what we will explore in this blog. We will share some necessary background information, and then dive into the Badger DAO attack<\/a>, a phishing attack that occurred in November-December 2021, during which the attacker was able to steal approximately 121 million US dollars from users.<\/p>\n\n\n\n The Badger DAO attack highlights the need to build security into web3 while it is in its early stages of evolution and adoption. At a high level, we recommend that software developers increase security usability of web3. In the meantime, end users need to explicitly verify information through additional resources, such as reviewing the projects documentation and external reputation\/informational web sites.<\/p>\n\n\n\n To dissect the attack, we need the necessary background.<\/p>\n\n\n\n The blockchain is a distributed ledger secured by cryptographic algorithms. It can be thought of as a database that shows transfers of cryptocurrency coins from one account to another. The largest blockchains by market capitalization today are Bitcoin and Ethereum. Transactions you submit to a blockchain may modify the ledger, for instance, by transferring cryptocurrency coins from your account to another account.<\/p>\n\n\n\n Blockchains are public, meaning all transactions are visible publicly. Blockchain web front ends (e.g., https:\/\/etherscan.io\/<\/a> for the Ethereum blockchain) exist to explore transactions, accounts, and smart contracts.<\/p>\n\n\n\n Accounts are associated with the cryptocurrency coins you may hold. On the blockchain this is represented by an entry in the ledger that transfers cryptocurrency coins from one account to your account. From a set of such entries you can derive account balances.<\/p>\n\n\n\n Wallets visualize the cryptocurrency coins associated with your account. Contrary to popular belief, wallets actually do not hold your cryptocurrency coins. Cryptocurrency coins are stored on the distributed ledger, i.e., the blockchain. A wallet allows you to use its cryptographic keys to sign transactions that take action (e.g., transfer to another account) on the cryptocurrency coins associated with your account. In other words, your cryptographic keys give you access to your cryptocurrency coins. Disclose that key to a different party and your funds may be transferred without your consent.<\/p>\n\n\n\n There are two types of wallets \u2013 custodial wallets and non-custodial wallets. The former are wallets associated with cryptocurrency exchanges, whereas the latter is a wallet local to your device. The big difference between the two is who has access and manages the cryptographic keys to sign transactions. Non-custodial wallets provide the owner access to the cryptographic keys, whereas custodial wallets do not.<\/p>\n\n\n\n Smart contracts are code deployed on the blockchain that can hold cryptocurrency coins and transact . Smart contracts only execute when a regular account (also called externally owned account (EOA)) or another smart contract triggers its execution.<\/p>\n\n\n\n Triggering the execution of smart contracts is not trivial. One has to (1) create a valid transaction populating its fields appropriately, (2) sign the transaction with one\u2019s private key, and (3) submit the transaction to the blockchain. In order to increase usability, smart contract providers often create a smart contract front end so users can interact with the smart contract using familiar tools, such as a browser (with a non-custodial wallet plugin.) In the security context, one must consider the entire front-end stack, including content distribution services.<\/p>\n\n\n\n ERC-20 tokens are special types of cryptocurrency coins (i.e., tokens) that are implemented via an ERC-20 smart contract, essentially as a balance sheet with a set of functions that allow the transfer of these tokens from one account to another. Each ERC-20 token has its own smart contract that implements the ERC-20 token standard<\/a>. For example, LINK<\/a> is a token.<\/p>\n\n\n\n In order to transfer tokens from one account to another, the sender of the transaction needs to be approved to transfer those tokens. The owner of the token is automatically approved for those transactions, but the owner can also delegate approval to additional entities, like smart contracts, so those smart contracts can move funds on behalf of a user. This is required for decentralized finance (DeFi) smart contracts, such as decentralized exchanges (DEXes), as these are used to exchange tokens of different types (e.g., LINK for USDC token on Uniswap V3 DEX<\/a>).<\/p>\n\n\n\n A decentralized exchange (DEX) allows you to trade cryptocurrencies while owning your private key, thus keeping full control of your cryptocurrency. Hardware wallets can be used with DEXs, giving users a higher level of security for a user’s private keys.<\/p>\n\n\n\n There are multiple types of phishing attacks in the web3 world. The technology is still nascent, and new types of attacks may emerge. Some attacks look similar to traditional credential phishing attacks observed on web2, but some are unique to web3. One aspect that the immutable and public blockchain enables is complete transparency, so an attack can be observed and studied after it occurred. It also allows assessment of the financial impact of attacks, which is challenging in traditional web2 phishing attacks.<\/p>\n\n\n\n Recall that with the cryptographic keys (usually stored in a wallet), you hold the key to your cryptocurrency coins. Disclose that key to an unauthorized party and your funds may be moved without your consent. Stealing these keys is analogous to stealing credentials to web2 accounts. Web2 credentials are usually stolen by directing users to an illegitimate web site (e.g., a site posing as your bank) through a set of phishing emails.<\/p>\n\n\n\n While attackers can utilize a similar tactic on web3 to get to your private key, given the current adoption, the likelihood of an email landing on the inbox of a cryptocurrency user is relatively low. Instead, different tactics can be employed to reach and trick cryptocurrency users into giving up their private key:<\/p>\n\n\n\n The \u2018ice phishing\u2019 technique we discuss in this post doesn\u2019t involve stealing one\u2019s private keys. Rather, it entails tricking a user into signing a transaction that delegates approval of the user\u2019s tokens to the attacker. This is a common type of transaction that enables interactions with DeFi smart contracts, as those are used to interact with the user\u2019s tokens (e.g., swaps) as shown in Figure 1. Figure 2 and 3 show what the approval can look like. In this example, we show the initial approval (step 1 in Figure 1), interface, and transaction signature requests that are needed for the Uniswap DEX to exchange USDC tokens for LINK tokens. Note that the spender in the legitimate request is 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45<\/a> (the Uniswap V3: Router 2). Once the approval has been granted, it permits the Uniswap V3: Router 2 smart contract to transfer USDC tokens on the user\u2019s behalf to execute the swap (steps 3 and 4 in Figure 1).<\/p>\n\n\n\n <\/p>\n\n\n\nOverview: Web3 concepts<\/h2>\n\n\n\n
Blockchain<\/h3>\n\n\n\n
Accounts and non-custodial wallets<\/h3>\n\n\n\n
Smart contracts<\/h3>\n\n\n\n
Smart contract front ends<\/h3>\n\n\n\n
ERC-20 tokens<\/h3>\n\n\n\n
Decentralized exchange (DEX)<\/h3>\n\n\n\n
Phishing attacks<\/h2>\n\n\n\n