Analysis2023-11-02
5 Minutes Read
Daniel Tan
Security Operation / Audit
On Nov 1, 2023, our MetaScout detected that the lending protocol, @OnyxProtocol on Ethereum, was under a flash loan attack with a loss of $2.1M. The root causes are the proposal of adding a new market that was first executed by the hacker, and the precision loss issue of the compound-fork protocol. Here is a detailed exploit analysis by MetaTrust Labs to uncover how this all happened.
On Nov 1, 2023, our MetaScout detected that the lending protocol, Onyx Protocol on Ethereum, was under a flash loan attack with a loss of $2.1M. The root causes are the proposal of adding a new market that was first executed by the hacker, and the precision loss issue of the compound-fork protocol. MetaTrust Labs conducted in-depth research and analysis on the exploit, revealing how hackers used governance proposals and protocol vulnerability to attack Onyx Protocol.
Onyx Protocol(https://docs.onyx.org/) is an algorithmic money market designed to bring secure and trustless credit and lending to users on the Ethereum Network. On Oct 29, 2023, Onyx protocol(https://x.com/OnyxProtocol/status/1718348637158137858?s=20) launched a proposal OIP-22 to add $PEPE to the market. However, it is unfortunately targeted and executed by the hacker for the exploiting. The Onyx protocol turned out to be a compound-forked protocol after we checked its on-chain deployed contracts, and its TVL dropped from $2.86M to $557K due to yesterday's attack.
Time | Action | Transaction |
---|---|---|
2023-10-28 02:29:11 PM +UTC | The proposal OIP-22 was created to add a new market | 0x309f437ece123ee77b5cc2435783578424bb4e30448dedf6f845bd0c2a4e40a6 |
2023-11-01 09:57:47 AM +UTC | The hacker executed proposal OIP-22 | 0xb91e0731a0f1eb0abf884717a065f7282a5daaacd172a0db8d4a61609c978ed8 |
2023-11-01 09:58:47 AM +UTC | Launched the attack only 1 minute later than the execution of proposal 22. Note that the hacker is the one who first interacts with the new market. | 0xf7c21600452939a81b599017ee24ee0dfd92aaaccd0a55d02819a7658a6ef635 0x27a3788d504af542681436bfdecf1823f7a8a691d04309ad33e6d3825e899746 |
The total loss of two attacking transactions is ~$2.14M.
Transaction | Amount |
---|---|
0xf7c21600452939a81b599017ee24ee0dfd92aaaccd0a55d02819a7658a6ef635 | 1,156.9 $ETH(worth $2.088M) |
0x27a3788d504af542681436bfdecf1823f7a8a691d04309ad33e6d3825e899746 | $60K worth assets, including $MATIC, $UNI, $APE, $USDP, and $WETH. |
0x052ad2f779c1b557d9637227036ccaad623fceaa
https://etherscan.io/address/0xdec2f31c3984f3440540dc78ef21b1369d4ef767
TL;DR
Take one of the attacking transactions, 0xf7c216, as an example.
totalSupply
to be a tiny value, 2, and increases the totalCash to be extremely high value, 2520870348093423681390050791471, to amplify the exchangeRate
, which results in calculation truncation when redeeming.As of the time of writing, attack(0x085bDf) transfers 1140 $ETH to the money-laundry protocol Tornado.Cash with another controlled address(0x4c9c86). Another attacker still keeps stolen tokens in the same wallet(0x508395).
The bug is similar to the previous hack of Hundred Finance on 2023.04.15, which resulted in a loss of approximately $7 million.
TX: 0x6e9ebcdebbabda04fa9f2e3bc21ea8b2e4fb4bf4f4670cb8483e2f0b2604f451
MetaTrust Labs is a leading provider of Web3 AI security tools and code auditing services incubated at Nanyang Technological University, Singapore. We provide advanced AI solutions that empower developers and project stakeholders to protect Web3 applications and smart contracts. At MetaTrust Labs, we are committed to protecting the Web3 space so that builders can innovate with confidence and reliability.
Website: https://metatrust.io/
Twitter: https://twitter.com/MetatrustLabs
Daniel Tan
Security Operation / Audit
On Nov 1, 2023, our MetaScout detected that the lending protocol, @OnyxProtocol on Ethereum, was under a flash loan attack with a loss of $2.1M. The root causes are the proposal of adding a new market that was first executed by the hacker, and the precision loss issue of the compound-fork protocol. Here is a detailed exploit analysis by MetaTrust Labs to uncover how this all happened.