A malicious user can steal all the funds available in the capital pool. This vulnerability is a combination of a few issues. In TokenManager.sol the function withdraw() has the following devtext
However, this is not checked by modifier or within the function implementation. This means that anyone call call the function. Furhermore, the function does not update the userTokenBalanceMap after the withdraw, which is used to check the user claimable amount. This means that as long as users have any balance they can indefinetely withdraw it as it is not restricted and updated with the withdrawn amount.
Use the following test case.
The end balance of the user is greater than the start balance with 10 USDC although his calim amount is 5 USDC.
Loss of funds.
Manual review.
Use onlyOnwer() modfier in withdraw() and subtract the withdrawn amount for the user before transfering the 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.