40,000 USDC
View results
Submission Details
Severity: medium

Use `i_price` instead of `i_tokenContract.balanceOf(address(this)`

Summary

Use i_price instead of i_tokenContract.balanceOf(address(this)

Vulnerability Details

In Escrow.sol::confirmReceipt() method, the seller is sent tokens, and the amount of tokens is i_tokenContract.balanceOf(address(this)).

The seller is only supposed to receive i_price at most, and by using i_tokenContract.balanceOf(address(this), the amount of tokens being sent could exceed i_price. This could happen if multiple attempts were made to create the Escrow contract using the same salt which could have pre-funded the account with tokens.

Impact

The seller might get overpaid if the contract has more token balance than i_price

Severity Justification

Marking this as medium as both the following medium criteria satisfy:

  • Funds are indirectly at risk

  • Disruption of protocol functionality or availability

Source: https://docs.codehawks.com/rewards-and-judging

Tools Used

Manual inspection

Recommendations

Use i_price instead of i_tokenContract.balanceOf(address(this) when transferring funds to the seller

Support

FAQs

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