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

The deposit function lacks a slippage protection mechanism.

Summary

The protocol is built around a Vault architecture, allowing users to deposit and withdraw funds that are then used to open leveraged positions via the GMX protocol. However, the current implementation is flawed because the deposit function lacks a mechanism to ensure that users receive a minimal amount of shares.

Vulnerability Details

The current implementation of deposit is as follows:

function deposit(uint256 amount) external nonReentrant payable {
_noneFlow();
if (depositPaused) {
revert Error.Paused();
}
if (amount < minDepositAmount) {
revert Error.InsufficientAmount();
}
if (totalDepositAmount + amount > maxDepositAmount) {
revert Error.ExceedMaxDepositCap();
}
flow = FLOW.DEPOSIT;
collateralToken.safeTransferFrom(msg.sender, address(this), amount);
counter++;
depositInfo[counter] = DepositInfo(amount, 0, msg.sender, 0, block.timestamp, address(0));
totalDepositAmount += amount;
EnumerableSet.add(userDeposits[msg.sender], counter);
if (positionIsClosed) {
MarketPrices memory prices;
_mint(counter, amount, false, prices);
_finalize(hex'');
} else {
_payExecutionFee(counter, true);
// Mint share token in the NextAction to involve off-chain price data and improve security
nextAction.selector = NextActionSelector.INCREASE_ACTION;
nextAction.data = abi.encode(beenLong);
}
}

The issue with this implementation is that users have no control over how many shares they will receive, making them vulnerable to MEV attacks due to the lack of slippage protection.

Impact

Users may receive fewer shares than expected, exposing them to MEV attacks.

Tools Used

Manual review.

Recommendations

Introduce a slippage parameter to mitigate this issue.

Updates

Lead Judging Commences

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

invalid_shares_slippage

Shares represent a part of the vault. Even if someone performs a frontrun or sandwich attack, you will still have the corresponding amount of shares representing your deposit. A user could add liquidity two days later, and you would still have the same amount of shares.

Support

FAQs

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