We can see that the balance.unsettledAmount is missing in the calculations. The balance.unsettledAmount represents the fees earned by the pool, but the assets have not yet been transferred.
Impact
The higher-level function calls to getMaxWithdraw and isSubAmountAllowed should return true, but they return false instead, preventing the function from continuing to execute correctly.
Escalate
This issue should be high.
There is a calculation error inside the UsdPool::isSubAmountAllowed() function.
UsdPool::isSubAmountAllowed() is called by UsdPool::subStableToken()
The functions ClaimRewardsProcess.claimRewards(), LpPoolProcess.updatePnlAndUnHoldPoolAmount() (called by decreasePosition), and RedeemProcess._redeemStakeUsd() internally call UsdPool::subStableToken(), then will revert, which causes users to be unable to claim rewards, reduce positions, and redeem StakeUsd. Additionally, if no new funds are added by other users, the impact could last for over a week.
According to Sherlock’s rules, “The issue causes locking of funds for users for more than a week,” it qualifies as High.
sherlock-admin3
Escalate
This issue should be high.
There is a calculation error inside the UsdPool::isSubAmountAllowed() function.
UsdPool::isSubAmountAllowed() is called by UsdPool::subStableToken()
The functions ClaimRewardsProcess.claimRewards(), LpPoolProcess.updatePnlAndUnHoldPoolAmount() (called by decreasePosition), and RedeemProcess._redeemStakeUsd() internally call UsdPool::subStableToken(), then will revert, which causes users to be unable to claim rewards, reduce positions, and redeem StakeUsd. Additionally, if no new funds are added by other users, the impact could last for over a week.
According to Sherlock’s rules, “The issue causes locking of funds for users for more than a week,” it qualifies as High.
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.
Hash01011122
I understand the path which could lead to the scenario mentioned, my question is what exactly would be the impact? How did you come to conclusion that DOS could last for over a week not a day or month??
@0502lian @ZeroTrust01
0502lian
if no new funds are added by other users, the impact could last for over a week.
if no new funds are added by other users, the impact could last for over a week. This mentions a possibility. Our job in auditing is to identify various issues that can affect the system. Regarding this issue, the larger the amount users want to reduce their positions and redeem, the higher the probability of Revert caused by calculation errors. The longer the time, the higher the probability of new funds coming in from users. In extreme cases, it could take a month, although the probability is very low. @Hash01011122
mstpr
Escalate
This should be invalid. unsettledFee is not liquid in the contract until it is settled. Including it in the accounting does not make sense because unsettledFee does not exist in the pools as a token. While accounting for it in the total value makes sense, both functions mentioned are strictly for the actual token balances, and unsettledFee does not exist in those balances.
sherlock-admin3
Escalate
This should be invalid. unsettledFee is not liquid in the contract until it is settled. Including it in the accounting does not make sense because unsettledFee does not exist in the pools as a token. While accounting for it in the total value makes sense, both functions mentioned are strictly for the actual token balances, and unsettledFee does not exist in those balances.
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.
WangSecurity
I agree with @mstpr comment, but to make sure I totally understand the issue, what are the pre-requisites for this issue to occur? Just as soon as the users start using the protocol? @0502lian could you make a small scenario how this issue would occur with real numbers that would be used and the links to appropriate functions?
0502lian
I agree with @mstpr comment, but to make sure I totally understand the issue, what are the pre-requisites for this issue to occur? Just as soon as the users start using the protocol? @0502lian could you make a small scenario how this issue would occur with real numbers that would be used and the links to appropriate functions?
@mstpr Escalate both issue 236 and issue 237.
Issue 236 and issue 237 are somewhat related and comparable. I have pointed out the flaws in his views and partially answered your questions in the latest comments on issue 237.
Perhaps we should wait and see what he says. @WangSecurity
WangSecurity
I agree this is a valid issue, but medium severity is more appropriate here. As I understand, there are specific conditions required for this to happen and it won't happen always with every user. Secondly, about the following:
According to Sherlock’s rules, “The issue causes locking of funds for users for more than a week,” it qualifies as High
The rule doesn't say "The issue causes locking of funds for users for more than a week" is necessarily high severity and medium is more appropriate here.
Planning to reject both escalations and leave the issue as it is.