29099 - [SC - Insight] Actual amount of stETH deposited is less than t...
Last updated
Was this helpful?
Last updated
Was this helpful?
Submitted on Mar 7th 2024 at 02:56:41 UTC by @kaysoft for
Report ID: #29099
Report type: Smart Contract
Report severity: Insight
Target: https://etherscan.io/address/0x7276925e42f9c4054afa2fad80fa79520c453d6a
Impacts:
Contract fails to deliver promised returns, but doesn't lose value
Due to stETH's the actual amount transfered from user is when the depositStETH()
function is less than the specified amount in the parameter.
In the function below, permitData.amount
of stETH
is transfered from the msg.sender
to the the PufferDepositor
contract. The issue is that the actual amount transferred from msg.sender to the contract is less than the specified permitData.amount
.
The reason for this is described in
For example is you specify permitData.amount
as 1000000000000000000001
the actual amount that will be pulled from the user is 1000000000000000000000
.
This leaves 1 wei of stETH that is not pulled from msg.sender.
Why this is an issue is that there are 2 transfers:
First from msg.sender to the PufferDepositor
contract
And secondly from the PufferDepositor
to the PufferVault contract.
The same thing can actually happen at any transfer or deposit transaction. >In the future, when the stETH/share rate will be greater, the error can >become a bit bigger.
Possible Denial of service due to transfer amount difference.
https://docs.lido.fi/guides/lido-tokens-integration-guide/#1-2-wei-corner-case
Create a file in the test/integration
directory and name is POC.t.sol
Copy and paste the code below to the new file: POC.t.sol
.
Run forge test --match-path test/Integration/POC.t.sol -vvv
The test should fail with some logs
of amounts
This fails because depositAmount
is not equal to actualAmount
.
1 wei of stETH difference may seem small but the further stated that:
Short Term: Consider using the transferShares()
function to transfer stETH as recommended by
Long Term: Instead of stEth
, consider integration the non-rebasable value-accruing counterpart wstETH
as recommeded by the