A race condition vulnerability exists between the closeOffer
function in the PreMarkets.sol
contract and the settleAskMaker
function in the DeliveryPlace.sol
contract of the Tadle protocol. An attacker can exploit this race condition to receive more refund tokens than the amount initially deposited as collateral.
The vulnerability arises because the closeOffer
function and settleAskMaker
function both interact with the same offer and have conflicting states regarding the offer’s status.
The closeOffer
function changes the status of an offer to Canceled
and processes the refund amount.
This function processes settlement for an offer if it is either Virgin
or Canceled
. It calculates the refund amount with this status and adds tokens to the maker’s balance.
If an attacker quickly calls settleAskMaker
before the closeOffer
transaction has fully processed, they might exploit the overlapping states of the offer.
An attacker exploiting this vulnerability could potentially receive more refund tokens than they initially deposited as collateral, which could result in significant financial loss for the platform. The risk is exacerbated if the attacker is able to continuously exploit this race condition in a high-frequency manner.
Here’s an example of how an attacker might exploit this race condition.
If the settleAskMaker
function is called before closeOffer
has completed, the attacker might receive extra refund tokens.
Manual code review
Implement synchronization mechanisms or use reentrancy guards to prevent race conditions.
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.