Rules › Solidity

tx.origin used for authorization

highSolidityRule sol-tx-origin-auth

Checking tx.origin lets any contract the owner interacts with act as the owner.

Why it matters

tx.origin is the externally owned account that started the transaction, however many contracts it passed through. If an owner calls any malicious contract (a token, an airdrop claim, an NFT mint), that contract can call yours and pass a tx.origin == owner check. msg.sender is the immediate caller, which is what authorization needs.

Vulnerable

function sweep(address payable to) external {
    require(tx.origin == owner, "not owner");
    to.transfer(address(this).balance);
}

Fixed

function sweep(address payable to) external onlyOwner {
    (bool ok, ) = to.call{value: address(this).balance}("");
    if (!ok) revert TransferFailed();
}

What other tools call it

ToolDetector or reference
Slithertx-origin
Solhintavoid-tx-origin
SWC registrySWC-115

Check your code

Paste a contract into the in-browser checker, or let the Claude Code plugin scan before every deploy. The quick check for this rule is a pattern match: treat a hit as "look here", and a miss as no guarantee.

Static analysis finds known bug classes; it can't prove code is safe and isn't an audit. Get a professional audit before deploying code that will hold value.