You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.
sherlock-admin opened this issue
Mar 9, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
It is known to the sponsor that it is unsafe to do this for Safes that have more than 5 modules registered.
We can see this by their comments:
/// @dev Do not attach HatsSignerGate to a Safe with more than 5 existing modules; its signers will not be able to execute any transactions
So the signers will not be able to execute any transactions.
Vulnerability Detail
I will not explain why this danger exists because it is known to the sponsor.
So here just a quick summary: When a transaction is executed the HatsSignerGate checks that no new modules were added. However these checks are based on a wrong module count if the number of initial modules is greater than 5.
The HatsSignerGate will think that the transaction by the signers has added a new module and will revert.
I argue that this is very unsafe.
The code should check and revert if there are more than 5 modules registered.
If signers of the Safe are not aware of this limitation which is likely because the danger of this function is only mentioned in a comment, they can lose access to all their funds and all other privileges associated with the Safe.
Impact
Signers lose access to the Safe because all transactions will revert.
// option 2: deploy a new signer gate and attach it to an existing Safe/// @dev Do not attach HatsSignerGate to a Safe with more than 5 existing modules; its signers will not be able to execute any transactionsfunction deployHatsSignerGate(
uint256_ownerHatId,
uint256_signersHatId,
address_safe, // existing Gnosis Safe that the signers will joinuint256_minThreshold,
uint256_targetThreshold,
uint256_maxSigners
) publicreturns (addresshsg) {
// count up the existing modules on the safe
(address[] memorymodules,) =GnosisSafe(payable(_safe)).getModulesPaginated(SENTINEL_MODULES, 5);
uint256 existingModuleCount = modules.length;
return_deployHatsSignerGate(
_ownerHatId, _signersHatId, _safe, _minThreshold, _targetThreshold, _maxSigners, existingModuleCount
);
}
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
roguereddwarf
medium
HatsSignerGateFactory: Should revert if there are more than 5 existing modules
Summary
The
HatsSignerGateFactory
contract allows to deployHatsSignerGate
andMultiHatsSignerGate
contracts and attach them to existing Safes.The functions that are used to do this are
HatsSignerGateFactory.deployHatsSignerGate
andHatsSignerGateFactory.deployMultiHatsSignerGate
.It is known to the sponsor that it is unsafe to do this for Safes that have more than 5 modules registered.
We can see this by their comments:
/// @dev Do not attach HatsSignerGate to a Safe with more than 5 existing modules; its signers will not be able to execute any transactions
So the signers will not be able to execute any transactions.
Vulnerability Detail
I will not explain why this danger exists because it is known to the sponsor.
So here just a quick summary: When a transaction is executed the HatsSignerGate checks that no new modules were added. However these checks are based on a wrong module count if the number of initial modules is greater than 5.
The HatsSignerGate will think that the transaction by the signers has added a new module and will revert.
I argue that this is very unsafe.
The code should check and revert if there are more than 5 modules registered.
If signers of the Safe are not aware of this limitation which is likely because the danger of this function is only mentioned in a comment, they can lose access to all their funds and all other privileges associated with the Safe.
Impact
Signers lose access to the Safe because all transactions will revert.
Code Snippet
https://github.com/Hats-Protocol/hats-zodiac/blob/9455cc0957762f5dbbd8e62063d970199109b977/src/HatsSignerGateFactory.sol#L124-L141
https://github.com/Hats-Protocol/hats-zodiac/blob/9455cc0957762f5dbbd8e62063d970199109b977/src/HatsSignerGateFactory.sol#L243-L258
Tool used
Manual Review
Recommendation
I recommend to check if there are more than 5 modules registered and revert if this is the case.
Fix:
Duplicate of #43
The text was updated successfully, but these errors were encountered: