Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Latest commit

 

History

History
36 lines (20 loc) · 1.57 KB

049.md

File metadata and controls

36 lines (20 loc) · 1.57 KB

Bnke0x0

low

AVOID USING TX.ORIGIN

Summary

Vulnerability Detail

Impact

tx.origin is a global variable in Solidity that returns the address of the account that sent the transaction.

Using the variable could make a contract vulnerable if an authorized account calls a malicious contract. You can impersonate a user using a third party contract.

This can make it easier to create a vault on behalf of another user with an external administrator (by receiving it as an argument). Sources:

Code Snippet

https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/L1/OptimismPortal.sol#L376 => 'if (msg.sender != tx.origin) {'

https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/L1/OptimismPortal.sol#L341 => if (success == false && tx.origin == Constants.ESTIMATION_ADDRESS) {

https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/universal/CrossDomainMessenger.sol#L339 => if (tx.origin == Constants.ESTIMATION_ADDRESS) {

Tool used

Manual Review

Recommendation