Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bauer - Use msg.sender instead of tx.origin #31

Closed
sherlock-admin2 opened this issue Sep 9, 2024 · 0 comments
Closed

Bauer - Use msg.sender instead of tx.origin #31

sherlock-admin2 opened this issue Sep 9, 2024 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A Medium severity issue. Reward A payout will be made for this issue

Comments

@sherlock-admin2
Copy link
Contributor

sherlock-admin2 commented Sep 9, 2024

Bauer

Medium

Use msg.sender instead of tx.origin

Summary

In the mint(), burn(), open(), close(), and liquidate() functions, the protocol uses tx.origin to identify the user. Using tx.origin makes users more vulnerable to phishing attacks.

Root Cause

https://github.com/sherlock-audit/2024-08-velar-artha/blob/main/gl-sherlock/contracts/core.vy#L166
https://github.com/sherlock-audit/2024-08-velar-artha/blob/main/gl-sherlock/contracts/core.vy#L202
https://github.com/sherlock-audit/2024-08-velar-artha/blob/main/gl-sherlock/contracts/core.vy#L241
https://github.com/sherlock-audit/2024-08-velar-artha/blob/main/gl-sherlock/contracts/core.vy#L281
https://github.com/sherlock-audit/2024-08-velar-artha/blob/main/gl-sherlock/contracts/core.vy#L318

The protocol uses tx.origin instead of msg.sender as the user to execute the subsequent operations.

user    : address       = tx.origin

Internal pre-conditions

External pre-conditions

Attack Path

  1. A malicious attacker deploys a contract.
  2. A user interacts with the malicious contract.
  3. Within the malicious contract’s function, it calls mint(), burn(), open(), close(), or similar operations.

As a result, the user's assets can be manipulated without their authorization.

Impact

The user is subjected to a phishing attack.

PoC

@external
def mint(
id : uint256,
base_token : address,
quote_token : address,
lp_token : address,
base_amt : uint256,
quote_amt : uint256,
ctx : Ctx) -> uint256:

self._INTERNAL()

user : address = tx.origin

Mitigation

Use msg.sender instead of tx.origin.

Duplicate of #82

@github-actions github-actions bot added Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A Medium severity issue. labels Sep 11, 2024
@sherlock-admin3 sherlock-admin3 changed the title Great Pickle Worm - Use msg.sender instead of tx.origin Bauer - Use msg.sender instead of tx.origin Sep 11, 2024
@sherlock-admin3 sherlock-admin3 added the Reward A payout will be made for this issue label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A Medium severity issue. Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

2 participants