This repository has been archived by the owner on Oct 8, 2023. It is now read-only.
ks__xxxxx - SafeCall.call() function is still being used even after having SafeCall.callWithMinGas() which follows the EIP-150 63/64th Rule for Gas #54
Labels
Non-Reward
This issue will not receive a payout
Sponsor Disputed
The sponsor disputed this issue's validity
ks__xxxxx
medium
SafeCall.call() function is still being used even after having SafeCall.callWithMinGas() which follows the EIP-150 63/64th Rule for Gas
Summary
SafeCall.call() function is being used without following the follows the EIP-150 63/64th Rule for Gas which could result in the locking of funds permenantly.
I am filing the finding as Medium Severity as we are still using legacy function instead of a an updated function which follows EIP 150 63/64th Rule for Gas guidelines perfectly
Vulnerability Detail
finalizeBridgeETH() function in StandardBridge.sol is using the legacy SafeCall.call() function instead of using the latest SafeCall.callWithMinGas() which follows the EIP-150 63/64th Rule for Gas.
As we know that the EVM limits the total gas forwarded on to 63/64ths of the total gasleft(), so if a malicious user call this finalizeBridgeETH() function with a limited amount of gas ( when gasLeft() < minimum amount of gas required for transaction ), the transactions will fail and also since there are no replays in the contract the user funds will be locked.
Impact
A malicious user can call finalizeBridgeERC20() when the gasLeft() is less than minimum gas required to pass the call, It would result in their funds permanently locked in the OptimismPortal contract.
Tagging this as medium
Code Snippet
https://github.com/sherlock-audit/2023-03-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/L1/L1StandardBridge.sol#L222
https://github.com/sherlock-audit/2023-03-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/L2/L2StandardBridge.sol#L152
https://github.com/sherlock-audit/2023-03-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/universal/StandardBridge.sol#L308
Tool used
Manual Review
Recommendation
use SafeCall.callWithMinGas() function instead of SafeCall.call() which does an assertion on gasLeft() using the 63/64th Rule for Gas
The text was updated successfully, but these errors were encountered: