sherlock-audit / 2023-01-optimism-judging

22 stars 8 forks source link

w42d3n - Use of tx.origin in OptimismPortal.sol #303

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

w42d3n

low

Use of tx.origin in OptimismPortal.sol

Summary

Vulnerability Detail

In OptimismPortal.sol in the finalizeWithdrawalTransaction(() function tx.origin is used. tx.origin is a global variable in Solidity which returns the address of the account that sent the transaction.

Impact

Using the variable could make a contract vulnerable if an authorized account calls into a malicious contract.

Code Snippet

https://github.com/ethereum-optimism/optimism/blob/3f4b3c328153a8aa03611158b6984d624b17c1d9/packages/contracts-bedrock/contracts/L1/OptimismPortal.sol#L341-L343

        if (success == false && tx.origin == Constants.ESTIMATION_ADDRESS) {
            revert("OptimismPortal: withdrawal failed");
        }

Tool used

Manual Review

Recommendation

Its recommended to use msg.sender instead

References

https://www.adrianhetman.com/unboxing-tx-origin/