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

Price Data Initialization in Closed Position Flows

PerpetualVault.sol

Observation:
When the vault is in a “closed” state (no active GMX position), the contract creates a MarketPrices variable without explicitly initializing its fields before passing it into functions like _mint or _withdraw.

MarketPrices memory prices;
_mint(counter, amount, false, prices);

Risk:
While the current logic might not directly use these uninitialized values (because of the branch on positionIsClosed), any future change or subtle refactoring could inadvertently access uninitialized fields, leading to miscalculations. An attacker with knowledge of the code might try to force a code path where these uninitialized values are used, thereby causing an exploitable mispricing or unexpected behavior.

Recommendation:
Even in branches where the price data is “not needed,” it is safer to explicitly initialize the struct—either by fetching real-time data from a trusted source or by defining sensible default values.

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.

Support

FAQs

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

Give us feedback!