Skip to content
Business logic Audit finding Intermediate

Used orders or revoked token authorizations can cause `withdrawAuction` and `depositAuction` to fail

A market maker could invalidate their own order by marking its nonce as used or by revoking token approvals before the owner submits an auction, which makes the whole auction transaction revert. This lets a malicious participant repeatedly grief the auction process so that withdrawals and deposits fail.

indijanc Follow with Haruxe, seyni and 3 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-11-opyn-judging/issues/60

Found by

indijanc, Haruxe, seyni, zimu, Jeiwan, thec00n

Summary

The owner must ensure that all orders are valid before submitting an auction, as a single order failure can revert an entire auction. The current implementation allows a market maker to invalidate their order by front-running an auction transaction, causing the auction to fail. Other ways to cause the auction functions to fail are listed below.

Vulnerability Detail

A market maker can invalidate their order when withdrawAuction() and depositAuction() is submitted from the owner by:

  • setting the nonce of their order as used by calling setNonceTrue() or by calling checkOrder() and setting the nonce of orders as used (see https://github.com/sherlock-audit/2022-11-opyn-thec00n/issues/1).
  • By revoking permissions to transfer tokens for the CrabNetting contract or transferring required tokens from the trading account so that the transfer fails.

Large user withdrawals could also occur right before the auction is submitted which could could cause the auction functions to fail.

Impact

A malicious market maker or user could perform a griefing attack and repeatedly cause auctions to fail.

Code Snippet

https://github.com/sherlock-audit/2022-11-opyn/blob/main/crab-netting/src/CrabNetting.sol#L756-L759

https://github.com/sherlock-audit/2022-11-opyn/blob/main/crab-netting/src/CrabNetting.sol#L507-L524

https://github.com/sherlock-audit/2022-11-opyn/blob/main/crab-netting/src/CrabNetting.sol#L645-L656

Tool used

Manual Review

Recommendation

  • The function _useNonce() should not fail when the nonce has been used. Instead, return a flag with the status of the nonce update. Orders that already have used nonces should be skipped from processing in withdrawAuction() and depositAuction().
  • The auction functions should check if the market maker has sufficient balance and if the CrabNetting contract is authorized to successfully perform the transfer from a related order. Insufficient permissions or funds from users that sign orders should also be skipped.
  • Require that auction isAuctionLive is set to true for withdrawAuction() and depositAuction() so withdrawals can not occur during auctions.

Discussion

sanandnarayan

So , before calling the auction function we actually check if the market makers have adequate approval and balance. if a market maker cancels approval or reduces balance or cancels nonce. Then we remove that order and resubmit the auction

sanandnarayan

So , before calling the auction function we actually check if the market makers have adequate approval and balance. if a market maker cancels approval or reduces balance or cancels nonce. Then we remove that order and resubmit the auction transaction

thec00n

Yes but it might lead to failed transactions. It's better to check anything that could fail onchain and then skip the order if it's not valid.

I also think that this issue should be medium not high.

sanandnarayan

Agree regarding the technicality. Practically, market makers / auction participants don't grieve , so we are okay with current implementation. I acknowledge the issue

The original report as published on Sherlock, by indijanc. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the auction functions process every order without first checking that each order is still valid, so one bad order reverts the entire batch.

What the attacker needed

A market maker account with a signed order; ability to front-run the auction transaction

The fix

The auction functions should skip orders whose nonce is already used or whose balance or approval is insufficient, and should require the auction to be live before withdrawals can occur.

How it was found

  1. A market maker signs an order that will be included in an upcoming auction.
  2. Before the owner submits the auction, the market maker marks the order's nonce as used.
  3. The owner submits the auction transaction.
  4. The auction function processes the now-invalid order and reverts.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

An auction here bundles several orders from market makers into one transaction. If any single order is no longer valid, the whole transaction fails and nothing happens. A market maker can deliberately make their order invalid at the last moment, so the auction keeps failing and other users cannot complete their withdrawals or deposits.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by indijanc

View all

3 more disclosed reports, best first.

More from Opyn Crab Netting

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.