DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Incorrect Use of tx.origin for Authorization

Summary

The GmxProxy.setPerpVault function uses tx.origin == owner() for validation, which is vulnerable to phishing attacks.

Vulnerability Details

  • tx.origin checks can be bypassed if the owner interacts with a malicious contract, allowing unintended perpVault assignment.

function setPerpVault(address _perpVault, address market) external {
require(tx.origin == owner(), "not owner");
}

POC:

  1. Attacker deploys a malicious contract:

    contract Phisher {
    function phish(GmxProxy gmxProxy) public {
    gmxProxy.setPerpVault(attackerVault, market);
    }
    }
  2. Tricks the owner into calling Phisher.phish() (e.g., via a fake UI).

  3. tx.origin becomes the owner’s address, setting perpVault to attackerVault.

  4. Attacker drains funds via attackerVault.

Impact

An attacker could trick the owner into initiating a transaction that changes the perpVault address, leading to loss of funds or full control over the vault’s GMX positions.

Tools Used

Manual Review

Recommendations

Replace tx.origin with msg.sender for authorization checks.

Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

invalid_tx-origin

Lightchaser: Medium-5

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!