For off-chain orders, it's crucial to ensure that the fill price doesn't exceed the target price for buy orders and isn't below the target price for sell orders. This is correctly stated in the code comments:
However, the code implementation contradicts this logic.
Taking a buy order as an example, when the target price is lower than the actual fill price, it means the user would have to pay a higher cost than expected to complete the transaction. In this case, ctx.isFillPriceValid becomes true, and the order is not skipped but executed, which is clearly not what the user intended.
This vulnerability leads to a complete inversion of the intended functionality:
Reasonable trades are skipped
Unfavorable trades are executed
As a result, this feature becomes entirely unusable, potentially leading to significant financial losses for users who expect their orders to be filled according to their specified price limits.
Manual Review.
Modify the price comparison logic as follows:
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.