The premium is not taken into account when calculating minExecCost in _payExecutionGas. Transaction may cosume more gas than what has been replenished.
The gas price is determined as tx.gasprice in _payExecutionGas, but the actual charge is tx.gasprice + _feeData.premium. A malicious user can consume an arbitrarily large amount of gas by making external calls at virtual account to generate shortfall. By repeating so, the gas budget of bridge agent will be depleted, and the entire system will become inoperable.
Lines of code
https://github.com/code-423n4/2023-05-maia/blob/54a45beb1428d85999da3f721f923cbf36ee3d35/src/ulysses-omnichain/RootBridgeAgent.sol#L811 https://github.com/anyswap/multichain-smart-contracts/blob/645d0053d22ed63005b9414b5610879094932304/contracts/anycall/v7/AnycallV7Config.sol#L204
Vulnerability details
Impact
The premium is not taken into account when calculating
minExecCost
in_payExecutionGas
. Transaction may cosume more gas than what has been replenished.Proof of Concept
The gas price is determined as
tx.gasprice
in_payExecutionGas
, but the actual charge istx.gasprice + _feeData.premium
. A malicious user can consume an arbitrarily large amount of gas by making external calls at virtual account to generate shortfall. By repeating so, the gas budget of bridge agent will be depleted, and the entire system will become inoperable.Tools Used
Manual
Recommended Mitigation Steps
Replace
tx.gasprice
bytx.gasprice + premium
Assessed type
DoS