Skip to content
Misconfiguration Audit finding Intermediate

Incorrect initialization of SecurityCouncilMemberRemovalGovernor contract

The SecurityCouncilMemberRemovalGovernor contract did not call the initializer for its inherited GovernorUpgradeable and EIP712Upgradeable contracts, leaving the governor name and EIP-712 domain separator uninitialised. This broke compatibility with the EIP-712 standard and caused signature-based voting functions to verify signatures incorrectly.

AkshaySrivastav Follow with MiloTruck

Originally disclosed on Code4rena

Submitted by AkshaySrivastav, also found by MiloTruck

The SecurityCouncilMemberRemovalGovernor contract inherits GovernorUpgradeable & EIP712Upgradeable contracts but does not invoke their individual initialzers during its own initialization. Due to which the state of GovernorUpgradeable & EIP712Upgradeable contracts remain uninitialized.

contract SecurityCouncilMemberRemovalGovernor is
    GovernorUpgradeable,
    GovernorVotesUpgradeable,
    ...
{
    function initialize(
        ...
    ) public initializer {
        __GovernorSettings_init(_votingDelay, _votingPeriod, _proposalThreshold);
        __GovernorCountingSimple_init();
        __GovernorVotes_init(_token);
        __ArbitrumGovernorVotesQuorumFraction_init(_quorumNumerator);
        __GovernorPreventLateQuorum_init(_minPeriodAfterQuorum);
        __ArbitrumGovernorProposalExpirationUpgradeable_init(_proposalExpirationBlocks);
        _transferOwnership(_owner);
        ...
    }
}
abstract contract GovernorUpgradeable is EIP712Upgradeable, ... {
    function __Governor_init(string memory name_) internal onlyInitializing {
        __EIP712_init_unchained(name_, version());
        __Governor_init_unchained(name_);
    }
    function __Governor_init_unchained(string memory name_) internal onlyInitializing {
        _name = name_;
    }
}

Due to this issue:

  • In GovernorUpgradeable the _name storage variable is never initialized and the name() function returns an empty string.
  • In EIP712Upgradeable the _HASHED_NAME storage variable is never initialized. This variable is used in the castVoteBySig & castVoteWithReasonAndParamsBySig functions of SecurityCouncilMemberRemovalGovernor.

The non-initialization of EIP712Upgradeable contract breaks the compatibility of SecurityCouncilMemberRemovalGovernor contract with the EIP712 standard.

It should be noted that the other contracts like SecurityCouncilMemberElectionGovernor and SecurityCouncilNomineeElectionGovernor also inherits the GovernorUpgradeable & EIP712Upgradeable contracts and initializes them correctly. So the incorrect initialization of SecurityCouncilMemberRemovalGovernor also breaks the overall code consistency of protocol.

The SecurityCouncilMemberElectionGovernor and SecurityCouncilNomineeElectionGovernor contract also force users to do voting only via castVoteWithReasonAndParams and castVoteWithReasonAndParamsBySig functions. Hence it can be clearly observed that the protocol wants to utilize voting-by-signature feature, which requires EIP712 compatibility.

Proof of Concept

This test case was added in test/security-council-mgmt/SecurityCouncilMemberRemovalGovernor.t.sol and ran using forge test --mt test_audit.

    function test_audit_notInvoking___Governor_init() public {
        assertEq(scRemovalGov.name(), "");
        assertEq(bytes(scRemovalGov.name()).length, 0);
    }

Tools Used

Foundry

Recommended Mitigation Steps

Consider initializing the GovernorUpgradeable & EIP712Upgradeable contracts in SecurityCouncilMemberRemovalGovernor.initialize function.

    function initialize(
        ...
    ) public initializer {
        __Governor_init("SecurityCouncilMemberRemovalGovernor");
        ...
    }

sorrynotsorry (lookout) commented:

Out of scope —> Already included in automated findings report: (L‑03) Upgradeable contract not initialized

AkshaySrivastav (warden) commented:

@0xean - I would like to add more context for this report.

I was aware that this issue has been included in the automated findings but still reported this bug due to following reasons:

  • The automated report does not explain the full impact of the finding and hence incorrectly judges it as low.
  • Almost all cases mentioned in Upgradeable contract not initialized section are false positives.

False positives reported in automated report:

  • SecurityCouncilManager does not need to invoke __AccessControl_init as __AccessControl_init is an empty function.

  • SecurityCouncilMemberElectionGovernor does not need to invoke __Ownable_init because the contract wants to provide ownership to a input parameter _owner while the __Ownable_init gives ownership to msg.sender. To achieve that the SecurityCouncilMemberElectionGovernor invokes the _transferOwnership function with _owner parameter in the initializer.

  • SecurityCouncilMemberRemovalGovernor:

    • invokes __ArbitrumGovernorProposalExpiration_init correctly.
    • handles the __Ownable_init case correctly similar to above explained SecurityCouncilMemberElectionGovernor case.
    • does not invoke __Governor_init, this is the issue reported by me.
  • SecurityCouncilNomineeElectionGovernor handles the __Ownable_init case correctly similar to above explained SecurityCouncilMemberElectionGovernor case.

Due to the above explained reasons I separately reported this bug as medium severity. The bug leads to incompatibility of a protocol contract with EIP712 standard which the contract always wanted to adhere to.

Hope this report can be reviewed again. Thanks.

MiloTruck (warden) commented:

@0xean - I would like to add on to what was stated above as my issue #253 is a duplicate.

The C4 docs explicitly states that raising issues from bot reports to a higher severity is fair game, as seen here:

Wardens may use automated tools as a first pass, and build on these findings to identify High and Medium severity issues (“HM issues”). However, submissions based on automated tools will have a higher burden of proof for demonstrating to sponsors a relevant HM exploit path in order to be considered satisfactory.

In my issue, I’ve demonstrated how the missing __Governor_init() call results in incorrect signature verification in castVoteBySig() and castVoteWithReasonAndParamsBySig() and violates the EIP-712 standard, which in my opinion is deserving of medium severity.

Additionally, as pointed out above, it would have been extremely easy for a sponsor to miss this medium finding amongst all the other false positives in the bot report.

As such, I don’t think this finding should be ruled out as OOS as we’ve demonstrated how it has a greater severity than stated in the bot report and provided additional value to the sponsor.

Would like to hear your opinion as a judge, thanks!

0xean (judge) commented:

Thanks for the comments. After reviewing, I think raising this to Medium and awarding this is fair. The bot report is vague on impact and without this being called to the sponsor’s attention explicitly with a much broader impact, it could go unfixed until a later date.

Will welcome sponsor comments before making a final call.

yahgwai (Arbitrum) commented:

Issue was well written and had correct mitigation. I think Medium seems fair. Thank you for finding it and pointing it out!

Fix here: https://github.com/ArbitrumFoundation/governance/commit/1a6b66d23f1226e93f0d67c3ed8e9fe1174c178c


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

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

The contract's initialize function omitted calls to __Governor_init and therefore __EIP712_init, leaving inherited state variables uninitialised.

Impact

The contract was incompatible with EIP-712, so signature-based voting functions could not verify signatures correctly, potentially preventing legitimate votes or causing them to be rejected.

What the attacker needed

Access to the deployed contract; ability to call initialize or use the contract

The fix

The contract was fixed by adding a call to __Governor_init with the contract name in its initialize function.

How it was found

  1. Deploy or access the SecurityCouncilMemberRemovalGovernor contract.
  2. Call the name() function and observe it returns an empty string.
  3. Attempt to use castVoteBySig or castVoteWithReasonAndParamsBySig and observe signature verification fails due to missing EIP-712 domain data.

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.

When a smart contract is built from reusable pieces, each piece often needs a setup step called an initializer. This contract skipped the setup for two of its pieces, so its name was blank and its signature-checking system was misconfigured. As a result, votes sent with a cryptographic signature would not be checked correctly.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by AkshaySrivastav

View all

16 more disclosed reports, best first.

More from Arbitrum Security Council Election System

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.