Missing address(0)
check in the Payments::pay
function.
#101
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
🤖_primary
AI based primary recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/ronin-chain/katana-operation-contracts/blob/27f9d28e00958bf3494fa405a8a5acdcd5ecdc5d/src/aggregate-router/modules/Payments.sol#L26
Vulnerability details
Proof of Concept
In the
Payments::pay
function, the fund is sent to the addressrecipient
but no validation has been done to check the contents of this input, so any address can be supplied, even the addressaddress(0)
which is an invalid address. Any funds sent to this address will be burnt and can never be recovered.Impact
Loss of funds: all funds sent to
address(0)
will be burnt.Recommended Mitigation Steps
function pay(address token, address recipient, uint256 value) internal { + require(recipient != address(0), "Invalid recipient address"); if (token == Constants.ETH) { recipient.safeTransferETH(value); } else { if (value == Constants.CONTRACT_BALANCE) { value = ERC20(token).balanceOf(address(this)); } ERC20(token).safeTransfer(recipient, value); } }
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: