Moonwell

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

The whole transaction would revert if a single user from the list repays his borrows

Summary

Vulnerability Details

The protocol uses a script to upgrade the mFrax and mxcDOT tokens to a new implementation that introduces the fixUser function. The function checks if a user has bad debt and zeroes it out. If the user has no bad debt the transaction reverts.

The script mip-m17.sol adds operations to the transaction. The operations it adds include calling the fixUser function for users with bad debt, from a predetermined list. The problem here arises from the fact that if a user repays his bad debt before the transaction is run it would revert wasting the gas spend so far.

The protocol devs would have to remove user from the JSON that reads the bad debt addresses and re-execute the transaction which would cost up to 6 mil gas. At 100 Gwei per gas that's around $2500 -> https://gascalculator.xyz/

Impact

Low impact as a user has no incentive to repay his bad debt, but NOT impossible.

Tools Used

Manual Review

Recommendations

In MErc20DelegateFixer::fixUser just return instead of reverting if the user has no bad debt. This would not revert the whole transaction.

...
require(liquidator != user, "liquidator cannot be user");
require(accrueInterest() == 0, "accrue interest failed");
/// @dev fetch user's current borrow balance, first updating interest index
uint256 principal = borrowBalanceStored(user);
- require(principal != 0, "cannot liquidate user without borrows");
+ if (principal != 0) {
+ return;
+ }
/// user effects
...
Updates

Lead Judging Commences

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

finding-front-run-fixUser

ljj Judge
over 1 year ago
0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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