88mph Function Initialization Bug Fix Review
An unprotected init() function in several 88mph pool contracts allowed anyone to take ownership of the NFT contract, enabling them to mint and burn any user's deposit NFTs and potentially steal $6.5m in tokens.
immunefi.com
Published on immunefi.com
Whitehat Ashiq Amien, security researcher at iosiro, disclosed a critical vulnerability in 88mph’s CRV:RENWBTC, CRV:STETH, and yaLink pools to Immunefi on June 7. The vulnerability was an unprotected init() function in the code of these specific pools that would have allowed a malicious user to steal $6.5m in tokens…
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 init() function lacked an onlyOwner modifier and an initializer modifier, so it could be called by anyone multiple times.
Impact
An attacker could take ownership of the NFT contract, mint and burn any user's deposit NFTs, and potentially steal $6.5m in tokens; the contracts were paused and funds whitehacked to prevent loss.
What the attacker needed
None
The fix
The bug should be fixed by using a constructor instead of init(), adding an onlyOwner modifier, or adding an initializer modifier to make init() callable only once.
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 smart contract had a setup function that anyone could call, even after it was already set up. This let an attacker become the owner and control valuable digital tokens (NFTs) that represented deposits, potentially stealing the money behind them.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.