Change of operators possible from old operators
The smart contract's operator transfer function did not update the current operators list during a batch execution, allowing multiple transferOperatorship commands in one transaction to all succeed even after the signers were no longer current operators. An attacker with a set of operators could thus replace all other operators in a single transaction, potentially gaining full control.
Submitted by Lambda, also found by Respx and Ruhum
AxelarGateway.sol#L268 AxelarGateway.sol#L311
According to the specifications, only the current operators should be able to transfer operatorship. However, there is one way to circumvent this. Because currentOperators is not updated in the loop, when multiple transferOperatorship commands are submitted in the same execute call, all will succeed. After the first one, the operators that signed these commands are no longer the current operators, but the call will still succeed.
This also means that one set of operators could submit so many transferOperatorship commands in one execute call that OLD_KEY_RETENTION is reached for all other ones, meaning they would control complete set of currently valid operators.
Recommended Mitigation Steps
Set currentOperators to false when the operators were changed.
re1ro (Axelar) confirmed, but disagreed with severity and commented:
This case would never occur in practice because our command batches are produced and signed by the Axelar nerwork. So there would be never 2
transferOperatorshipcommands in the same batch.In general if the recent operators turn malicious they can overtake the gateway disregarding this finding.
Mitigation We still have added the sanity check to set
currentOperatorstofalse. https://github.com/axelarnetwork/axelar-cgp-solidity/pull/138
milapsheth (Axelar) commented:
For more context, the current operators could just easily transfer the operatorship in multiple txs instead. We heavily rely on the assumption the majority of the operators by weight are not malicious.
Alex the Entreprenerd (judge) commented:
Very interesting find.
Per the warden submission: the operators can sign a
transferOperatorshipand then still act as if they are the current operator while their calls are being executed.This can be further extended to perform more than
OLD_KEY_RETENTIONto invalidate all old keys, which may be desirable or a malicious attack depending on context.The sponsor disagrees with severity, citing that the main assumption of the code is that operators by weight are non malicious
Personally I think the finding:
- Breaks an assumption of the code (current operators exclusively can
transferOperatorship)- Allows the operators to kick old operators in one tx instead of
OLD_KEY_RETENTIONtxs
Alex the Entreprenerd (judge) commented:
With the information that I have, considering that:
- Breaks an assumption of the code (current operators exclusively can transferOperatorship)
- Allows the operators to kick old operators in one tx instead of OLDKEYRETENTION txs
Because this is contingent on a malicious majority, and considering that a malicious majority can perform even worse attacks (DOS, TX Censoring, Shutting down the chain)
I believe that Medium Severity is correct.
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
Impact
A set of operators could replace all other operators in a single transaction, potentially taking full control of the gateway, though the sponsor argues this requires a malicious majority and would not occur in practice.
What the attacker needed
Malicious majority of operators by weight
The fix
The contract was fixed by adding a sanity check to set currentOperators to false when operators are changed.
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 a smart contract, operators are like administrators who can transfer their role to others. The code was supposed to check that only current operators can do this, but it forgot to update the list of current operators during a batch of commands. So, if several transfer commands were sent together, they all went through even though the senders were no longer authorised after the first one.
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.