Skip to content

Latest commit

 

History

History
74 lines (45 loc) · 2.13 KB

078.md

File metadata and controls

74 lines (45 loc) · 2.13 KB

Melodic Mocha Aardvark

Medium

No Slippage Protection in Loan Fulfillment Leading to Front-Running and Other Unfair Executions

Summary

The contract allows for loan fulfillment through functions like acceptBorrowRequest, acceptLoanOffer, and acceptLoanOfferAndFillOrder. Meanwhile, these functions don't include explicit slippage protection mechanisms.

Relavant parts

function acceptBorrowRequest(
    Proposal calldata proposal,
    uint256 fulfillAmount
) external nonReentrant whenNotPaused {
    _assertProposalIsBorrowRequest(proposal);
    _acceptOffer(proposal, fulfillAmount);
}

function acceptLoanOffer(Proposal calldata proposal, uint256 fulfillAmount) external nonReentrant whenNotPaused {
    _assertProposalIsLoanOffer(proposal);
    _acceptOffer(proposal, fulfillAmount);
}

function _acceptOffer(Proposal calldata proposal, uint256 fulfillAmount) private {
   
    
    uint256 collateralAmountRequired = _calculateCollateralAmountRequired(proposal, fulfillment, fulfillAmount);
    
  
}

The point here is that

  • The fulfillAmount is provided by the caller without any slippage checks.

  • There's no mechanism to specify a minimum or maximum acceptable collateral amount.

  • The contract doesn't compare the execution conditions with current market rates or expected values.

Root Cause

https://github.com/sherlock-audit/2024-09-predict-fun/blob/main/predict-dot-loan/contracts/PredictDotLoan.sol#L976

https://github.com/sherlock-audit/2024-09-predict-fun/blob/main/predict-dot-loan/contracts/PredictDotLoan.sol#L206

https://github.com/sherlock-audit/2024-09-predict-fun/blob/main/predict-dot-loan/contracts/PredictDotLoan.sol#L195

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

  • The nature of the fulfillment calculation makes these transactions potential targets for MEV
  • fulfillment transactions can be front-runned even though expiration check
  • The contract allows partial fulfillment, which could lead to unexpected execution if market conditions change rapidly

PoC

No response

Mitigation

No response