TokenManager.withdraw()
allows user to withdraw their funds from the protocol if they have any tokens:
userTokenBalanceMap
is a mapping that stores all users' tokens that are available for withdrawal. If there are available tokens function will call the transfer method to transfer tokens from CapitalPool
to the user. Neither before nor after the transfer there is no reset functionality that sets userTokenBalanceMap[_msgSender()][_tokenAddress][_tokenBalanceType] to 0 which allows user to call this function again and again until there is not tokens left in CapitalPool
.
Any user can steal funds from other users.
Change TokenManager.withdraw()
to also reset user balance after 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.