All orders which use expirationTime == 0 to support oracle cancellation are not executable. #181
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
M-03
primary issue
Highest quality submission among a set of duplicates
selected for report
This submission will be included/highlighted in the audit report
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Lines of code
https://github.com/code-423n4/2022-11-non-fungible/blob/323b7cbf607425dd81da96c0777c8b12e800305d/contracts/Exchange.sol#L378
Vulnerability details
Description
The Non Fungible supplied docs state:
Off-chain methods
"Oracle cancellations - if the order is signed with an expirationTime of 0, a user can request an oracle to stop producing authorization signatures; without a recent signature, the order will not be able to be matched"
From the docs, we can expect that when expirationTime is 0 , trader wishes to enable dynamic oracle cancellations. However, the recent code refactoring broke not only this functionality but all orders with expirationTime = 0.
Previous _validateOrderParameters:
New _validateOrderParameters:
Note the requirements on expirationTime in _canSettleOrder (old) and _validateOrderParameters (new).
If expirationTime == 0, the condition was satisfied without looking at
block.timestamp < expirationTime
.In the new code,
block.timestamp < expirationTime
is always required in order for the order to be valid. Clearly, block.timestamp < 0 will always be false, so all orders that wish to make use of off-chain cancellation will never execute.Impact
All orders which use expirationTime == 0 to support oracle cancellation are not executable.
Tools Used
Manual audit, diffing tool
Recommended Mitigation Steps
Implement the checks the same way as they were in the previous version of Exchange.
The text was updated successfully, but these errors were encountered: