code-423n4 / 2022-06-infinity-findings

4 stars 0 forks source link

NO TIMELOCK ON `setProtocolFee()` CAN LEAD TO SELLERS LOSING THEIR NFTs #302

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Lines of code

https://github.com/code-423n4/2022-06-infinity/blob/765376fa238bbccd8b1e2e12897c91098c7e5ac6/contracts/core/InfinityExchange.sol#L1267 https://github.com/code-423n4/2022-06-infinity/blob/765376fa238bbccd8b1e2e12897c91098c7e5ac6/contracts/core/InfinityExchange.sol#L725-L726 https://github.com/code-423n4/2022-06-infinity/blob/765376fa238bbccd8b1e2e12897c91098c7e5ac6/contracts/core/InfinityExchange.sol#L729

Vulnerability details

NO TIMELOCK ON setProtocolFee() CAN LEAD TO SELLERS LOSING THEIR NFTs

In InfinityExchange.sol, there is no timelock on setProtocolFee(). This is the fee that is applied in orders, and determines how much the Exchange receives in fee VS how much the seller receives. But:

Users will be incited to use the exchange if the fee is low (PROTOCOL_FEE_BPS is initially 2.5%). A malicious owner could effectively wait for enough activity to happen in the exchange, then set a very high fee, which would result in all further orders going through the exchange transferring the sales revenue from the buyers to the Exchange, resulting in the sellers effectively losing their NFTs.

Impact

Medium

Proof Of Concept

The malicious owner calls setProtocolFee(10000), setting PROTOCOL_FEE_BPS as 100%.

Tools Used

Manual Analysis

Recommended Mitigation Steps

Two things can be done:

nneverlander commented 2 years ago

Duplicate

HardlyDifficult commented 2 years ago

Dupe https://github.com/code-423n4/2022-06-infinity-findings/issues/259