Open code423n4 opened 1 year ago
trust1995 marked the issue as primary issue
trust1995 marked the issue as satisfactory
0xBugsy marked the issue as sponsor confirmed
trust1995 marked the issue as selected for report
0xBugsy marked the issue as sponsor acknowledged
0xBugsy marked the issue as sponsor confirmed
We recognize the audit's findings on Anycall Gas Management. These will not be rectified due to the upcoming migration of this section to LayerZero.
Lines of code
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/RootBridgeAgent.sol#L836 https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/BranchBridgeAgent.sol#L1066 https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/BranchBridgeAgent.sol#L1032 https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/RootBridgeAgent.sol#L811
Vulnerability details
Impact
User underpay for the remote call execution gas, meaning Incorrect minExecCost that being deposited at
_replenishGas
call inside_payExecutionGas
function.Proof of Concept
Multi chain contracts - anycall v7 lines https://github.com/anyswap/multichain-smart-contracts/blob/645d0053d22ed63005b9414b5610879094932304/contracts/anycall/v7/AnycallV7Upgradeable.sol#L265
https://github.com/anyswap/multichain-smart-contracts/blob/645d0053d22ed63005b9414b5610879094932304/contracts/anycall/v7/AnycallV7Upgradeable.sol#L167
https://github.com/anyswap/multichain-smart-contracts/blob/645d0053d22ed63005b9414b5610879094932304/contracts/anycall/v7/AnycallV7Upgradeable.sol#L276
ulysses-omnichain contract lines https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/RootBridgeAgent.sol#L811
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/RootBridgeAgent.sol#L851
The user is paying incorrect minimum execution cost for Anycall Mutlichain L820, the value of
minExecCost
is calculated incorrectly. AnycallV7 protocol considers a premium fee_feeData.premium
on top of the TX gas price which is not considered here.let's get into the flow from the start, the
anyExec
call that being called by the executer L265 when an anycall request comes from a source chain includeschargeDestFee
modifiernow, chargeDestFee modifier will call
chargeFeeOnDestChain
function as well at L167as you see L198-L210, inside chargeFeeOnDestChain function is including
_feeData.premium
for the execution costtotalCost
.The conclusion:
minExecCost
calculation doesn't include_feeData.premium
at L811 according to multichain AnycallV7 protocol.You should include
_feeData.premium
as well inminExecCost
same as L204Note: This also applicable on: _payFallbackGas() in RootBridgeAgent at L836 _payFallbackGas() in BranchBridgeAgent at L1066 _payExecutionGas in BranchBridgeAgent at L1032
Tools Used
Manual Review
Recommended Mitigation Steps
add
_feeData.premium
tominExecCost
at_payExecutionGas
function L811you need to get _feeData.premium first from AnycallV7Config by premium() function at L286-L288
Assessed type
Other