SlowMist: An Analysis of the Attack on DAO Maker (Released in 2021)
On August 12, 2021, according to SlowMist Zone, cryptocurrency incubator DAO Maker was suspected to have suffered a hack attack, resulting in a large amount of USDC being transferred out of the contract. SlowMist’s security team immediately intervened to analyze the attack, and the results are shared below.
Attack Information
In this attack, the attacker deployed and open-sourced an attack contract (0x1c) to quickly and in bulk steal funds from DAO Maker’s victim contract (0x41).
Attacker address 1:
0xd8428836ed2a36bd67cd5b157b50813b30208f50
Attacker address 2:
0xef9427bf15783fb8e6885f9b5f5da1fba66ef931
Attack contract:
0x1c93290202424902a5e708b95f4ba23a3f2f3cee
DAO Maker victim contract:
0x41B856701BB8c24CEcE2Af10651BfAfEbb57cf49
DAO Maker victim contract deployer: 0x054e71D5f096a0761dba7dBe5cEC5E2Bf898971c
DAO Maker victim contract admin: 0x0eba461d9829c4e464a68d4857350476cfb6f559
Attack Details
What makes this attack different from previous ones is that the DAO Maker victim contract (0x41) was not open-sourced, while the attack contract (0x1c) was open-sourced.
From the open-source attack contract and the on-chain records, we can see that:
1. The attacker called the h function of the attack contract (0x1c), which will loop through calling the f function. The f function retrieves the amount of USDC deposited by ordinary users in the victim contract (0x41) through the 0x4b4f892a function.
2. The h function then calls the withdrawFromUser(0x50b158e4) function of the DAO Maker victim contract (0x41), passing in the user address with the USDC address and the amount to be withdrawn.
3. Then the victim contract (0x41) transfers the USDC in the contract to the attack contract (0x1c).
From the above analysis, we can see that the attack contract (0x1c) called the withdrawFromUser function of the victim contract (0x41), and the victim contract (0x41) directly transferred the funds managed by the contract to the attack contract (0x1c). We can decompile the victim contract (0x41) and analyze the withdrawFromUser function.
Through the decompiled code, we can see that the withdrawFromUser function in the DAO Maker victim contract (0x41) has permission checks, which means only DAO contracts can call this function to transfer user funds. However, the attack contract (0x1c) clearly is not a DAO contract, indicating that the DAO contract was replaced by the attacker.
Through on-chain analysis, we can see that:
- After deploying the victim contract (0x41), the deployer (0x05) set the address 0x0eba461d9829c4e464a68d4857350476cfb6f559 as the admin role on April 12th, 2021, at 08:33:45 UTC.
Tx Hash:
0xa1b4fceb671bb70ce154a69c2f4bd6928c11d98cbcfbbff6e5cdab9961bf0e6d
2. Then, the deployer (0x05) revoked the admin role of the victim contract (0x41) through the revokeRole function.
Tx Hash:
0x773613398f08ddce2cc9dcb6501adf4f5f159b4de4e9e2774a559bb1c588c1b8
3. Later on, on August 12th, 2021, at 01:27:39 UTC, the admin set the DAO contract to the attack contract (0x1c).
Tx Hash:
0x2fba930502d27f9c9a2f2b9337a0149534dda7527029645752b2a6507ca6b0d6
Therefore, the attacker was able to steal user funds from the victim contract (0x41) with the help of the attack contract (0x1c). The stolen funds have been exchanged to ETH and transferred to the attacker’s address 2 (0xef).
Summary
This attack may have originated from the leaked private key of the DAO Maker victim contract administrator. The attacker replaced the victim contract DAO contract with the attacker contract after stealing the private key, and the attacker transferred the user funds from the replaced contract. Since the contract deployer gave up the contract management authority after setting the contract administrator, the project party may still not be able to effectively retrieve contract control.
About SlowMist
SlowMist is a blockchain security firm established in January 2018. The firm was started by a team with over ten years of network security experience to become a global force. Our goal is to make the blockchain ecosystem as secure as possible for everyone. We are now a renowned international blockchain security firm that has worked on various well-known projects such as Huobi, OKX, Binance, imToken, Crypto.com, Amber Group, Klaytn, EOS, 1inch, PancakeSwap, TUSD, Alpaca Finance, MultiChain, O3Swap, etc.
Website:
https://www.slowmist.com
Twitter:
https://twitter.com/SlowMist_Team
Github:
https://github.com/slowmist/