In TokenManager::withdraw
, the userTokenBalanceMap
is not updated after a user withdraws his balance so the user can continue withdrawing until the contract is drained.
When TokenManager::withdraw
is invoked, the contract checks that the user has balance:
The userTokenBalanceMap
is not set to zero after the user withdraws so he can keep invokingwithdraw
for as long as the balance of CapitalPool
is greater or equal the user’s balance.
Include this test in PreMarkets.t.sol
:
Foundry
Set userTokenBalanceMap[_msgSender()][_tokenAddress][_tokenBalanceType] = 0
Valid critical severity finding, the lack of clearance of the `userTokenBalanceMap` mapping allows complete draining of the CapitalPool contract. Note: This would require the approval issues highlighted in other issues to be fixed first (i.e. wrong approval address within `_transfer` and lack of approvals within `_safe_transfer_from` during ERC20 withdrawals)
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.