The TokenManager::withdraw() function does not update the userTokenBalanceMap after a withdrawal is made. This allows users to repeatedly call the withdraw() function to drain the pool, as the token balance in the mapping remains unchanged even after tokens are claimed.
In the TokenManager contract, the userTokenBalanceMap[accountAddress][tokenAddress][tokenBalanceType] mapping tracks the token balance for each user, which can be claimed via the withdraw() function. The withdraw() function retrieves the claimAbleAmount from this mapping and sends the corresponding tokens to the user.
However, after sending the tokens to the user, the function fails to update the userTokenBalanceMap to reflect the withdrawn amount. This allows the user to repeatedly call the withdraw() function, each time receiving the same amount of tokens, effectively draining the pool.
This vulnerability allows malicious users to drain the pool by repeatedly withdrawing the same balance.
vscode
The withdraw() function should properly update the userTokenBalanceMap after each withdrawal.
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.