Open codehawks-bot opened 1 year ago
The arbitor can be 0
The following issue has been accepted as a high severity issue: https://github.com/Cyfrin/2023-07-escrow/issues/621
The issue I have submitted is identical to the one that I previously mentioned. I think that at this point also this issue should be accepted and marked as high.
Escrow
should not be deployed without anarbiter
to avoid possible scenario where funds are stuck in the contractSeverity
Low Risk
Relevant GitHub Links
https://github.com/Cyfrin/2023-07-escrow/blob/main/src/Escrow.sol#L32-L51
https://github.com/Cyfrin/2023-07-escrow/blob/main/src/Escrow.sol#L103
Summary
If no
arbiter
is configured,initiateDispute
will always revert and funds will be stuck in theEscrow
contract.Vulnerability Details
When the
Escrow
contract is deployed via theEscrowFactory
,price
tokens will be transferred from thebuyer
address to theEscrow
contract.Those funds will be stored in the contract until one of these events happens:
1)
seller
correctly provides its service off-chain and thebuyer
executesconfirmReceipt
by transferring the funds from theEscrow
contract to theseller
account 2)buyer
orseller
are in dispute and one of them callinitiateDispute
. At this point, thearbiter
considers the situation off-chain and executeresolveDispute
to split theEscrow
funds between thebuyer
andseller
(minus thearbiterFee
)The second option is only available if the
arbiter
address is correctly configured, otherwise the call toinitiateDispute
will always revert.In a scenario where a dispute is needed and the
arbiter
has not been configured, those funds will always be stuck in theEscrow
contract.Scenario 1) The seller does not provide the service. In this case, the buyer wants his tokens back, but the only possible option available (because no arbiter is configured) to move funds is
confirmReceipt
that would send the funds to the seller who did not provide the service. Scenario 2) The seller has correctly provided the service, but the buyer refuses to pay and will not executeconfirmReceipt
. In this case, the buyer has received the off-chain work, but the seller will not get paid, and the funds will remain in the contract.Impact
Funds remain stuck in the contracts or go to a
seller
that have not provided the service.Tools Used
Manual
Recommendations
The
Escrow
contract should always be fully configured to avoid the two scenarios explained above. If thearbiter
orarbiterFee
are not correctly configured, the creation of theEscrow
should revert.The
Escrow.constructor
should perform the following checks: 1)arbiter != address(0)
2)arbiterFee
should have a lower bound (proportional to theprice
) to incentivize thearbiter
to fulfil the role