When traders withdraw funds via withdraw(), the claimable amount userTokenBalanceMap[_msgSender()][_tokenAddress][_tokenBalanceType] is not reset to 0. This cause that the traders can withdraw tokens from the capitalPool repeatedly.
In TokenManager, the traders can withdraw tokens from the capitalPool via withdraw().
We use the variable userTokenBalanceMap to record the claimable amount. The problem is that after the trader withdraw the claimAbleAmount, the variable is not reset to 0. Then the traders can withdraw the funds repeatedly to drain the capitalPool.
The capitalPool will be drained.
Manual
Reset the userTokenBalanceMap[_msgSender()][_tokenAddress][_tokenBalanceType] when the trader withdraw tokens.
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.