Open code423n4 opened 1 year ago
0xSorryNotSorry marked the issue as high quality report
0xSorryNotSorry marked the issue as primary issue
toshiSat marked the issue as disagree with severity
toshiSat marked the issue as sponsor confirmed
Only going to be implementing #1
toshiSat marked the issue as sponsor acknowledged
Picodes changed the severity to 2 (Med Risk)
Picodes marked the issue as satisfactory
Picodes marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2023-03-asymmetry/blob/44b5cd94ebedc187a08884a7f685e950e987261c/contracts/SafEth/SafEth.sol#L63 https://github.com/code-423n4/2023-03-asymmetry/blob/44b5cd94ebedc187a08884a7f685e950e987261c/contracts/SafEth/derivatives/WstEth.sol#L73-L81 https://github.com/code-423n4/2023-03-asymmetry/blob/44b5cd94ebedc187a08884a7f685e950e987261c/contracts/SafEth/derivatives/Reth.sol#L156-L204 https://github.com/code-423n4/2023-03-asymmetry/blob/44b5cd94ebedc187a08884a7f685e950e987261c/contracts/SafEth/derivatives/Reth.sol#L170 https://github.com/code-423n4/2023-03-asymmetry/blob/44b5cd94ebedc187a08884a7f685e950e987261c/contracts/SafEth/derivatives/Reth.sol#L120-L150
Vulnerability details
Impact
The users will not be able to stake their funds and there will be loss of reputation
Proof of Concept
The
SafEth
contract'sstake()
function is the main entry point to add liquid Eth to the derivatives. Accordingly thestake()
function takes the users' ETH and convert it into various derivatives based on their weights and mint an amount of safETH that represents a percentage of the total assets in the system.The execution to deposit to the available derivative is done through iterating the derivatives mapping in
SafEthStorage
contract.And for all the derivatives the stake function calls the derivative contract's
deposit()
function. Below is forWstEth
contract'sdeposit()
function to adapt to Lido staking;The Lido protocol implements a daily staking limit both for
stETH
andWstETH
as per their docs Accordingly the daily rate is 150000 ETH and thedeposit()
function will revert if the limit is hit. From the docs:However this check was not done either in
SafEth::stake()
orWstEth::deposit()
functions. So if the function reverts, the stake function will all revert and it will not be possible to deposit to the other derivatives as well.Another issue lies in the Reth contract having the same root cause below - Missing Validation & external tx dependency.
For all the derivatives the stake function calls the derivative contract's
deposit()
function. Below isrETH
contract'sdeposit()
function;At Line#170 it checks the pools availability to deposit with
poolCanDeposit(msg.value)
;PoolCanDeposit
function below;However, as per Rocket Pool's
RocketDepositPool
contract, there is an other check to confirm the availability of the intended deposit;The
Reth::deposit()
function doesn't check this requirement whether the deposits are disabled. As a result, theSafEth::stake()
function will all revert and it will not be possible to deposit to the other derivatives as well.Tools Used
Manual Review
Recommended Mitigation Steps
getCurrentStakeLimit() >= amountToStake
stake()
function's iteration insidetry/catch
block to make the transaction success until it reverts.