You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA Medium severity issue.RewardA payout will be made for this issue
Wrong accounting in case of using stETH as RA due to 1-2 Wei loss per transfer.
Summary
Protocol intends to allow usage of stETH as a pegged asset or even as a redemption asset per the litepaper but doesn't consider edge case in it's transfer mechanism which would lead to discrepancy between the accounting balance and the actual token balance.
Vulnerability Detail
There is a known issue with stETH that the actual transferred amount can be 1-2 Wei less due to rounding in balance calculations.
This will cause issues in accounting of the current protocol if stETH used as a redemption asset(RA).
All the RA deposits into the PSM are kept in the locked variable and the amount assigned to this variable is taken directly from the amount that the user calls with. The actual amount transferred will be 1-2 Wei less due to above issue.
Therefore the locked variable will be assigned more amount than the actual contract balance which will lead to issues when redeeming or converting to free etc. Negative or positive rebasing of stETH will also influence contract balance which will lead to additional issue.
Impact
Potential dos due to the wrong assumption of holdings.
Balance checks before and after transfers can be done but it will complicate the flow. Therefore it is better to not use stETH as RA and instead use wstETH.
sherlock-admin3
changed the title
Virtual Tawny Newt - Wrong accounting in case of using stETH as RA due to 1-2 Wei loss per transfer.
Kirkeelee - Wrong accounting in case of using stETH as RA due to 1-2 Wei loss per transfer.
Sep 25, 2024
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA Medium severity issue.RewardA payout will be made for this issue
Kirkeelee
Medium
Wrong accounting in case of using stETH as RA due to 1-2 Wei loss per transfer.
Summary
Protocol intends to allow usage of stETH as a pegged asset or even as a redemption asset per the litepaper but doesn't consider edge case in it's transfer mechanism which would lead to discrepancy between the accounting balance and the actual token balance.
Vulnerability Detail
There is a known issue with stETH that the actual transferred amount can be 1-2 Wei less due to rounding in balance calculations.
This will cause issues in accounting of the current protocol if stETH used as a redemption asset(RA).
All the RA deposits into the PSM are kept in the
locked
variable and the amount assigned to this variable is taken directly from theamount
that the user calls with. The actual amount transferred will be 1-2 Wei less due to above issue.Therefore the
locked
variable will be assigned more amount than the actual contract balance which will lead to issues when redeeming or converting to free etc. Negative or positive rebasing of stETH will also influence contract balance which will lead to additional issue.Impact
Potential dos due to the wrong assumption of holdings.
Code Snippet
https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/RedemptionAssetManagerLib.sol#L32-L35
https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/PsmLib.sol#L84-L108
Tool used
Manual Review
Recommendation
Balance checks before and after transfers can be done but it will complicate the flow. Therefore it is better to not use stETH as RA and instead use wstETH.
Duplicate of #235
The text was updated successfully, but these errors were encountered: