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

Strict equality in PerpetualVault.sol

Summary

Function _createDecreasePosition uses strict equality.

function _createDecreasePosition(
uint256 collateralDeltaAmount,
uint256 sizeDeltaInUsd,
bool _isLong,
uint256 acceptablePrice,
MarketPrices memory prices
) internal {
address[] memory swapPath;
Order.OrderType orderType = Order.OrderType.MarketDecrease;
uint256 sizeInUsd = vaultReader.getPositionSizeInUsd(curPositionKey);
if (
// @ audit strict equality
sizeDeltaInUsd == 0 ||
vaultReader.willPositionCollateralBeInsufficient(
prices,
curPositionKey,
market,
_isLong,
sizeDeltaInUsd,
collateralDeltaAmount
)
) {
sizeDeltaInUsd = sizeInUsd;
}

Vulnerability Details

The function checks if collateral will be insufficient before reducing position size. An attacker can manipulate sizeDeltaInUsd by submitting a slightly higher or lower value to disrupt position adjustments, leading to potential market manipulation, forced liquidations, or position locking.

Example Attack Scenario

  • Bob holds a $1M for long position on ETH.

  • The attacker locks Bob’s position so that Bob cannot close or adjust.

  • The market moves against Bob, triggering forced liquidation.

  • Liquidation means ETH is sold at a discount.

  • The attacker buys Bob’s liquidated ETH at a lower price, profiting from the forced event.

    Attacker Gains: Cheap ETH (or other assets) due to artificial liquidations.

Impact

Fail to adjust or close possitions

Potential loss of funds or funds locked

Forced liquidation

Creates liquidity risks by keeping unwanted positions open

Tools Used

Manual review

Recommendations

Don't use strict equality, instead use <=

Updates

Lead Judging Commences

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

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.