Severity: Medium
Confidence: High
The newEscrow function in the EscrowFactory contract is responsible for creating new instances of the Escrow contract. The function performs several critical checks, including validating the allowance of the tokenContract and ensuring it is greater than or equal to the specified price. This check is essential to ensure that the contract can transfer the required tokens on behalf of the user.
uint256 allowance = tokenContract.allowance(msg.sender, address(this));
require(allowance >= price, "insufficient balance for token transfer");
Importance of Allowance Check:
The allowance check ensures that the caller (msg.sender) has granted permission to the EscrowFactory contract (address(this)) to transfer price amount of tokens on their behalf. It is a critical security measure to prevent unauthorized or unintended token transfers, as the Escrow contract will later transfer the price amount of tokens from the caller to the computed escrow address.
Vulnerability If Not Present:
If the allowance check were not present in the newEscrow function, it could lead to potential vulnerabilities:
Unauthorized Token Transfers: Without the allowance check, anyone could call the newEscrow function and create an Escrow contract on behalf of any other address, transferring tokens without their consent. This could result in the loss of tokens and financial harm to the users.
Denial of Service: Malicious actors could exploit the lack of allowance check to repeatedly call the newEscrow function with a large price value, causing users' token balances to be repeatedly reduced without any corresponding benefit or service provided.
Audit Recommendation:
The current implementation of the newEscrow function is secure due to the presence of the allowance check, which ensures that token transfers are authorized by the user. This prevents unauthorized token transfers and protects users from potential vulnerabilities.
Conclusion:
The presence of the allowance check in the newEscrow function is a critical security measure that ensures authorized token transfers and protects users from potential vulnerabilities. The EscrowFactory contract, with the current implementation, can safely create new instances of the Escrow contract while adhering to the required authorization checks.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.