Lack of address(0)
in the KatanaGovernance::_setFactory
function
#107
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
duplicate-25
🤖_10_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/ronin-chain/katana-operation-contracts/blob/27f9d28e00958bf3494fa405a8a5acdcd5ecdc5d/src/governance/KatanaGovernance.sol#L340
Vulnerability details
Proof of Concept
The
KatanaGovernance::_setFactory
function is used to change the value of_v2Factory
but depending on the current implementation, this variable can take on anaddress(0)
which is an invalid address.If
_v2Factory
isaddress(0)
or is not defined correctly, calling theKatanaGovernance::createPair
function will always fail and we will get other unexpected behaviour.Impact
DOS and unattended behaviour, as some functions will always fail due to an invalid address.
Recommended Mitigation Steps
function _setFactory(address factory) private { + require(factory != address(0), "Invalid address!"); _v2Factory = IKatanaV2Factory(factory); emit FactoryUpdated(_msgSender(), factory); }
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: