Moonwell

Moonwell
DeFiFoundry
15,000 USDC
View results
Submission Details
Severity: low
Invalid

Contract lacks adequate input validation, assuming that the provided user address always has active borrows without sufficient verification

Summary

The fixUser function in the MErc20DelegateFixer contract lacks adequate input validation, assuming that the provided user address always has active borrows without sufficient verification. This oversight may result in unnecessary gas consumption and execution of code paths, reducing efficiency and increasing the risk of unexpected behavior or vulnerabilities.

Vulnerability Details

The vulnerability stems from the assumption made in the fixUser function that the provided user address has active borrows, without performing adequate validation to confirm this condition.

function fixUser(address liquidator, address user) external {
// Inadequate input validation
require(msg.sender == admin, "only the admin may call fixUser");
// Insufficient validation of user's borrow balance
uint256 principal = borrowBalanceStored(user);
require(principal != 0, "cannot liquidate user without borrows");
// Function implementation...
}

Impact

The lack of proper input validation in the fixUser function can have several adverse effects:

  • Gas Consumption: If the user does not have active borrows, the function may unnecessarily consume gas by executing code paths that do not result in any state changes or meaningful actions.

  • Efficiency Reduction: Unnecessary execution of code paths can reduce the efficiency of the contract, leading to higher gas costs for transactions and potentially impacting the overall performance of the protocol.

  • Risk of Unexpected Behavior: Inadequate input validation increases the risk of unexpected behavior or vulnerabilities, as the contract may perform actions based on invalid or incomplete input data.

Tools Used

Manual

Recommendations

To mitigate the risks associated with inadequate input validation, it is recommended to validate user input thoroughly before executing functions that rely on it. Developers should ensure that functions are only executed when necessary conditions are met, such as verifying that the user has active borrows before liquidating their account.

function fixUser(address liquidator, address user) external {
require(msg.sender == admin, "only the admin may call fixUser");
// Validate user has active borrows before proceeding
uint256 principal = borrowBalanceStored(user);
require(principal != 0, "user must have active borrows to be liquidated");
// Function implementation...
}
Updates

Lead Judging Commences

0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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