# An attacker can steal Accumulated Awards from RootBridgeAgent by abusing retrySettlement()

retrySettlement() fails to zero userFeeInfo.gasToBridgeOut, letting an attacker reuse one gas deposit across multiple retries and drain RootBridgeAgent accumulated fees.

- Payout: Contest reward
- Severity: high
- Program: Maia DAO Ecosystem
- Credited: Voyvoda
- Disclosed: 2023-09-18
- Write-up quality: 8/10
- Original: https://github.com/code-423n4/2023-05-maia-findings/issues/645
- Library page: https://bugbountylibrary.com/r/c4%3A2023-05-maia%3AH-11
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic vuln:fee-bypass

**Target:** RootBridgeAgent retrySettlement / MulticallRootRouter / VirtualAccount
**Root cause:** retrySettlement() reuses userFeeInfo.gasToBridgeOut for each retry without clearing it, so multiple retries inside one anyExecute each swap out the same gas amount, spending Root reserves.
**Steps:**
1. Attacker calls callOutSignedAndBridge from Branch with minimal depositedGas but remoteExecutionGas too low, causing anyFallback and failed settlements (repeat for nonces 1,2).
2. Attacker sends callOutSignedAndBridge with MulticallRouter params containing two calls to `retrySettlement(1,0)` and `retrySettlement(2,0)` targeting RootBridgeAgent.
3. Inside anyExecute, initialGas>0 so retrySettlement skips msg.value deposit and _manageGasOut swaps userFeeInfo.gasToBridgeOut again for each retry.
4. Each retry overwrites settlement gas and re-performs call; excess gas is refunded on Branch Chain to attacker.
5. Attacker redeems refunded gas on Branch, netting >1 ether from 1 ether start; accumulatedFees no longer matches WETH balance, bricking sweep().
**How found:** Code review of retrySettlement/_retrySettlement gas accounting: noticed userFeeInfo.gasToBridgeOut is never reset after _manageGasOut, and that initialGas>0 path skips payment, enabling reuse across multiple retries in one anyExecute.
**Exploitation:** Attacker funds a single cross-chain call with gasToBridgeOut, embeds multiple retrySettlement calls via MulticallRootRouter/VirtualAccount; each retry re-swaps the same gasToBridgeOut amount, and the unused remote gas is refunded to the attacker on the Branch Chain, extracting RootBridgeAgent accumulated fees.
**Escalation:** Repeat retries within one anyExecute to amplify drain; mismatch bricks sweep() leaving remaining rewards stuck.
**Insight:** In cross-chain gas-accounting contracts, check whether per-call fee state (gasToBridgeOut, depositedGas) is cleared after consumption; batch entrypoints like multicall/virtual accounts let one paid parameter be replayed many times within a single execution context.
