20,000 USDC
View results
Submission Details
Severity: high
Valid

Lack of token spending allowance in sellProfits function

Summary

The "sellProfits" function in the "Fees" smart contract lacks token allowance checks before performing token swaps using the Uniswap V3 router. This vulnerability can lead to potential security risks and unauthorized token spending.

Vulnerability Details

The "sellProfits" function directly swaps tokens without verifying whether the contract has been granted sufficient token allowance by the token owner. This means that the contract assumes it has complete control over the loan tokens (profits) and can spend them without any restrictions.

Impact

  • Unauthorized Token Spending: If the "Fees" contract receives loan tokens from external accounts or contracts, it can perform swaps without the proper approvals. This allows the contract to spend tokens that it does not actually own, leading to potential misuse of tokens.

  • Contract Inconsistency: The lack of token allowance checks makes the contract inflexible when interacting with external contracts. Changes in the external contract's address or requirements may result in the Fees contract becoming non-functional.

Tools Used

Manual code review

Recommendations

Use the IERC20.allowance() function to ensure that the contract has the required allowance from the token owner or invoke the IERC20.approve() function to set the appropriate allowance for the contract.

Support

FAQs

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