Hack Analysis Saddle Finance April 2022
Saddle Finance's Meta pool swap function mispriced LP tokens because it omitted the base virtual price scaling, allowing an attacker to profit by swapping between sUSD and the LP token. The attacker used a flash loan to repeatedly swap through the mispriced pool and drained funds.
immunefi.com
Published on immunefi.com
Saddle Finance, an automated market maker (AMM) on Ethereum, was the victim of a series of transactions on April 30, 2022, that exploited deployed smart contracts.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
The attacker could drain funds from the Meta pool, with the original attack taking roughly $11m across three transactions, though one was a whitehat rescue.
What the attacker needed
Access to Ethereum blockchain; flash loan provider (Euler); vulnerable Saddle Meta pool
The fix
The library was patched to include LP virtual price scaling, but the incorrect swap calculation was still present in live pools.
How it was found
- Obtain USDC funds via flash loan
- Swap USDC for sUSD
- Swap sUSD for Saddle DAI/USDT/USDC LP token via Meta pool
- Swap LP token for sUSD again via Meta pool
- Swap sUSD for USDC
- Repay flash loan
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A liquidity pool is a smart contract that holds tokens and lets people trade between them. In this case, the pool calculated the wrong price when swapping one token for a special pool token (LP token), so a trader could get more value out than they put in. The attacker borrowed a large amount temporarily (a flash loan), used it to exploit the mispricing, and kept the profit.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.