Before one user call depositIntoVault, if the malicious attacker donate weth into the wethSteakVault whose amount is bigger than the victim's deposited amount, the victim's will return zero share and can't withdraw his asset(weth).
One user stakes 0.5 ether in the steaking contract, when the staking period ended and the new wethSteakVault was setted. The user then call depositIntoVault.
Before the user call depositIntoVault. An malicious attacker donate 0.5 ether into the wethSteakVault. which leads to the current total aseet in wethSteakVault is 0.5 ether.
According to the share calculation formula, the user will return zero share.
POC
As below poc shows, the user(user1) only get zero share
steakingBalance For eth 0
wethBalanceInVault 1000000000000000000
wethSteakVaultSharesUser1 0
Based on the above situation or just the malicious attack make the current totalAssets(total weth) in the wethSteakVault not less than the user's weth in the steaking contract, the user only get zero share when call depositIntoVault.
The following users who call depositIntoVault, if their weth amount in steaking contract less than the totalAssets(total weth) in the wethSteakVault(the weth amount have been changed by the malicious attacker), they all get zero share. Formally, if most users only staked 0.5 ether, they all lost their asset.
Manual
When create wethSteakVault inherting ERC4626 override _decimalsOffset(), make it return 3.
That Increase the malicious attacker's cost. Increase the attacker's cost 1000 times, from 0.5 ether to 500 ether.
More details can check the share calculation formula:
assets.mulDiv(totalSupply() + 10 ** _decimalsOffset(), totalAssets() + 1, rounding);
asset as the amount weth the user will tranfer to the wethSteakVault
totalSupply()
as the current total shares
totalAssets()
as the current total asset the wethSteakVault hold
_decimalsOffset()
default value is zero. when increase x, the attacker's cost will increase x times.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.