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
Rank: 44/106
Findings: 1
Award: $266.74
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: ladboy233
Also found by: Kong, Lambda, R2, __141345__, mahdikarimi
266.7397 USDC - $266.74
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
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
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
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)
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