Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: high
Valid

Withdraw all the tokens from the capital pool.

Summary

User can withdraw all the tokens from the capital pool.

Suppose a user creates an offer and have TaxIncomes or SalesRevenue. For example, when user withdraw TaxIncome from TokenManager contract, there's no initialize of TaxIncome in this function after sending funds. So user can withdraw so many times while capital pool has enough tokens.

Tools Used

Manual Review

Recommendations

Add initialize statement in the withdraw function of TokenManager.sol.

function withdraw(
address _tokenAddress,
TokenBalanceType _tokenBalanceType
) external whenNotPaused {
...
userTokenBalanceMap[_msgSender()][
_tokenAddress
][_tokenBalanceType] = 0;
emit Withdraw(
_msgSender(),
_tokenAddress,
_tokenBalanceType,
claimAbleAmount
);
}
Updates

Lead Judging Commences

0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-TokenManager-withdraw-userTokenBalanceMap-not-reset

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)

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.