Web3 Phishing Signature Underlying Logic

IntermediateMay 01, 2024
Authorization phishing is a means for hackers to steal user assets by exploiting signature functionality. Common methods include Permit and Permit2 signature phishing. Users should increase their security awareness, segregate large funds from on-chain wallets, and learn to identify signature formats to prevent phishing. Permit2 is a feature introduced by Uniswap that is easily exploited by phishing websites.
Web3 Phishing Signature Underlying Logic

Forward the Original Title ‘大白话讲解Web3签名钓鱼底层逻辑“授权钓鱼、Permit与Permit2的区别’

TL;DR

“Why did I lose my money just by signing my name??” “Signature phishing” is currently becoming the favorite phishing method for hackers in Web3. Recently, I’ve seen many experts like Cosine and various wallets and security companies continuously promoting and educating about the knowledge of phishing signatures. But still, many people are getting phished every day.

One reason Spinach believes is that most people don’t understand the underlying logic of wallet swaps, and for those who are not tech-savvy, the learning curve is too high. So, Spinach decided to create an illustrated version to educate people about the underlying logic of signature phishing, and try to make it understandable even for non-tech-savvy individuals.

First, we need to understand that there are only two types of operations when using a wallet: “signing” and “swaping.” The simplest and most direct understanding is: signing happens outside the blockchain (off-chain), and doesn’t require spending Gas fees; swaping happens on the blockchain (on-chain), and requires spending Gas fees.

The common scenario for signing is to verify that you are you, such as logging into a wallet. For example, if you want to swap tokens on Uniswap, you need to connect your wallet first. At this point, you need to sign a message to tell the website “I am the owner of this wallet,” and then you can use Uniswap. This step doesn’t cause any data or state changes on the blockchain, so it doesn’t require spending money.

As for swapping, when you actually want to swap tokens on Uniswap, you need to spend some money to tell Uniswap’s smart contract: “I want to exchange 100 USDT for Spinach coin, and I authorize you to move my 100 USDT.” This step is called approval. Then, you need to spend another amount of money to tell Uniswap’s smart contract: “I’m now ready to exchange 100 USDT for Spinach coin, you can proceed with the operation now.” After that, you have completed the operation of exchanging 100 USDT for Spinach coin.

After a simple understanding of the difference between signatures and swaps, let’s introduce the principle of phishing. Phishing typically involves three different methods: Authorization Phishing, Permit Signature Phishing, and Permit2 Signature Phishing. These three are very common phishing methods.

Let’s start with Authorization Phishing, which is one of the classic phishing techniques in Web3. As the name suggests, it exploits the authorization (approve) mechanism. As seen in the example of Uniswap, authorization allows a smart contract to “approve you to move xxx amount of my Tokens.” A hacker can create a fake phishing website, disguised as an NFT project with an attractive frontend. In the middle of the website, there’s a beautiful large button saying “Claim Your Airdrop.” When clicked, the wallet pops up with a screen asking you to authorize your Tokens to the hacker’s address. If you confirm this, congratulations, the hacker has successfully completed a KPI.

But Authorization Phishing has a problem: because it requires Gas fees, many people are cautious when it comes to spending money. After clicking on a suspicious website, people often quickly notice that something is wrong, making it relatively easy to prevent.

Now let’s move on to today’s focus: Permit and Permit2 Signature Phishing, which are hotspots in the field of Web3 asset security. Why are they so difficult to defend against? It’s because every time you want to use a Dapp, you must sign in to your wallet. Many people have developed an inertia in their thinking: “This operation is safe.” Plus, it doesn’t require spending money, and most people don’t understand the implications behind each signature.

Let’s first look at the Permit mechanism. Permit is an extension feature for authorization under the ERC-20 standard. For example, USDT, which we commonly use, is an ERC-20 token. In simple terms, Permit allows you to sign and approve other people to move your Tokens. We know that authorization (Approve) is when you spend money telling the smart contract: “You can move xxx amount of my Tokens.” So, Permit is like signing a “note” to someone, stating: “I allow someone to move xxx amount of my Tokens.” Then, this person presents this “note” to the smart contract and pays a Gas fee, telling the smart contract: “He allows me to move xxx amount of his Tokens.” Then your Tokens can be transferred by someone else. In this process, you simply sign a name, but behind it, it means you allow others to call the authorization (Approve) and transfer your Tokens. A hacker can create a phishing website, replacing the wallet login button with a Permit phishing button, making it easy to fish out your assets.

So what is Permit2? Permit2 is actually not a function of ERC-20, but a function launched by Uniswap for the convenience of users. The previous example said that if you want to exchange USDT for spinach coins on Uniswap, you need to authorize (Approve) once and then exchange it. , which requires two gas fees, so Uniswap came up with a way: “You authorize all the quota to me at once, and you sign your name every time you redeem and I will handle it for you.” This function helps Uniswap users You only need to pay the Gas fee once when using it, and this step is signing, so the Gas fee is not actually paid by you, but paid by the Permit2 contract, but it will be deducted from the Token you finally redeem.

However, the condition for Permit2 phishing is that you must have previously used Uniswap and authorized unlimited allowance to the Permit2 smart contract. Since Uniswap’s default operation is currently to grant unlimited allowance, the number of users who meet this condition is quite large. Similarly, as long as a hacker tricks you into signing the Permit2, they can transfer your Tokens (limited to those you’ve previously authorized).

In summary, the essence of authorization phishing is that you spend money to tell the smart contract, “I approve you to move my Tokens to the hacker.” The essence of signature phishing is that you sign a “note” allowing others to move your assets to the hacker, and the hacker spends money to tell the smart contract, “I want to move his Tokens to me.” Permit and Permit2 are currently hotspots for phishing signatures. Permit is an authorization extension feature of ERC-20, while Permit2 is a new feature introduced by Uniswap.

So, how can you prevent these phishing attacks once you understand the principles?

  1. Develop Security Awareness: It’s crucial to always check what operation you’re performing every time you interact with your wallet.

  2. Separate Large Funds and Wallets for On-Chain Activities:** By separating large funds from wallets used for on-chain activities, you can minimize losses if you fall victim to phishing.

  3. Learn to Identify Permit and Permit2 Signature Formats:** Be wary whenever you encounter the following signature formats:

Interactive: URL of the swap

Owner: Address of the authorizer

Spender: Address of the authorized party

Value: Authorized quantity

Nonce: Random number

Deadline: Expiry time

Disclaimer:

  1. This article is reprinted from [ 菠菜菠菜谈Web3]. Forward the Original Title‘大白话讲解Web3签名钓鱼底层逻辑“授权钓鱼、Permit与Permit2的区别”’. All copyrights belong to the original author [菠菜菠菜谈Web]. If there are objections to this reprint, please contact the Gate Learn team, and they will handle it promptly.
  2. Liability Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.
Start Now
Sign up and get a
$100
Voucher!
Create Account