learn-evm-attacks icon indicating copy to clipboard operation
learn-evm-attacks copied to clipboard

Read-only reentrency in the wild

Open MatthiasEgli opened this issue 2 years ago • 2 comments

There is mentioning that the read-only reentrancy is theoretical and there aren't cases out there where this was exploited. This is not true, as we published this class of vulnerability based on an actual bug with 100m+ at risk back when it was active. The technical details are here: https://chainsecurity.com/curve-lp-oracle-manipulation-post-mortem/ and a description of the vulnerable projects here: https://chainsecurity.com/heartbreaks-curve-lp-oracles/ (including how it was fixed by e.g. MakerDAO)

Till today, incorrect use of the stETH/ETH pool on Curve will allow attackers to exploit projects with this read-only reentrancy.

MatthiasEgli avatar Dec 13 '22 20:12 MatthiasEgli

@MatthiasEgli Cool, thanks for the links! We must have missed it. We will review and probably update the attack with an example 🧑‍🏭

joaquinlpereyra avatar Dec 13 '22 21:12 joaquinlpereyra

The ~QiDao Protocol~ QuickSwap Lend was exploited via the read-only reentrancy. You can find all the exploit details in my repo here.

For the sake of completeness, I quickly list the exploit details here:

pcaversaccio avatar Dec 13 '22 21:12 pcaversaccio

After reviewing again the attack details, we should not call the attack a QiDAO Protocol attack but rather a QuickSwap Lend attack. Accordingly, I updated the name here: https://github.com/pcaversaccio/reentrancy-attacks/commit/554cd56e99f25c9fd1f8af27327c90b56edb693d. The reason is that the targeted attack is on the QuickSwap Lend dimension and not QiDAO Protocol, which just simply seeded the drained funds.

pcaversaccio avatar Dec 18 '22 11:12 pcaversaccio

We are currently working on the reproduction of QiDAO.

Only a few steps left and we will merge it, you can check the progress here: Pull #45.

nine-december avatar Dec 28 '22 15:12 nine-december

Another read-only reentrancy exploit happened yesterday: https://twitter.com/AnciliaInc/status/1614705804468424704

Here are the attack details: Midas Capital attack – January 15, 2023 | Victim contract, Exploit contract, Exploit transaction

pcaversaccio avatar Jan 16 '23 09:01 pcaversaccio

Another one: https://2pinetwork.medium.com/lessons-learned-from-exploit-incident-postmortem-70ad1a079b38

joaquinlpereyra avatar Feb 28 '23 12:02 joaquinlpereyra

thx for highlighting, added to my reentrancy repo via https://github.com/pcaversaccio/reentrancy-attacks/commit/19f3c04b9e81fc2e1a6682e21fbb9e3a64000a75.

pcaversaccio avatar Feb 28 '23 13:02 pcaversaccio

The attack is now about to be merged. We will review it one more time before merging but feel free to track it's state on #45.

Cheers 🎉

nine-december avatar Mar 09 '23 17:03 nine-december

FYI: The strategy used in the Midas attack was the same as the QuickSwap Lend attack, using several contracts to borrow. The traces are much more alike.

nine-december avatar Mar 09 '23 17:03 nine-december

Tracked and merged at: https://github.com/coinspect/learn-evm-attacks/pull/45

joaquinlpereyra avatar Apr 10 '23 13:04 joaquinlpereyra

FYI, another read-only reentrancy just happened recently with the Sentiment attack: https://github.com/pcaversaccio/reentrancy-attacks/issues/12.

pcaversaccio avatar Apr 10 '23 13:04 pcaversaccio