Lack of Validation for Recovery Spell Addresses in InstanceDeployer To Ensure They're actually Recovery Spell Contracts, This May Lead to Enabling Non-functional or Malicious Contract/EOA as Safe Modules #12
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 issue
Highest quality submission among a set of duplicates
🤖_01_group
AI based duplicate group recommendation
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/solidity-labs-io/kleidi/blob/0d72b6cb5725c1380212dc76257da96fcfacf22f/src/InstanceDeployer.sol#L274-L291
Vulnerability details
Description
In the
InstanceDeployer::createSystemInstance()
function, there is no validation to ensure that the addresses provided in therecoverySpells
array are valid contracts and support theRecoverySpell
model. This could result in the deployment of a safe with enabling non-functional or even Malicious modules, causing harm to entire system.Impact
If EOA or contracts that are not actually
RecoverySpell
contracts, are passed as recovery spells when deploying the safe and Timelock, there's high possiblity thatinstanceDeployer
will enable non-functional or malicious modules. This could lead to not having a backup plan if safe owners lost keys since no recovery mechanism is set for safe, or in the case of a malicious module, result in actions such as adding/removing owners and modules from the safe, scheduling operations on the timelock, which can even lead to stealing funds, or even removing the hot signer role from a legitimate hot signer.Proof Of Concept
we need to ensure the recovery spell addresses on #L274-L291 are actually Recovery Spell contracts, but such validation is missing.
Recommended Mitigation
RecoverySpell.sol
:recoverySpells
array is a valid contract and supports theRecoverySpell
model inside theInstanceDeployer::createSystemInstance()
function:function createSystemInstance(NewInstance memory instance) external returns (SystemInstance memory walletInstance) { /* Rest of the Code... */ for (uint256 i = 0; i < instance.recoverySpells.length; i++) { + require(IRecoverySpell(instance.recoverySpells[i]).isRecoverySpell(), "Invalid RecoverySpell contract"); calls3[index++].callData = abi.encodeWithSelector( ModuleManager.enableModule.selector, instance.recoverySpells[i] ); } /* Rest of the Code... */ }
Assessed type
Other
The text was updated successfully, but these errors were encountered: