29344 - [SC - Insight] Price assets deposited manipulation
Submitted on Mar 14th 2024 at 13:49:09 UTC by @Lastc0de for Boost | ZeroLend
Report ID: #29344
Report type: Smart Contract
Report severity: Insight
Target: https://explorer.zksync.io/address/0x785765De3E9ac3D8eEb42B4724A7FEA8990142B8
Impacts:
Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Description
Brief/Intro
NOTE: This vulnerability was discovered in the last hour and forgive me if there is a problem typing words as I was typing and reporting quickly before the time expired
Zero Land is a fork of AAVE, so its calculations are exactly similar to AAVE calculations.
Based on this: when the user wants to borrow, he/she must first make a deposit, then based on the price that the user has deposited, the user can borrow other assets.
The value of assets that the user has deposited is taken from AaveOracle.sol
and AaveOracle
returns the value based on the feed specified by the owner of the protocol, but in your protocol the value can be manipulated and it can be said that all the funds in your protocol can be stolen by this method.
In your protocol, to calculate the number of assets active in your protocol, different Pairs
pools are used to calculate the value of those assets
For this reason, your protocol is vulnerable to price manipulation
, because price manipulation is very common and simple in Pairs
(Ex: Uniswap), and since in your protocol, the most important tasks, such as charging, are calculated based on the value of an asset, this can cause the theft of funds. be you
Vulnerability Details
For Ex: One of assets in your protocol is SWORD
:
https://explorer.zksync.io/address/0xDB87A5493e308Ee0DEb24C822a559bee52460AFC
AaveOracle.sol
wants to get the price of this, it uses the following feed:
https://explorer.zksync.io/address/0x65B28bAfDB15DD3Cb47a568FBa27fABb5b7d99d4#contract
This contract uses _getPrice()
function to get the price:
This function returns tokenPrice
by calling the getAmountOut()
function in the eZKalibur pool
address
eZKalibur is fork from Uniswap v2.
Here the vulnerability appears in the your Oracle, it is easy to manipulate the return value of the _getPrice()
function by minting and burning the LP token in pair, as a result, considering that your feed uses a pair and uses the return value as the assets value A attacker can easily manipulate
the return value of _getPrice()
and increase the amount of assets and borrow more assets and steal the funds in your protocol.
Impact Details
Attacker, can first depasite a vulnerable token then increase its price using its pair thereby borrowing a token more than the value of something it has already deposited
References
Proof of Concept
NOTE : PoC only theoretically wrote that due to lack of time, vulnerability was discovered in the final hours.
1-Attacker Deposit SWORD in your protocol
2-Attacker increases the value of his asset by manipulating its Pair
3-Attacker, can borrow but more than the value of his property
4-Attacker,return back assets in Pair by burn LP Tokens
Last updated