The createTaker
function is vulnerable to issues caused by block reorganization (block reorg), which could lead to incorrect offer fulfillment for takers. Block reorgs occur when a different version of the blockchain becomes the longest chain, potentially altering the sequence of transactions. Due to this issue, taker
can fulfill wrong offer
if there is re-org in offer creation.
The createOffer
function is used to create new offer by maker
. It creates the offer
which is address corresponding to offerId
. taker
can call createTaker(address _offer, uint256 _points)
. Due to block-reorg, the taker can pass _offer
which can be different from what the taker
intends. Below is scenario based POC to understand the issue in detail:
Let's assume offerId
before this is: 13
(can be any number and following scenarios will hold for any initial offerId
)
Transaction T1
: Maker M1
lists bid offer to buy 100 points
in marketplace MP1
with collateral rate
of 110%
for amount 1000 USDC
. offerId
corresponding to this offer is 13
.
Transaction T2
: Maker M2
lists bid offer to buy 100 points
in marketplace MP2
with collateral rate
of 110%
for amount 1000 USDC
.offerId
corresponding to this offer is 14
.
Transaction T3
: Taker T1
calls createTaker
on offerId = 13
and points = 100
. So, T1
will deposit collateral of 1000 * 110% = 1100 USDC
and gets the stock corresponding to the offerId = 15
for marketplace MP1
.
Now, let's assume block-reorg happens and re-ordering happens as T2 -> T1 -> T3
:
offerId
will be 13
as mentioned earlier:
Transaction T2
: Maker M2
lists bid offer to buy 100 points
in marketplace MP2
with collateral rate
of 110%
for amount 1000 USDC
.offerId
corresponding to this offer is 13
.
Transaction T1
: Maker M1
lists bid offer to buy 100 points
in marketplace MP1
with collateral rate
of 110%
for amount 1000 USDC
. offerId
corresponding to this offer is 14
.
Transaction T3
: Taker T1
calls createTaker
on offerId = 13
and points = 100
. So, T1
will deposit collateral of 1000 * 110% = 1100 USDC
and gets the stock corresponding to the offerId = 15
for marketplace MP2
. (VULNERABILITY)
So, as you can check, the takerT1
bought the points which he doesn't intend to buy due to block-reorg.
The vulnerability is more severe if taker T1
has infinite-allowance of tokens or allowance more than required. In that case, the taker
order will be filled for more amount and taker
will need to pay for that.
taker
can fill different offers in marketplace which they don't intend to. Also, the taker can have loss of funds if different offer with more than intended amount is filled(and there is prior-allowance to contract)
Manual review
Along with offer
and points
, createTaker
should also take arguments of marketplace
and amount(collateral)
which they wanted to get filled with.
Invalid, the taker should be creating a taker offer for an already existing maker offer that has been finalized, i.e. createOffer has been successfully executed before reorg occurs, so this is a non-issue
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.