The setPerpVault
function in the contract uses the tx.origin
check to verify that the original sender (the owner) is making the call. This is a potential security vulnerability as it opens the contract to phishing attacks.:
The vulnerability arises from the use of tx.origin
, which can be exploited by attackers to impersonate the legitimate user. A malicious contract can initiate a transaction on behalf of the user, and because tx.origin
would point to the original user address (not the calling contract), the setPerpVault
function would incorrectly allow the attacker to change the perpVault
address to a malicious address, potentially redirecting critical contract logic or control.
An attacker can craft a malicious contract that interacts with the vulnerable contract. The malicious contract can trick a user into executing a transaction, and since tx.origin
matches the user's address, the attacker can successfully modify critical contract state.
Manual review
Replacing the use of tx.origin
with msg.sender
. The msg.sender
variable refers to the immediate address calling the function, rather than the original transaction sender.
Lightchaser: Medium-5
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.