Infinity NFT Marketplace contest - csanuragjain's results

The world's most advanced NFT marketplace.

General Information

Platform: Code4rena

Start Date: 14/06/2022

Pot Size: $50,000 USDC

Total HM: 19

Participants: 99

Period: 5 days

Judge: HardlyDifficult

Total Solo HM: 4

Id: 136

League: ETH

Infinity NFT Marketplace

Findings Distribution

Researcher Performance

Rank: 9/99

Findings: 4

Award: $1,303.59

🌟 Selected for report: 1

πŸš€ Solo Findings: 0

Findings Information

🌟 Selected for report: KIntern

Also found by: GimelSec, csanuragjain, kenzo, unforgiven

Labels

bug
duplicate
3 (High Risk)
sponsor confirmed

Awards

607.7909 USDC - $607.79

External Links

Lines of code

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/core/InfinityOrderBookComplication.sol#L205

Vulnerability details

Impact

sell.constraint[0], representing the max number of nft items, can be simply bypassed due to a missing condition. Hence order will process more nft than max limit and hence would cause loss to seller whose nft would be traded without his permission

Proof of Concept

  1. Assuming below parameters:
sell has set constraint[0] as 2 (max number of item allowed) buy has set constraint[0] as 1 (min number of item allowed)
  1. Now canExecMatchOrder is called to check Order validity with constructedNFTs as {A,B,C}

  2. areNumItemsValid function is called which makes below check:

return numConstructedItems >= buy.constraints[0] && buy.constraints[0] <= sell.constraints[0];
  1. This will return true since 3>=1 && 1<=2

  2. But this is incorrect since this order is simply bypassing the sell order max nft constraint which was 2. With this order processed, all 3 nfts will be processed even though only 2 should have been allowed

Add a condition to verify that constructed nft items are not larger than sell constraints

return numConstructedItems >= buy.constraints[0] && buy.constraints[0] <= sell.constraints[0] && numConstructedItems<= sell.constraints[0];

#4 - HardlyDifficult

2022-07-10T15:15:19Z

Findings Information

Labels

bug
duplicate
2 (Med Risk)
disagree with severity
sponsor acknowledged

Awards

21.1924 USDC - $21.19

External Links

Lines of code

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/core/InfinityExchange.sol#L1266

Vulnerability details

Impact

There is no max cap on the fees in setProtocolFee function. Admin can have fees as 100_00 which is 100%. Now _transferFees function will make sure that seller gets nothing as remainingAmount becomes 0 and contract will get the whole amount.

Proof of Concept

  1. Owner calls setProtocolFee and set _protocolFeeBps as 100_00 which is 100%

  2. Now whenever NFT are transferred, _transferFees is called

  3. This calculates the fees over the amount. Since fees is 100% so contract receives full amount and seller receives 0 amount

Set a max fee cap on PROTOCOL_FEE_BPS so that only reasonable fees is deducted

function setProtocolFee(uint16 _protocolFeeBps) external onlyOwner { require(_protocolFeeBps<=MAX_FEES, "Exceeded max fees"); PROTOCOL_FEE_BPS = _protocolFeeBps; emit NewProtocolFee(_protocolFeeBps); }

#0 - nneverlander

2022-06-23T11:24:38Z

Duplicate

#1 - HardlyDifficult

2022-07-11T00:04:39Z

Findings Information

🌟 Selected for report: csanuragjain

Also found by: KIntern

Labels

bug
2 (Med Risk)
sponsor confirmed

Awards

625.2993 USDC - $625.30

External Links

Lines of code

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/core/InfinityOrderBookComplication.sol#L140

Vulnerability details

Impact

canExecMatchOrder is having an incorrect check which makes a valid order as invalid. doItemsIntersect function is also checked on sell.nfts, buy.nfts which is incorrect. doItemsIntersect should only be checked in reference to constructedNfts

Proof of Concept

  1. Assume buy has nfts {A,B,C}, sell has nft {A,B}, constructedNfts has nft {A}, buy.constraints[0]/sell.constraints[0]/numConstructedItems is 1

  2. Ideally this order should match since constructedNfts {A} is present in both buy and sell

  3. But this will not match since doItemsIntersect(sell.nfts, buy.nfts) will fail because of item C which is not present in sell

Remove doItemsIntersect(sell.nfts, buy.nfts) from InfinityOrderBookComplication.sol#L140

#1 - HardlyDifficult

2022-07-10T22:41:19Z

Some orders that should be matched would revert. Lowering this to Medium risk.

Lines of code

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/staking/InfinityStaker.sol#L364

Vulnerability details

Impact

In updatePenalties function, THREE_MONTH_PENALTY/SIX_MONTH_PENALTY/TWELVE_MONTH_PENALTY are not having any upper bound, nor any lower bound

  1. Admin can set it to really high value which will force user to remain staked and never use rage quit.
  2. Admin can disallow rageQuit by setting THREE_MONTH_PENALTY, SIX_MONTH_PENALTY, TWELVE_MONTH_PENALTY to 0

Proof of Concept

  1. Admin uses updatePenalties to set THREE_MONTH_PENALTY, SIX_MONTH_PENALTY, TWELVE_MONTH_PENALTY to 0

  2. Now rage quit always fail since denominator becomes 0 at InfinityStaker.sol#L195 while calculating totalToUser in getRageQuitAmounts

  3. This forces users to remain staked and would not be able to leave the contract

  4. Same can also be done if owner sets insane high penalty forcing user to stay in system

Add below check

require(threeMonthPenalty<=ThreeMonthPenaltyMAX && sixMonthPenalty<=SixMonthPenaltyMAX && twelveMonthPenalty<=TwelveMonthPenaltyMAX); require(threeMonthPenalty!=0 && sixMonthPenalty!=0 && twelveMonthPenalty!=0);

#0 - nneverlander

2022-06-22T13:20:01Z

Duplicate

#1 - HardlyDifficult

2022-07-10T22:16:03Z

Lowering risk since this is an admin function and they could update again if the value was set in error. Converting into a QA report for the warden.

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax Β© 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter