Arbitrary tokens and data can be bridged to GnosisTargetDispenserL2 to manipulate staking incentives
The GnosisTargetDispenserL2 contract's onTokenBridged callback did not verify the L1 sender or the token received, so anyone could bridge any token with arbitrary data to manipulate staking incentives. An attacker could redistribute withheld funds to arbitrary targets or store fake incentives for later redemption.
Submitted by EV_om, also found by haxatron
The GnosisTargetDispenserL2 contract receives OLAS tokens and data from L1 to L2 via the Omnibridge, or just data via the AMB. When tokens are bridged, the onTokenBridged() callback is invoked on the contract. This callback processes the received tokens and associated data by calling the internal _receiveMessage() function.
However, the onTokenBridged() callback does not verify the sender of the message on the L1 side (or the token received).
This allows anyone to send any token to the GnosisTargetDispenserL2 contract on L2 along with arbitrary data. The _receiveMessage() function in DefaultTargetDispenserL2 will then process this data, assuming it represents valid staking targets and incentives.
Impact
An attacker can bridge any tokens to the GnosisTargetDispenserL2 contract on L2 with fake data for staking incentives. If the contract holds any withheld funds, these funds can be redistributed to arbitrary targets as long as they pass the checks in _processData().
Even if the contract doesn’t hold any withheld funds, the attacker can cause the amounts to be stored in stakingQueueingNonces and redeem them at a later point.
Proof of Concept
- Attacker calls
relayTokensAndCall()on the Omnibridge on L1 to send any tokens to theGnosisTargetDispenserL2contract on L2. - Attacker includes malicious staking data in the
payloadparameter. onTokenBridged()is called onGnosisTargetDispenserL2, which invokes_receiveMessage()to process the data.- Since the L1 sender is not validated, the malicious data is accepted and fake staking incentives are distributed.
Recommended Mitigation Steps
The Omnibridge contracts do not seem to provide a way to access the original sender’s address on L1 when executing the receiver callback upon receiving tokens. Hence, the most sensible mitigation may be to send the bridged tokens and associated staking data separately:
- When bridging tokens, only send the token amount without any data via
relayTokens(). - Always transmit the staking data through the AMB via
requireToPassMessage(). - Remove the
onTokenBridged()callback fromGnosisTargetDispenserL2.
This way, an attacker cannot send fake data along with the bridged tokens. The staking data will be validated to come from the authentic source on L1.
Assessed type
Access Control
High severity seems appropriate, given that this can lead to the distribution of staking incentives to arbitrary targets.
Fixed.
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
An attacker could redistribute withheld funds to arbitrary targets or store fake incentives for later redemption, potentially manipulating staking rewards.
What the attacker needed
Access to Omnibridge on L1; any tokens to bridge
The fix
The fix was to send bridged tokens without data via relayTokens(), transmit staking data only through the AMB, and remove the onTokenBridged() callback.
How it was found
- Attacker calls relayTokensAndCall() on the Omnibridge on L1 to send any tokens to the GnosisTargetDispenserL2 contract on L2.
- Attacker includes malicious staking data in the payload parameter.
- onTokenBridged() is called on GnosisTargetDispenserL2, which invokes _receiveMessage() to process the data.
- Since the L1 sender is not validated, the malicious data is accepted and fake staking incentives are distributed.
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.
This is a smart contract on a blockchain that receives tokens and instructions from another chain. It trusted any incoming message without checking who sent it, so anyone could send fake instructions to redirect rewards. The fix was to separate token transfers from instructions and only accept instructions from a trusted source.
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.