Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elegant Carbon Nightingale - Gas Limit exceeded due to Unbounded Array in HatsSignerGate::_removeSigner #33

Open
sherlock-admin2 opened this issue Nov 23, 2024 · 0 comments

Comments

@sherlock-admin2
Copy link

Elegant Carbon Nightingale

Medium

Gas Limit exceeded due to Unbounded Array in HatsSignerGate::_removeSigner

Summary

Iterating over an unbounded array in the HatsSignerGate::_removeSigner function can cause the function to fail.

Root Cause

The HatsSignerGate::_removeSigner function calls SafeManagerLib::findPrevOwner to identify the previous signer of the signer to be removed. However, the _owners array parameter is unbounded. If the array is too large, this iteration may exceed the gas limit, causing the transaction to revert.

HatsSignerGate::_removeSigner function:

function _removeSigner(address _signer) internal {
  ...
  if (owners.length == 1) {
    removeOwnerData = SafeManagerLib.encodeSwapOwnerAction(SafeManagerLib.SENTINELS, _signer, address(this));
  } else {
    uint256 newThreshold = _getNewThreshold(owners.length - 1);
=>  removeOwnerData = SafeManagerLib.encodeRemoveOwnerAction(SafeManagerLib.findPrevOwner(owners, _signer), _signer, newThreshold);
  }
  s.execSafeTransactionFromHSG(removeOwnerData);
}

Impact

Failure of the HatsSignerGate::_removeSigner function results in the inability to remove signers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant