40,000 USDC
View results
Submission Details
Severity: high

Risk of Malicious Arbiter in `Escrow` System

Summary

The escrow contract system is designed to handle transactions between a buyer and a seller, with an optional arbiter for dispute resolution. However, there is a potential risk if the arbiter is a malicious actor or is compromised. This could lead to an unfair distribution of funds, causing loss of funds for the buyer or seller and disrupting the intended workflow of the system.

Vulnerability Details

The arbiter is a crucial actor in the escrow contract system, especially in the dispute resolution process. The contract assumes that the arbiter is a trusted and impartial actor. However, if the arbiter is malicious or compromised, they could potentially manipulate the dispute resolution process to their advantage or to favor one party over the other. Specifically, in the resolveDispute function, the arbiter has the power to decide the buyerAward, which could potentially be manipulated.

Code Snippet

/// @inheritdoc IEscrow
function resolveDispute(uint256 buyerAward) external onlyArbiter nonReentrant inState(State.Disputed) {
uint256 tokenBalance = i_tokenContract.balanceOf(address(this));
uint256 totalFee = buyerAward + i_arbiterFee; // Reverts on overflow
if (totalFee > tokenBalance) {
revert Escrow__TotalFeeExceedsBalance(tokenBalance, totalFee);
}
s_state = State.Resolved;
emit Resolved(i_buyer, i_seller);
if (buyerAward > 0) {
i_tokenContract.safeTransfer(i_buyer, buyerAward);
}
if (i_arbiterFee > 0) {
i_tokenContract.safeTransfer(i_arbiter, i_arbiterFee);
}
tokenBalance = i_tokenContract.balanceOf(address(this));
if (tokenBalance > 0) {
i_tokenContract.safeTransfer(i_seller, tokenBalance);
}
}

Impact

If the arbiter is malicious or compromised, they could manipulate the dispute resolution process to unfairly distribute the funds. This could result in loss of funds for the buyer or seller, and disrupt the intended workflow of the escrow system.

Tools Used

Manual code review

Recommendations

To mitigate this risk, the escrow contract system could implement additional checks and balances in the dispute resolution process. For example, the system could require multiple arbiters and use a consensus mechanism to decide the outcome of a dispute. Alternatively, the system could implement a mechanism to replace the arbiter if they are compromised, such as allowing the buyer and seller to agree on a new arbiter. Additionally, the system could use a decentralized arbitration system to ensure impartiality.

Support

FAQs

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