Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: low
Invalid

Inconsistency Between the Behavior and Design Expectations of the _repay Function

Summary

The LendingPool contract contains a function intended to allow users to repay borrowed reserve assets on behalf of themselves or other users. However, the implementation of this function does not align with the documented behavior, leading to unexpected reversion under specific conditions. Particularly, when the onBehalfOf address is set to zero, the function incorrectly reverts instead of repaying the caller's debt.

Vulnerability Details

The internal function _repay is designed to facilitate repayments for borrowing activities. The documentation states that if the onBehalfOf parameter is address(0), it should default to repaying the debt of msg.sender. However, the current implementation checks for onBehalfOf being address(0) and reverts if this condition is met, thereby preventing repayment by the caller. Here is the relevant code snippet:

/**
* @dev This function allows users to repay their own debt or the debt of another user.
* The caller (msg.sender) provides the funds for repayment in both cases.
* If onBehalfOf is set to address(0), the function defaults to repaying the caller's own debt.
*/
function _repay(uint256 amount, address onBehalfOf) internal {
if (amount == 0) revert InvalidAmount();
if (onBehalfOf == address(0)) revert AddressCannotBeZero();
}

Impact

This vulnerability impacts user experience and functionality of the LendingPool contract by preventing users from repaying their own debts if they pass address(0) as the onBehalfOf parameter. Additionally, this issue poses challenges for future development, as developers may encounter unexpected behavior when implementing new features or enhancements related to debt repayment.

Tools Used

manual code review

Recommendations

Change the conditional check for the onBehalfOf parameter to allow for the functionality outlined in the documentation. Specifically, remove the revert statement for address(0).

if (onBehalfOf == address(0)) {
onBehalfOf = msg.sender; // Set onBehalfOf to msg.sender if it is address(0)
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Appeal created

01chenqing Submitter
7 months ago
inallhonesty Lead Judge
7 months ago
inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!