Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inappropriate Fee Charge #169

Open
code423n4 opened this issue Nov 13, 2022 · 4 comments
Open

Inappropriate Fee Charge #169

code423n4 opened this issue Nov 13, 2022 · 4 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue grade-b Q-29 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-11-looksrare/tree/e3b2c053f722b0ca2dce3a3eb06f64859b8b7a6f/contracts/proxies/SeaportProxy.sol#L199-L217

Vulnerability details

Impact

The fulfillAdvancedOrder may return false on an order not successfully fulfilled. The try/catch only skip current order when it reverts on fail, while still charge fee on user when it returns false.

Proof of Concept

https://github.com/code-423n4/2022-11-looksrare/tree/e3b2c053f722b0ca2dce3a3eb06f64859b8b7a6f/contracts/proxies/SeaportProxy.sol#L199-L217

try
    marketplace.fulfillAdvancedOrder{value: currency == address(0) ? price : 0}(
        advancedOrder,
        new CriteriaResolver[](0),
        bytes32(0),
        recipient
    )
  {
    if (feeRecipient != address(0)) {
        uint256 orderFee = (price * feeBp) / 10000;
        if (currency == lastOrderCurrency) {
            fee += orderFee;
        } else {
            if (fee > 0) _transferFee(fee, lastOrderCurrency, feeRecipient);
  
            lastOrderCurrency = currency;
            fee = orderFee;
        }
    }
  } catch {}

when marketplace.fulfillAdvancedOrder return false (but not reverted), the code in the try clause will execute, and charge the fee on the user. However, it is inappropriate to charge a fee on a not fulfilled order.

Tools Used

Recommendation

also check return value on marketplace.fulfillAdvancedOrder

try
    marketplace.fulfillAdvancedOrder{value: currency == address(0) ? price : 0}(
        advancedOrder,
        new CriteriaResolver[](0),
        bytes32(0),
        recipient
    ) returns (bool fulfilled)
  {
    if (fulfilled && feeRecipient != address(0)) {
        uint256 orderFee = (price * feeBp) / 10000;
        if (currency == lastOrderCurrency) {
            fee += orderFee;
        } else {
            if (fee > 0) _transferFee(fee, lastOrderCurrency, feeRecipient);
  
            lastOrderCurrency = currency;
            fee = orderFee;
        }
    }
  } catch {}
@code423n4 code423n4 added 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 labels Nov 13, 2022
code423n4 added a commit that referenced this issue Nov 13, 2022
@c4-judge
Copy link
Contributor

Picodes marked the issue as duplicate of #93

@c4-judge
Copy link
Contributor

Picodes marked the issue as not a duplicate

@c4-judge c4-judge reopened this Dec 11, 2022
@c4-judge c4-judge added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax downgraded by judge Judge downgraded the risk level of this issue and removed duplicate-93 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Dec 11, 2022
@c4-judge
Copy link
Contributor

Picodes changed the severity to QA (Quality Assurance)

@c4-judge
Copy link
Contributor

Picodes marked the issue as grade-b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue grade-b Q-29 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

3 participants