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

Insufficient validation could lead to incorrect position valuations and protocol instability

Summary

The getPositionInfo function does not fully validate the position data returned by GMX, such as checking for negative values or ensuring the data is not stale.

Vulnerability Details

https://github.com/CodeHawks-Contests/2025-02-gamma/blob/84b9da452fc84762378481fa39b4087b10bab5e0/contracts/VaultReader.sol#L48-L94

Proof of Concept (PoC):

  • GMX returns incorrect position data due to a bug or manipulation.

  • The getPositionInfo function uses the incorrect data to calculate position values, leading to incorrect valuations.

  • Example:

    uint256 netValue =
    positionInfo.position.numbers.collateralAmount * prices.shortTokenPrice.min +
    positionInfo.fees.funding.claimableLongTokenAmount * prices.longTokenPrice.min +
    positionInfo.fees.funding.claimableShortTokenAmount * prices.shortTokenPrice.min -
    positionInfo.fees.borrowing.borrowingFeeUsd -
    positionInfo.fees.funding.fundingFeeAmount * prices.shortTokenPrice.min -
    positionInfo.fees.positionFeeAmount * prices.shortTokenPrice.min;

    If any of the values are incorrect, the netValue calculation will be wrong.

Impact

Insufficient validation could lead to incorrect position valuations and protocol instability.

Tools Used

Recommendations

  • Add checks for negative values and ensure the position data is not stale.

  • Implement additional validation mechanisms to ensure data accuracy.

Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Suppositions

There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.

Support

FAQs

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

Give us feedback!