Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: high
Invalid

[H-2] Dex Adapter Slippage Allows Keeper Front-Running in CreditDelegationBranch

Summary

Swap functions like _convertAssetsToUsdc use unverified dexAdapter.getExpectedOutput(), allowing keepers to sandwich attacks.

Vulnerability Details

Affected Code:

// No slippage parameter
usdcOut = dexSwapStrategy.executeSwapExactInputSingle(swapCallData);

Exploit Scenario:

  1. Keeper sees pending 100 ETH → USDC swap

  2. Front-runs with large ETH buy → price up 5%

  3. Protocol swap executes at worse rate

  4. Keeper profits from 5% price difference

Proof of Concept:

// Simulate price manipulation
function testSlippageAttack() public {
uint256 expectedOut = dexAdapter.getExpectedOutput(ETH, USDC, 100e18); // 100 ETH → 200,000 USDC
// Attacker front-runs
dexAdapter.swap(ETH, USDC, 1000e18); // Dump ETH → price drops 10%
// Actual swap
uint256 actualOut = creditDelegation.convertAssetsToUsdc(...100e18);
assertLt(actualOut, expectedOut * 90 / 100); // 10%+ loss
}

Impact

LP Value Extraction: 5-20% swap losses per transaction

MEV Incentivization: Protocol becomes keeper profit target

Tools Used

Foundry fork testing

MEV simulation

Recommendations

// Add slippage parameter and deadline
function _convertAssetsToUsdc(... uint256 minOut, uint256 deadline) internal {
require(block.timestamp <= deadline, "Expired");
require(usdcOut >= minOut, "Slippage exceeded");
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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