ParaSpace contest - pashov's results

The First Ever Cross-Margin NFT Financialization Protocol.

General Information

Platform: Code4rena

Start Date: 28/11/2022

Pot Size: $192,500 USDC

Total HM: 33

Participants: 106

Period: 11 days

Judge: LSDan

Total Solo HM: 15

Id: 186

League: ETH

ParaSpace

Findings Distribution

Researcher Performance

Rank: 34/106

Findings: 4

Award: $764.31

QA:
grade-b

๐ŸŒŸ Selected for report: 0

๐Ÿš€ Solo Findings: 0

Awards

44.934 USDC - $44.93

Labels

bug
3 (High Risk)
satisfactory
duplicate-402

External Links

Lines of code

https://github.com/code-423n4/2022-11-paraspace/blob/6542d6e946762fc7a914a3f6f2e08fcbbf6c8a13/paraspace-core/contracts/misc/NFTFloorOracle.sol#L167

Vulnerability details

Proof of Concept

THe removeFeeder method is lacking onlyRole(*DEFAULT_ADMIN_ROLE*) modifier, even though the NatSpec states โ€œAllows owner to remove feederโ€. Due to this, now everyone can remove a feeder anytime. Different types of attack can be executed, one of which is the following:

  1. Some price changes and now a feeder tries to call setPrice
  2. A malicious user does not like the price change reported, so he front-runs that transaction with removeFeeder transaction
  3. The price update fails, so now price is stale
  4. Repeat as many times as needed

Severity

The likelihood of this happening is high because attacks on missing access control are very easy to execute. The impact is also high because an attacker can force the protocol to operate with a stale price or even to not have any price updaters apart from the owner of the protocol. Since both likelihood and impact are high this should be a High severity vulnerability.

Recommendation

Add onlyRole(DEFAULT_ADMIN_ROLE) modifier to the removeFeeder method

#0 - JeffCX

2022-12-18T03:48:08Z

Valid finding.

#1 - JeffCX

2022-12-18T04:05:13Z

Duplicate of https://github.com/code-423n4/2022-11-paraspace-findings/issues/149 since it has sponsor confirmed tag

#3 - c4-judge

2022-12-20T16:59:19Z

dmvt marked the issue as duplicate of #31

#4 - c4-judge

2023-01-23T15:59:49Z

dmvt marked the issue as satisfactory

Findings Information

๐ŸŒŸ Selected for report: Trust

Also found by: pashov

Labels

bug
2 (Med Risk)
partial-50
duplicate-490

Awards

609.8302 USDC - $609.83

External Links

Lines of code

https://github.com/code-423n4/2022-11-paraspace/blob/6542d6e946762fc7a914a3f6f2e08fcbbf6c8a13/paraspace-core/contracts/misc/NFTFloorOracle.sol#L236

Vulnerability details

Proof of Concept

Currently the NFTFloorOracle allows for an asset to be paused and the setPrice functionality has whenNotPaused(_asset) modifier. This modifier is missing in the getPrice functionality, so even if an asset was paused any contract calling getPrice will get the stale price successfully.

Severity

The impact of this issue is High because protocol will be running with a stale price, but the likelihood is Medium because it needs an asset to be paused. This results in Medium severity.

Recommendation

Add whenNotPaused(_asset) modifier to getPrice

#0 - JeffCX

2022-12-18T03:46:22Z

The code checks the expirationPeriod for price though.

require(
    (block.number - updatedAt) <= config.expirationPeriod,
    "NFTOracle: asset price expired"
);

https://github.com/code-423n4/2022-11-paraspace/blob/6542d6e946762fc7a914a3f6f2e08fcbbf6c8a13/paraspace-core/contracts/misc/NFTFloorOracle.sol#L236

#1 - c4-judge

2022-12-20T17:41:55Z

dmvt marked the issue as duplicate of #490

#2 - c4-judge

2023-01-23T20:51:43Z

dmvt marked the issue as partial-50

Lines of code

https://github.com/code-423n4/2022-11-paraspace/blob/6542d6e946762fc7a914a3f6f2e08fcbbf6c8a13/paraspace-core/contracts/misc/NFTFloorOracle.sol#L158

Vulnerability details

Proof of Concept

The addFeeder functionality in NFTFloorOracle pushes an address to the feeders array. Since a check for a maximum array size is missing, if too many feeders are added this can result in impossibility for a price update, since the setPrice functionality calls _combine which iterates over the feeders array. If the array is too big this iteration might cost too much, or even more than the max block gas limit, so price will be stale, until an admin calls removeFeeder which can take some time, plus if the attacker wants it to take more time he can do block stuffing attack on the remove transaction as well.

Severity

The impact of this issue is High because protocol will be running with a stale price, but the likelihood is low since it requires the owner to be compromised/malicious or to not be careful with adding too many feeders. This results in Medium severity.

Recommendation

Add a max array size and check if there are max number of feeders already when calling addFeeder

#0 - JeffCX

2022-12-18T03:52:34Z

Unlikely to happen but yes, there is no upper bound for the feed array.

#2 - c4-judge

2023-01-09T22:46:27Z

dmvt changed the severity to QA (Quality Assurance)

#3 - c4-judge

2023-01-25T16:45:51Z

dmvt marked the issue as grade-b

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