Skip to content
Business logic Audit finding Intermediate

Too much fee charged when Seaport is partially filled

The fee calculation in SeaportProxy used the full order price rather than the actual amount filled, so when an order was partially filled the user was charged a fee on the entire price. An attacker could exploit this to pay a disproportionately high fee for a small purchase.

cccz Follow

Originally disclosed on Code4rena

Submitted by cccz

When a user fulfills an order using SeaportProxy, fees are charged in the \_handleFees function based on orders.price.

    function _handleFees(
        BasicOrder[] calldata orders,
        uint256 feeBp,
        address feeRecipient
    ) private {
        address lastOrderCurrency;
        uint256 fee;
        uint256 ordersLength = orders.length;

        for (uint256 i; i < ordersLength; ) {
            address currency = orders[i].currency;
            uint256 orderFee = (orders[i].price * feeBp) / 10000;

According to the Seaport documentation, Seaport allows partial fulfillment of orders, which results in too much fee being charged when an order is partially filled https://docs.opensea.io/v2.0/reference/seaport-overview#partial-fills

Consider feeBp == 2%

The order on Seaport has a fill status of 0/100 and each item is worth 1 eth. User A fulfills the order using LooksRareAggregator.execute and sends 102 ETH, where order.price == 100 ETH.

Since the other user fulfilled the order before User A, when User A fulfills the order, the order status is 99/100.

Eventually User A buys an item for 1 ETH but pays a fee of 2 ETH.

Proof of Concept

https://github.com/code-423n4/2022-11-looksrare/blob/e3b2c053f722b0ca2dce3a3eb06f64859b8b7a6f/contracts/proxies/SeaportProxy.sol#L136-L147

Recommended Mitigation Steps

Consider charging fees based on the user’s actual filled price.

0xhiroshi (LooksRare) confirmed and commented:

We are dropping fees completely.


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

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 fee was computed from the order's listed price instead of the actual amount filled.

Impact

Users could be charged a fee far larger than the value of the items they actually receive when an order is partially filled.

What the attacker needed

Seaport order is partially filled by another user; User fulfills the remaining portion via LooksRareAggregator

The fix

The project dropped fees completely, but the recommended fix was to charge fees based on the actual filled price.

How it was found

  1. User A submits an order through LooksRareAggregator.execute with a price of 100 ETH and a 2% fee.
  2. Before User A's transaction is processed, another user fulfills 99% of the same Seaport order.
  3. User A's transaction then fills only the remaining 1% (1 ETH worth), but the fee is still calculated on the full 100 ETH price, resulting in a 2 ETH fee.

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.

When you buy something through this system, a small fee is added based on the price. But if someone else already bought part of the order, you only get a fraction of the items, yet the fee is still calculated on the full original price. So you end up paying a fee for items you never received.

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 cccz

View all

104 more disclosed reports, best first.

More from LooksRare Aggregator contest

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.