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

Zero address leads to transaction reverts

Summary

The Lender::setFeeReceiver() lacks checking the address(0), leading to transaction reverts on the borrow(), repay(), giveLoan(), buyLoan(), seizeLoan(), and refinance().

Vulnerability Details

The feeReceiver variable can be set by an admin through the setFeeReceiver(). The function does not check if the address(0) is inputted, though.

function setFeeReceiver(address _feeReceiver) external onlyOwner {
@> feeReceiver = _feeReceiver;
}

https://github.com/Cyfrin/2023-07-beedle/blob/658e046bda8b010a5b82d2d85e824f3823602d27/src/Lender.sol#L101

Impact

If the address(0) is inputted by mistake, the following functions will revert transactions.

Tools Used

Manual Review

Recommendations

I recommend reverting a transaction if the address(0) is inputted to the setFeeReceiver().

function setFeeReceiver(address _feeReceiver) external onlyOwner {
+ if (_feeReceiver == address(0)) revert ZeroAddress();
feeReceiver = _feeReceiver;
}

Support

FAQs

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