-
Notifications
You must be signed in to change notification settings - Fork 7
merlin - DOS vulnerability in the _stake function in RsETHAdapter.sol #54
Comments
I don't think this meet DoS requirements. |
For Dos issue to be H/M: Here user needs to deposit +1 wei. issue is valid Low/Informational. |
Escalate I think this should be valid. This has the same impact as #75, the stake function will revert. |
You've created a valid escalation! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
The protocol team fixed this issue in the following PRs/commits: |
I disagree with the escalation. It doesn't have the same impact as #75.
Issue is valid Low/Informational. |
@z3s, you mention that stakeLimit could equal 0, leading to the _stake function failing, whereas when stakeLimit = minAmountToDeposit, this occurrence is highly unlikely. Essentially, you're indicating that the current stake limit in RSETH_DEPOSIT_POOL = 0 carries a medium severity, but when the current stake limit in RSETH_DEPOSIT_POOL = 0.0001 ETH is highly unlikely. There's inconsistency in your logic, as both scenario can occur. |
After inspecting more, I think #75 could be low, too. |
There are two things I don't know about the judging rules.
|
I would like to clarify that in uint256 stakeAmount; // can be 0
unchecked {
stakeAmount = availableEth + queueEthCache - targetBufferEth; // non-zero, no underflow
}
// If the calculated stake amount exceeds the available ETH, simply assign the available ETH to the stake amount.
// Possible scenarios:
// - Target buffer percentage was changed to a lower value and there is a large withdrawal request pending.
// - There is a pending withdrawal request and the available ETH are not left in the buffer.
// - There is no pending withdrawal request and the available ETH are not left in the buffer.
if (stakeAmount > availableEth) {
// Note: Admins should be aware of this situation and take action to refill the buffer.
// - Pause staking to prevent further staking until the buffer is refilled
// - Update stake limit to a lower value
// - Increase the target buffer percentage
stakeAmount = availableEth; // All available ETH
}
// If the amount of ETH to stake exceeds the current stake limit, cap the stake amount.
// This is to prevent the buffer from being completely drained. This is not a complete solution.
uint256 currentStakeLimit = StakeLimitUtils.calculateCurrentStakeLimit(data); // can be 0 if the stake limit is exhausted
if (stakeAmount > currentStakeLimit) {
stakeAmount = currentStakeLimit;
} Therefore, if a user stakes an amount greater than In the previous audit, an issue #105 was accepted where if In the current audit, an issue #64 was accepted, where if Currently, the situation where
|
It's not the same as #75 but the end result will be the same, _stake will do the revert. However, in the case of 75, since the limit is zero, there should be no revert and return a zero. In my opinion there is an obvious problem with the core function of the protocol. |
I believe this report and #75 are not the same. #75 is about not being able to stake when the stake limit is 0, which is not expected and intended. This report is about not being able to stake when stake limit == minimum to stake. The question is in the report the watson shows the deposit function from LRTDepositPool contract, where you can deposit if deposit amount == minimum deposit. Firstly, I don't see it in the in-scope contracts and can't find it in the contest repo at all. Can someone forward me to it? And the second question, is it the main assumption that you should be able to stake when stake amount == stake limit == minimum to stake because you're able to deposit when deposit amount == deposit limit? Or there are other reasons for it as well? |
For the first question, "the check for minAmountToDeposit in the LRTDepositPool smart contract:" mentioned above can be found here. |
|
After additional discussion with the sponsor, indeed the Planning to accept the escalation and validate the issue with medium severity. The duplicates are the following: #59 and #82 |
These don't look like duplicates. |
only #74 and #46 mentioned |
The Lead Senior Watson signed off on the fix. |
Thank you for pointing it out and indeed, #74 and #46 are slightly different and correctly identify a case when the there shouldn't be revert at any value, even if it's smaller than the minimum to deposit. And I believe these two has to be be valid medium severity. Regarding #54 and duplicates. They correctly identify the correct scenario that the staking shouldn't revert when stake amount == minimum amount to deposit. It's a very hard and borderline case. Both find the way how staking will revert due to incorrect checks and the problem is in the same line with #74. The problem is in different conditions. The fix of #74 will also fixes this issue, but not vice versa. So here's my analysis and decision: There's a core vulnerability -> the staking reverts when the staking amount <= minimum to deposit, which shouldn't happen and users should be able to stake any amount at any time. The first group (#74 and #46) correctly identify that there shouln't be a revert at any value. The second group (this and dups) correctly identify the case when it reverts at staking amount == minimum to deposit, which shouldn't happen. On the one hand, they both identified the core vulnerability that
I believe the fair outcome the first one, cause #54 and its duplicates correctly identify the case that the code shouldn't revert when stake amount == minimum deposit, when #74 and #46 take it further and identify that it shouldn't revert when staking amount is both < and == to minimum deposit. I believe that #54 and its duplicates are sufficient enough to say that they identify the vulnerability, yet the fix is incorrect. Hope for your understanding. Planning to accept the escalation, make a new medium issue family with #46 as main and #74, #54, #59 and #82 as duplicates. |
Result: |
Escalations have been resolved successfully! Escalation status:
|
merlin
medium
DOS vulnerability in the _stake function in RsETHAdapter.sol
Summary
There is a scenario where a user tries to deposit the minimum amount of ETH, which is accepted by
LRTDepositPool
, but the transaction simply fails.Vulnerability Detail
LRTDepositPool
has aminAmountToDeposit
= 0.0001 ETH.It's also important to pay attention to the check for
minAmountToDeposit
in theLRTDepositPool
smart contract:So, if
depositAmount < minAmountToDeposit
, the transaction will fail, but inRsETHAdapter
, there is an incorrect check that will not allow depositing theminAmountToDeposit
value:I want to consider two cases:
1)If the user's
stakeAmount
is equal tominAmountToDeposit
, the transaction will fail, although it should not. If the user specifiesstakeAmount > minAmountToDeposit
, the transaction will be successfully executed.2)If
stakeAmount > stakeLimit and stakeLimit = minAmountToDeposit
, thenstakeAmount
will be set tominAmountToDeposit
. This situation will prevent the user from making a deposit, and it can only be fixed by correcting the code:Impact
The user is unable to deposit the minimum amount of ETH that
LRTDepositPool
accepts.Code Snippet
src/adapters/kelp/RsETHAdapter.sol#L77
Tool used
Manual Review
Recommendation
Consider modifying the check for
minAmountToDeposit
:Duplicate of #46
The text was updated successfully, but these errors were encountered: