When users receive a balance in TokenManager.sol, they can withdraw their balances by calling the withdraw function, which transfers tokens from the Capital Pool to the user based on the userTokenBalanceMap variable.
However, userTokenBalanceMap is never updated, allowing any user to repeatedly call the withdraw function until all funds are drained.
withdraw function uses userTokenBalanceMap to determine the amount a user will receive based on the token and the type of balance:
Then, the function transfers the tokens from the Capital Pool to the user and ends by emitting an event:
Since userTokenBalanceMap is never updated, users can call the withdraw function repeatedly until the Capital Pool is depleted.
The Capital Pool can be drained of its funds by anyone.
Manual Review
Update userTokenBalanceMap when users call the withdraw function:
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.