Skip to content
Access control Audit finding Advanced

Owners can be swapped even though they still wear their signer hats

The HatsSignerGateBase contract does not verify that the set of owners of a Safe multisig remains unchanged after a transaction. A group of malicious signers could use a delegate call to a malicious contract to swap out opposing signers for cooperating ones, even though the replaced signers still hold their signer hats.

Dug Follow with minhtrng

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-02-hats-judging/issues/118

Found by

Dug, minhtrng

Summary

HatsSignerGateBase does not check for a change of owners post-flight. This allows a group of actors to collude and replace opposing signers with cooperating signers, even though the replaced signers still wear their signer hats.

Vulnerability Detail

The HatsSignerGateBase performs various checks to prevent a multisig transaction to tamper with certain variables. Something that is currently not checked for in checkAfterExecution is a change of owners. A colluding group of malicious signers could abuse this to perform swaps of safe owners by using a delegate call to a corresponding malicious contract. This would bypass the requirement of only being able to replace an owner if he does not wear his signer hat anymore as used in _swapSigner:

JavaScript
for (uint256 i; i < _ownerCount - 1;) {
    ownerToCheck = _owners[i];

    if (!isValidSigner(ownerToCheck)) {
        // prep the swap
        data = abi.encodeWithSignature(
            "swapOwner(address,address,address)",
            ...

Impact

bypass restrictions and perform action that should be disallowed.

Code Snippet

https://github.com/Hats-Protocol/hats-zodiac/blob/9455cc0957762f5dbbd8e62063d970199109b977/src/HatsSignerGateBase.sol#L507-L529

Tool used

Manual Review

Recommendation

Perform a pre- and post-flight comparison on the safe owners, analogous to what is currently done with the modules.

Discussion

spengrah

https://github.com/Hats-Protocol/hats-zodiac/pull/5

MLON33

zobront added "Fix Approved" label

The original report as published on Sherlock, by Dug. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the checkAfterExecution function does not compare the Safe owners before and after execution, allowing a delegate call to modify ownership.

Impact

A colluding group of signers could bypass the restriction that an owner can only be replaced if they no longer wear their signer hat, and swap in cooperating signers.

What the attacker needed

Multiple malicious signers collude; a delegate call to a malicious contract

The fix

The contract should perform a pre- and post-flight comparison of the Safe owners, similar to the existing check for modules.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A multisig wallet requires several people to approve transactions. This contract adds a rule that only people wearing a special 'signer hat' can be owners. The bug is that after a transaction, the contract does not check if the list of owners changed. So a group of owners could secretly replace other owners with their friends, even though the replaced owners still have their hats.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Dug

View all

7 more disclosed reports, best first.

More from Hats

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.