The withdraw function of token manager is suceptible to reentrancy attack. A malicious user will be able to drain the funds of the contract using this exploit.
The withdraw function does not use nonReentrant modifier and does not update the state variable userTokenBalanceMap at all! This means that even after a withdraw the balance of user will be the same. The attacker's contract can call widraw again until all the funds are taken.
Loss of funds.
Manual review.
Use ReentrancyGuard from OpenZeppelin library.
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.