Due to lack of the input validation to check whether or not buyer != arbiter
in the Escrow#constructor()
, the buyer
can control when the dispute would be resolved. And therefore, this buyer can keep ignoring a dispute, which is initiated by a seller. (The worst scenario is that a dispute, which is initiated by a seller, will never be resolved forever due to that a malicious buyer can control when the dispute would be resolved)
Within the EscrowFactory#newEscrow()
, arbitrary addresses would be assign into the seller
parameter and the arbiter
parameter respectively. Then, they (seller
and arbiter
) and the caller address (msg.sender
) would be assigned into the new Escrow()
as the argument like this:
https://github.com/Cyfrin/2023-07-escrow/blob/main/src/EscrowFactory.sol#L23-L24
https://github.com/Cyfrin/2023-07-escrow/blob/main/src/EscrowFactory.sol#L43-L45
Within the Escrow#constructor()
, each address assigned via the EscrowFactory#newEscrow()
above would be assigned into the each parameter (buyer
, seller
, arbiter
).
Then, the buyer
and seller
would be validated whether or not each address would not be the address(0)
.
Once these validations above would be passed, each addresses (buyer
, seller
, arbiter
) would be assigned into the each state variable (i_buyer
, i_seller
, i_arbiter
) respectively like this:
https://github.com/Cyfrin/2023-07-escrow/blob/main/src/Escrow.sol#L35-L37
https://github.com/Cyfrin/2023-07-escrow/blob/main/src/Escrow.sol#L41-L42
https://github.com/Cyfrin/2023-07-escrow/blob/main/src/Escrow.sol#L47-L49
However, within the Escrow#constructor()
, there is no input validation to check whether or not buyer != arbiter
.
If a buyer assign the buyer's address him/herself into the both buyer
parameter and arbiter
parameter when the buyer call the Escrow#constructor()
via the EscrowFactory#newEscrow()
, the buyer (i_buyer
) can also become the arbiter
(i_arbiter
)
This lead to a bad situation that if a seller initiate a dispute, that dispute may never be resolved unless the arbiter
, who is also the buyer
, would resolve it by calling the Escrow#resolveDispute()
.
https://github.com/Cyfrin/2023-07-escrow/blob/main/src/Escrow.sol#L109-L129
Because in this case, the arbiter
is also the buyer
, meaning that the buyer
can control when the dispute would be resolved. And therefore, this buyer can keep ignoring a dispute, which is initiated by a seller.
The buyer
can control when the dispute would be resolved. And therefore, this buyer can keep ignoring a dispute, which is initiated by a seller. (The worst scenario is that a dispute, which is initiated by a seller, will never be resolved forever due to that a malicious buyer can control when the dispute would be resolved)
Foundry
Within the Escrow#constructor()
, consider adding the input validations in order to check whether or not buyer != arbiter
like this:
(NOTE:In this case, a seller should not be becoming a arbiter
as well. So, the input validation to check whether or not seller != arbiter
would also be added)
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.