Submitted by ladboy233
According to https://github.com/ProjectOpenSea/seaport/blob/main/docs/SeaportDocumentation.md#contract-orders:
The CreateOfferer.sol aims to be comply with the interface ContractOffererInterface.
The life cycle of the contract life cycle here is here:
https://github.com/ProjectOpenSea/seaport/blob/main/docs/SeaportDocumentation.md#example-lifecycle-journey
First the function _getGeneratedOrder is called.
Then after the order execution, the function ratifyOrder is triggered for contract (CreateOfferer.sol) to do post order validation.
In the logic of ratifyOrder, the nonce is incremented by calling this line of code Helpers.processNonce.
This is calling this line of code.
The CreateOffererStructs.Nonce data structure is just nonce.
But this is not how Seaport contract track contract nonce.
On Seaport contract, we are calling _getGeneratedOrder.
Which calls _callGenerateOrder.
As we can see:
Nonce will be incremented even for skipped orders.
This is very important, suppose the low level call _callGenerateOrder return false, we are hitting the else block.
This is calling _revertOrReturnEmpty.
Clearly we can see that if the flag revertOnInvalid is set to false, then even the low level call return false, the nonce of the offerer is still incremented.
Where in the Seaport code does it set revertOnInvalid to false?
When the Seaport wants to combine multiple orders in this line of code.
We call _validateOrderAndUpdateStatus.
Finally we call the logic _getGeneratedOrder(orderParameters, advancedOrder.extraData, revertOnInvalid) below with parameter revertOnInvalid false.
Ok what does this mean?
Suppose the CreateOfferer.sol fulfills two orders and creates two delegate tokens.
The nonces start from 0 and then increment to 1 and then increment to 2.
A user crafts a contract with malformed minimumReceived and combines with another valid order to call OrderCombine.
As we can see above, when multiple order is passed in, the revertOnInvalid is set to false, so the contract order from CreateOfferer.sol is skipped, but the nonce is incremented.
Then the nonce tracked by CreateOfferer.sol internally is out of sync with the contract nonce in seaport contract forever.
Then the CreateOfferer.sol is not usable because if the ratifyOrder callback hit the contract, transaction revert in this check.
I would recommend do not validate the order execution in the ratifyOrder call back by using the contract nonce, instead, validate the order using orderHash.
DoS
0xfoobar (Delegate) confirmed and commented:
Alex the Entreprenerd (judge) commented:
Alex the Entreprenerd (judge) commented:
Alex the Entreprenerd (judge) commented:
0xfoobar (Delegate) disagreed with severity and commented:
Alex the Entreprenerd (judge) decreased severity to Medium and commented:
ladboy233 (warden) commented:
Alex the Entreprenerd (judge) commented:
For this audit, 10 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by DadeKuma received the top score from the judge.
The following wardens also submitted reports: p0wd3r, gkrastenov, Fulum, sces60107, Brenzee, kodyvim, lsaudit, ladboy233, and lodelux.
