denial of service
When the borrow token is ether, calling withdrawLiquidity causes the contract to transfer msg.value (the amount sent with the call) instead of the intended liquidity amount, while still burning the user's liquidity tokens. As a result, users cannot recover their funds.
Submitted by certora
https://github.com/code-423n4/2021-12-sublime/blob/main/contracts/Pool/Pool.sol#L645 if the borrow token is address(0) (ether), and someone calls withdrawLiquidity, it calls SavingsAccountUtil.transferTokens which will transfer to msg.sender, msg.value (of withdrawLiquidity, because it’s an internal function). In other words, the liquidity provided will pay to themselves and their liquidity tokens will still be burned. therefore they will never be able to get their funds back.
Recommended Mitigation Steps
the bug is in https://github.com/code-423n4/2021-12-sublime/blob/main/contracts/SavingsAccount/SavingsAccountUtil.sol It is wrong to use msg.value in transferTokens because it’ll be the msg.value of the calling function. therefore every transfer of ether using this function is wrong and dangerous, the solution is to remove all msg.value from this function and just transfer _amount regularly.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the transferTokens function uses msg.value instead of the intended _amount parameter, causing incorrect ether transfers.
Impact
Users who withdraw liquidity when the borrow token is ether will lose their funds because the contract sends the wrong amount and burns their liquidity tokens.
What the attacker needed
Borrow token is ether (address(0)); user calls withdrawLiquidity
The fix
The fix is to remove all uses of msg.value from transferTokens and transfer the _amount parameter instead.
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 report has not been written yet. The Original tab links to the source.
In a smart contract, msg.value is the amount of ether sent with a function call. The code mistakenly uses this value when transferring ether back to a user, so the user gets the wrong amount and loses their deposit.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.