-
Notifications
You must be signed in to change notification settings - Fork 2
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
A malicious early user/attacker can manipulate the pxGmx's pricePerShare to take an unfair share of future user's deposits #407
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-275
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Comments
code423n4
added
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
labels
Nov 28, 2022
Picodes marked the issue as primary issue |
c4-judge
added
the
primary issue
Highest quality submission among a set of duplicates
label
Dec 3, 2022
This was referenced Dec 3, 2022
Closed
kphed marked the issue as sponsor acknowledged |
c4-sponsor
added
the
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
label
Dec 5, 2022
kphed marked the issue as sponsor confirmed |
c4-sponsor
added
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
and removed
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
labels
Dec 5, 2022
kphed marked the issue as sponsor acknowledged |
kphed marked the issue as sponsor confirmed |
c4-sponsor
added
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
and removed
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
labels
Dec 5, 2022
c4-judge
added
the
satisfactory
satisfies C4 submission criteria; eligible for awards
label
Dec 21, 2022
Picodes marked the issue as satisfactory |
C4-Staff
added
duplicate-275
and removed
primary issue
Highest quality submission among a set of duplicates
labels
Jan 10, 2023
JeeberC4 marked the issue as duplicate of #275 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-275
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-11-redactedcartel/blob/03b71a8d395c02324cb9fdaf92401357da5b19d1/src/vaults/AutoPxGmx.sol#L164-L166
https://github.com/code-423n4/2022-11-redactedcartel/blob/03b71a8d395c02324cb9fdaf92401357da5b19d1/src/vaults/PirexERC4626.sol#L167-L176
https://github.com/code-423n4/2022-11-redactedcartel/blob/03b71a8d395c02324cb9fdaf92401357da5b19d1/src/vaults/AutoPxGmx.sol#L173-L191
https://github.com/code-423n4/2022-11-redactedcartel/blob/03b71a8d395c02324cb9fdaf92401357da5b19d1/src/vaults/AutoPxGmx.sol#L339-L362
Vulnerability details
Impact
An attacker/early user can deposit 1 wei in the vault and increase the price per share by sending a very high value of the underlying directly to the vault, causing next vault depositors to:
redeem
usespreviewRedeem
to calculate assets per shares.AutoPxGmx.sol#L339-L362
previewRedeem
usesconvertToAssets
to do the conversion from shares to assets.AutoPxGmx.sol#L173-L191
convertToAssets
do the calculation usingtotalAssets
.PirexERC4626.sol#L167-L176
totalAssets
is determined byasset.balanceOf(address(this))
, which can be manipulated by an early user.AutoPxGmx.sol#L164-L166
Proof of Concept
Add:
import "forge-std/console.sol";
(if you want to see the logs)Run:
scripts/forgeTest.sh --match-test "Early" -vvv
Tools Used
Manual review, Foundry
Recommended Mitigation Steps
Send an amount of the first LP tokens to the address(0) as Uniswap does.
The text was updated successfully, but these errors were encountered: