sherlock-audit / 2024-09-predict-fun-judging

0 stars 0 forks source link

Rough Raisin Guppy - Denial of Service via Unfulfilled Asset Transfers #257

Open sherlock-admin4 opened 2 days ago

sherlock-admin4 commented 2 days ago

Rough Raisin Guppy

Medium

Denial of Service via Unfulfilled Asset Transfers

Summary

The PredictDotLoan.sol contract contains a vulnerability that allows malicious users to perform a Denial of Service (DoS) attack by preventing essential asset transfers during the loan acceptance process. Specifically, if either the lender or borrower fails to transfer the required assets—such as protocol fees or collateral—the loan acceptance function can be stalled or permanently blocked. This vulnerability disrupts the normal functioning of the protocol, discouraging legitimate users from participating and undermining the platform's reliability.

Root Cause

  1. Dependence on External Asset Transfers:
    • In the loan acceptance process, the contract executes external asset transfers:
       uint256 protocolFee = _transferLoanAmountAndProtocolFee(lender, borrower, fulfillAmount);
       CTF.safeTransferFrom(borrower, address(this), positionId, collateralAmountRequired, "");
    • These transfers rely on the lender and borrower to have granted the necessary approvals and possess sufficient balances.
  2. Potential for Malicious Exploitation:
    • A malicious user can exploit this by creating loan proposals and deliberately withholding asset transfers. This action prevents the contract from progressing, effectively causing a DoS condition.

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

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

  1. Malicious Proposal Creation:
    • A malicious user crafts loan proposals while ensuring that the lender or borrower lacks the necessary approvals or sufficient token balances.
  2. Refusal to Transfer Assets:
    • Upon loan acceptance attempts, the affected party (lender or borrower) deliberately refuses or fails to execute the required safeTransferFrom calls.

Impact

PoC

No response

Mitigation

Instead of automatically transferring assets during the loan acceptance, require users to pull their assets by depositing them into the contract via separate functions.