56673 sc high zero cost fee farming via forced earmarked repayment
Description
Vulnerability Overview
Root Cause
// LINE 585-593: Pay fee when debt reaches zero after earmark repayment
if (account.debt == 0) {
feeInYield = _resolveRepaymentFee(accountId, repaidAmountInYield);
TokenUtils.safeTransfer(myt, msg.sender, feeInYield);
return (repaidAmountInYield, feeInYield, 0);
}
// LINE 595-598: Pay fee when account becomes healthy after earmark repayment
} else {
feeInYield = _resolveRepaymentFee(accountId, repaidAmountInYield);
TokenUtils.safeTransfer(myt, msg.sender, feeInYield);
return (repaidAmountInYield, feeInYield, 0);
}Attack Flow
Impact
Link to Proof of Concept
Proof of Concept
3. Proof of Concept
Step-by-Step Reproduction
Validation Steps
Code References
Proof of Concept (GitHub Gist)
Mitigation
Previous57311 sc medium moonwell allocation and deallocation can fail silently causing incorrect state updates and loss of yieldNext58369 sc high missing mytsharesdeposited decrements in forcerepay doliquidation leads to smart contract unable to operate due to lack of token funds
Was this helpful?