Moonwell

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

Every ERC20 not returns `true` on success so this can break the logic in `repayBadDebtWithCash` when erc20 don't return bool on success/failure like USDT protocol.

Vulnerability Details

It is possible that protocol may use USDT as underlying token. So whenever function like transferFrom will be called on USDT contract then it will not return true on success resulting the logic break of repayBadDebtWithCash function in MErc20DelegateFixer.sol.

src/MErc20DelegateFixer.sol#L30-L40

function repayBadDebtWithCash(uint256 amount) external nonReentrant {
/// Checks and Effects
badDebt = SafeMath.sub(badDebt, amount, "amount exceeds bad debt");
EIP20Interface token = EIP20Interface(underlying);
/// Interactions
37: require(
38: @> token.transferFrom(msg.sender, address(this), amount),
39: "transfer in failed"
);

Impact

If underlying storage variable have USDT contract address then it will not return true on success when transferFrom will be called resulting the logic break of repayBadDebtWithCash function

Tools Used

Manual Review

Recommended mitigation :

Use Openzeppelin's SafeERC20 library. Use safeTransferFrom of that library instead of transferFrom. So whenever any token return bool or revert on failure it can handle both situations. Since it uses low level call to call the ERC20 contract.

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.