20,000 USDC
View results
Submission Details
Severity: high

Possible Frontrunning with `loanId`

Summary

Here is a sample scenario

  1. The pool contains three loans: loan 0 and loan 2 are owned by userA, and loan 1 is owned by userB.

  2. UserB submits a transaction to repay their loan with loanId 1.

  3. UserA, who is monitoring the blockchain, quickly sees userB's transaction and decides to take advantage of the situation.

  4. UserA submits their transaction to repay their loan with loanId 0, using a higher gas price to prioritize their transaction over userB's.

  5. Miners, who are motivated by higher gas fees, prioritize userA's transaction and execute it first.

  6. As a result, loan 0 gets removed from the array, and now userB's loan (formerly at position 1) becomes loan 0 in the pool.

  7. However, in userB's original transaction, they intended to repay loanId 1, which now corresponds to userA's loan. Therefore, userA's loan gets repaid, leaving userB's loan unaffected.

  8. UserB's loan remains unpaid, and they end up inadvertently repaying userA's loan instead.

Support

FAQs

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