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

AutoPxGmx rewards can be drained #142

Closed
code423n4 opened this issue Nov 26, 2022 · 5 comments
Closed

AutoPxGmx rewards can be drained #142

code423n4 opened this issue Nov 26, 2022 · 5 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-137 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-11-redactedcartel/blob/03b71a8d395c02324cb9fdaf92401357da5b19d1/src/vaults/AutoPxGmx.sol#L242-L247
https://github.com/code-423n4/2022-11-redactedcartel/blob/03b71a8d395c02324cb9fdaf92401357da5b19d1/src/PirexRewards.sol#L373

Vulnerability details

Impact

Vault rewards may be drained through a combination of claimRewards(),
compound(), and uniswap trades by the attacker.

Proof of Concept

  1. Attacker calls claimRewards({producerToken: WETH, user: vault}) to get WETH into the vault.
  2. Attacker calls compound({fee: poolFee, amountOutMinimum: 1, sqrtPriceLimitX96: 0, optOutIncentive: true}) . The attacker sandwiches this transaction with two transactions which purchase and sell WETH.
  3. The vault loses most of its WETH rewards.

Recommended Mitigation Steps

Only allow compound() to be called by trusted operators. Additionally, consider calculating amountOutMinimum based on chainlink oracle prices.

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Nov 26, 2022
code423n4 added a commit that referenced this issue Nov 26, 2022
@c4-judge
Copy link
Contributor

c4-judge commented Dec 3, 2022

Picodes marked the issue as duplicate of #183

@c4-judge
Copy link
Contributor

Picodes marked the issue as duplicate of #185

@c4-judge c4-judge added duplicate-185 satisfactory satisfies C4 submission criteria; eligible for awards and removed duplicate-183 labels Dec 30, 2022
@c4-judge
Copy link
Contributor

c4-judge commented Jan 1, 2023

Picodes marked the issue as satisfactory

@c4-judge c4-judge added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value downgraded by judge Judge downgraded the risk level of this issue and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Jan 1, 2023
@c4-judge
Copy link
Contributor

c4-judge commented Jan 1, 2023

Picodes changed the severity to 2 (Med Risk)

@C4-Staff
Copy link
Contributor

JeeberC4 marked the issue as duplicate of #137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-137 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants