Skip to content
Discussion options

You must be logged in to vote

Yes, it's still considered a serious security risk.
Using tx.origin in access control is unsafe because any contract that your user interacts with can trigger your contract, meaning that malicious contracts could trick users into executing actions as if they were authorized.

The correct approach is to use msg.sender, which refers to the direct caller of the function, not the origin of the full transaction.

Best practice: never use tx.origin for authorization logic, this hasn't changed.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by joanthecoder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants