Depositor could be subjected to an inflated valuation of RSETH #666
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-42
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
upgraded by judge
Original issue severity upgraded from QA/Gas by judge
Lines of code
https://github.com/PFAhard/2023-11-kelp/blob/670aa2b7748d5a3969881758bd36155d1ce4c4e7/src/LRTDepositPool.sol#L119
Vulnerability details
Impact
Depositors could be subjected to a price manipulation of the RSETH tokens if a malicious actor
donates a large sum of the approved assets (rETH,cbETH or stETH) either to the deposit pool or the node delegator contracts.
Proof of Concept
In Kelp protocol, users are allowed to deposit approved LST tokens to receive an amount of
rseth
tokens. The amount ofrsETH
tokens to be minted is inversely proportional to how the oracle contract values its price as shown below.If the denominator could be artificially inflated by a malicious actor, the depositor would receive a smaller amount of
rseth
tokens.To confirm this please consider the following test labeled
PriceManpulation.t.sol
. Place this test file in thetest
folder.In the
setUp
function we first deploy and configure all the contracts.Following which we test the hypothesis where Alice receives significantly less
rsETH
tokens on her second attempt of depositing assets (reth) into the deposit pool.Upon Alice's first deposit transaction, initial supply of
rsETH
is zero, hence the oracle contract returns1 ether
as the price, and she receives the correct amount of mintedrseth
tokens.Meanwhile, Bob's an attacker who donates assets to the node delegator contract in order to artificially inflate the price of the
rsETH
tokens.In this case, when Alice attempts to deposit the same number of
reth
tokens in the deposit pool, she consequently receives significantly lessrsETH
tokens.Tools Used
Foundry
Manual Analysis
Recommended Mitigation Steps
To avoid the case where a price manipulation could be possible, instead of checking the asset balance of the contract, please consider using state variables, which are only updated in response to a deposit. And using the state variables to confirm the price of the
rsETH
token.This would prevent such an attack, as any donation of funds by attackers would have no impact on the minted amount of
rsETH
tokens.Assessed type
Oracle
The text was updated successfully, but these errors were encountered: