header-langage
简体中文
English
Tiếng Việt
Scan to Download the APP
Partnered With:

One signature resulted in the theft of $500,000, what should we watch out for

Read this article in 4 Minutes
Think Twice About Any Signature

Original author: @korpi87
Original compilation: Kxp, BlockBeats


It may be hard for you to imagine , a simple signature in Metamask can empty your wallet. But such a thing happened to a veteran user, and today he lost nearly 500,000 USDC due to a bug. If you're not careful, you could be next. So, today I want to tell you the ins and outs of this matter, and tell you how to pay attention to such problems in the future.


It was a quiet afternoon when Joe (pseudonym) suddenly found that his wallet had been 469,000 USDC was transferred. This transfer is not simple, and it is certainly not something an attacker can do, because it is impossible for them to get access to Joe's wallet. That means that it should be a malicious contract that transferred all his USDC.



Before telling today's story, I need to explain some terms to you. USDC is a contract with multiple functions on Ethereum, which specifies how we can use USDC.


Among the many functions, we need to pay special attention to the following two functions:

p>

Transfer (transfer)


Transfer (transferFrom )


< img src="https://image.blockbeats.cn/upload/2022-08-27/72df229aa747ee3f62ac13af9cbfddeddfe4d356.png?x-oss-process=image/quality,q_50/watermark,image_d2F0ZXJtYXJrbmV3LnBuZz 94LW9zcy1wcm9jZXNzPWltYWdlL3Jlc2l6ZSxQXzIw,g_center/format,webp">< /p>


When you need to transfer USDC between wallets, or other ERC20s, you need to use transfer Function. It can transfer tokens from the caller (the address that called the function) to other addresses. If someone can maliciously use this function in your name, he must first have full access to your wallet.



When you interact with the contract, they will transfer your Token through the transfer function, and the specific amount is preset by you in advance ratio is determined. So if you allow a contract to transfer an unlimited amount of USDC, it could theoretically take all of your USDC.


Now let’s go back to Joe’s story, transferFrom is indeed the one who transferred all his USDC Function. However, transferFrom will only work if Joe approves the contract to use his USDC. But in fact, Joe is convinced that he didn't approve anything.



However, DeBank's transaction records clearly show that 10 minutes before the breach occurred, the malicious contract could use the USDC in the account indefinitely. The question then becomes, who gave the contract this approval, if not Joe himself? All I can say is that Joe did approve the operation, but it was done without his knowledge.



The information on Etherscan shows that Joe himself did not call this function, and it was other addresses that actually approved this amount, which made the The malicious contract was able to spend all of Joe's USDC.


We can't help but wonder, how can someone else give the contract permission on my behalf?



The permission function was originally introduced to improve the user experience of Ethereum. Amend the approved amount under the circumstances. That is, with your signature, anyone can call the permission function and update your approval amount for the contract.



When you use 1inch dApp, you can experience this feature. If you want to sell USDC on it, you don't need prior approval, just sign your name. With this signature, 1inch has access to all your USDC. Although 1inch will not spend all your USDC for no reason, it gives malicious contracts an opportunity.



Joe must have accidentally signed on a malicious website such information. Unfortunately, he used a hot wallet that time, and the signature was just a click away. If he is using a hardware wallet, he needs to sign the information on an external device, so there will be a thinking time.


With Joe's signature, other addresses can submit a transaction with permission function, In this way, the malicious contract has obtained the usage authority of all USDC in Joe's wallet. Then, whenever it calls the transferFrom function, it can transfer all those funds away.



So, a seemingly small signature can lead to a huge disaster. In some cases, Metamask will warn you about the dangers when you are about to sign. Signing a message can be dangerous. However, some technical approval signatures will not receive early warning, but these can often cause huge losses if abused.


How to avoid similar problems in the future?


1. Don't sign everything in Metamask;


2. Take the time to understand what you are signing;


3. Be careful with traditional approvals.


Original link


Welcome to join the official BlockBeats community:

Telegram Subscription Group: https://t.me/theblockbeats

Telegram Discussion Group: https://t.me/BlockBeats_App

Official Twitter Account: https://twitter.com/BlockBeatsAsia

Choose Library
Add Library
Cancel
Finish
Add Library
Visible to myself only
Public
Save
Correction/Report
Submit