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

The owner of the protocol can frontrun the `setLenderFee` if some borrower borrows a big amount of tokens

##Summary
The protocol exhibits a vulnerability where the owner has the ability to front-run the setLenderFee function when a borrower attempts to borrow a significant amount of tokens. As the FeeReceiver, the owner can exploit this situation to manipulate the fees by setting them to their maximum value. Consequently, the owner gains control over the user's tokens.

##Vulnerability Details
When a borrower seeks to borrow a substantial number of tokens, and the owner of the protocol also acts as the FeeReceiver, a scenario arises in which the owner can preempt the borrower's transaction. By front-running the borrower's action, the owner can modify the fees, setting them to the maximum possible value. This action allows the owner to take control of the user's tokens.

##Impact
The vulnerability poses a severe risk of fund loss and undermines the trustworthiness of the protocol. If exploited, users may suffer financial losses, eroding confidence in the platform.

##Tools Used
The identified vulnerability was discovered through manual review of the protocol's codebase.

##Recommendations
To address this vulnerability and prevent potential exploitation, it is advisable to introduce a time delay mechanism for the setLenderFee function. By updating the fees after a predetermined duration, for example, using block.timestamp + 5 days, the protocol can create a buffer period during which fee adjustments cannot be modified instantaneously. This time delay mechanism adds an additional layer of protection, mitigating the risk of front-running and unauthorized fee manipulation by the owner.

Support

FAQs

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