Closed c4-bot-4 closed 5 months ago
The points used on this report to explain why a deposit can be DoS seems to be off and wrong.
"The attacker can make totalSupply increase temporarily"
"the attacker can donate the balance to the specified account so that his balance is greater than 0."
This report fails to mention the root cause of why deposits could be DoSed by donating the underling aCollateralToken to the Vault when there are no existing shares.
For the above reason, this report should not be a dupe of the reports that correctly points out the root cause of DoSing deposits, and this report seems to be invalid.
0xleastwood marked the issue as duplicate of #29
0xleastwood marked the issue as satisfactory
Lines of code
https://github.com/code-423n4/2024-05-bakerfi/blob/59b1f70cbf170871f9604e73e7fe70b70981ab43/contracts/core/Vault.sol#L212
Vulnerability details
Impact
DoS attacks make it impossible for others to deposit
Proof of Concept
maxDeposit
is set in thedeposit
function:_tokenPerETH = (totalSupply() * 1 ether) / _totalAssets;
Because _totalAssets = totalCollateralInEth - totalDebtInEth So the value of _totalAssets might be small.
Suppose _totalAssets = 1wei, afterDeposit = msg.value + balanceOf(msg.sender) * totalSupply()
Since
totalSupply
is constantly increasing, Therefore, when the value oftotalSupply
is accumulated (many deposits in a short time) and_totalAssets
in the pool is small, a user withbalanceOf(msg.sender)
greater than 0 May not be able to deposit.The attacker can make
totalSupply
increase temporarily, or the attacker can donate the balance to the specified account so that his balance is greater than 0.Tools Used
vscode, manual
Recommended Mitigation Steps
Change the calculation method of
maxDeposit
.Assessed type
DoS