Council veto protection does not work
The veto function in the Vader governance contract checks the wrong data to detect proposals that would remove the council, so the council can veto any attempt to replace them and remain in power indefinitely.
Originally disclosed on Code4rena
Submitted by TomFrenchBlockchain
Council can veto proposals to remove them to remain in power.
Proof of Concept
The Vader governance contract has the concept of a “council” which can unilaterally accept or reject a proposal. To prevent a malicious council preventing itself from being replaced by the token holders, the veto function checks the calldata for any proposal action directed at GovernorAlpha to see if it matches the changeCouncil function selector.
Note this is done by reading from the proposal.calldatas array.
If we look at the structure of a proposal however we can see that the function selector is held (in the form of the signature) in the signatures array rather than being included in the calldata. The calldata array then holds just the function arguments for the call rather than specifying which function to call.
Indeed if we look at the TimeLock contract we see that the signature is hashed to calculate the function selector and is prepended onto the calldata.
Looking at the function signature of the changeCouncil we can see that the value that the veto function will check against this.changeCouncil.signature will be the first 4 bytes of an abi encoded address and so will always be zero no matter what function is being called.
High risk as this issue gives the council absolute control over the DAO such that they cannot be removed.
Recommended Mitigation Steps
Hash the function signatures to calculate function selectors and then check those rather than the calldata.
This is something that should be picked up by a test suite however, I’d recommend writing tests to ensure that protections you add to the code have any affect and more broadly check that the code behaves as expected.
SamSteinGG (Vader) acknowledged
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 veto check compares the function selector against the calldata array, but the selector is actually stored in the signatures array and prepended later, so the check always fails to match.
Impact
The council can veto any proposal to remove them, giving them absolute control over the DAO and making them impossible to remove.
What the attacker needed
Council role in the DAO
The fix
The function signatures should be hashed to calculate function selectors and those should be checked instead of the calldata.
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.
In this system, a small group called the council can block any proposal. The code tried to stop them from blocking proposals that would remove them, but it looked in the wrong place for the function name. So the council can always block those proposals and stay in charge.
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.