ParaSpace contest - R2'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: 44/106

Findings: 1

Award: $266.74

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: ladboy233

Also found by: Kong, Lambda, R2, __141345__, mahdikarimi

Labels

bug
2 (Med Risk)
satisfactory
duplicate-242

Awards

266.7397 USDC - $266.74

External Links

Lines of code

https://github.com/code-423n4/2022-11-paraspace/blob/c6820a279c64a299a783955749fdc977de8f0449/paraspace-core/contracts/misc/ParaSpaceOracle.sol#L131 https://github.com/code-423n4/2022-11-paraspace/blob/c6820a279c64a299a783955749fdc977de8f0449/paraspace-core/contracts/misc/ParaSpaceFallbackOracle.sol#L49

Vulnerability details

Impact

In ParaSpaceOracle.getAssetPrice() there are some cases when you use _fallbackOracle to calculate the asset price. But in ParaSpaceFallbackOracle you calculate instant UniswapV2 pool price depends on pool reserves. This price may be manipulated in the transaction using flash loans.

And you use ParaSpaceOracle.getAssetPrice() in many crucial protocol parts like a liquidation validation or borrowing validation

So malicious user can manipulate asset price and

  • borrow more tokens than should be allowed
  • liquidate users, manipulating there assets prices

Proof of Concept

Let's describe how malicious user can borrow more tokens than it should be by manipulating asset price Let's imagine for DAI you don't have assetsSources[DAI] and use fallback oracle

  1. Alice has HF 1.1 (she use WETH as collateral and borrowed DAI)
  2. Bob has contract with the next function:
function attack() external { GetFlashLoan(WETH) - lets imagine now 1 WETH == 1000 DAI ExchangeWETHToDAIUniswap() - now DAI price will increase, lets imagine to 1 WETH == 2000 DAI LiquidateAlice() - now Alice's HF becomes below 1, so Bob can liquidate Alice and many other users RepayFlashLoan() - repay using liquidation rewards }

It may be done even without flash loans - in separate transactions (risky for attacker)

Tools Used

vs code

Use Uniswap TWAP prices - they are less susceptible to manipulation

#0 - c4-judge

2022-12-20T17:52:28Z

dmvt marked the issue as duplicate of #50

#1 - c4-judge

2023-01-23T16:15:08Z

dmvt marked the issue as satisfactory

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