Hack Analysis Bonqdao February 2023
The BonqDAO protocol used a permissionless oracle where the spot price was simply the last reported value, allowing an attacker to submit an artificially high price for the WALBT token and borrow far more BEUR stablecoin than their collateral justified. The attacker then submitted an artificially low price to liquidate over 30 under-collateralised troves and collect roughly 113 million WALBT.
immunefi.com
Published on immunefi.com
The BonqDAO protocol was hacked on February 1st, 2023, losing around $120m in funds to a price oracle manipulation attack. A vulnerable price feed implementation allowed the attacker to momentarily change the price of the WALBT token to borrow much more protocol stablecoin (BEUR) then they were entitled to.
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
Root cause
The protocol treated the last permissionlessly reported oracle value as the spot price for collateral valuation, so anyone who staked the required tokens could momentarily set an arbitrary price.
Impact
The attacker could borrow far more BEUR than entitled and then liquidate over 30 under-collateralised troves, collecting approximately 113 million WALBT; the attack required staking TRB and supplying WALBT, and the two transactions had to be in separate blocks.
What the attacker needed
TRB tokens for staking; WALBT tokens for collateral; two transactions in separate blocks
The fix
The protocol should not use the last reported spot price for debt and liquidation calculations, and should instead use time-weighted average values or a decentralised price feed.
How it was found
- Deploy a fresh reporter contract and stake the required TRB tokens to bypass the reporting timelock.
- Submit a very large value as the ALBT/USD spot price to the TellorFlex oracle.
- Create a WALBT trove, deposit a small amount of collateral and borrow 100 million BEUR.
- Create a second WALBT trove with a larger amount of collateral to later buy liquidated collateral.
- Wait at least one block, then submit a very small value as the ALBT/USD spot price.
- Liquidate all WALBT troves now in debt and use the borrowed BEUR to repay the second trove and withdraw the seized collateral.
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 lending protocol lets people lock up an asset as collateral and borrow a stablecoin against it, with the amount they can borrow based on the collateral's price. BonqDAO took that price from an oracle that anyone could report to, and it treated the most recent report as the true price. The attacker reported a fake high price, borrowed far too much, then reported a fake low price so other users' loans looked unsafe and could be liquidated cheaply.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.