Open sherlock-admin3 opened 3 months ago
This should be mitigated by burning shares initially
Escalate.
This is a valid issue.
The only way to burn shares in SuperPool is to withdraw, as shares are burned, the assets are decreased too, therefore Shares per Token
remains the same (and will continue to be inflated by bad debts), this does not help to mitigate this issue.
Escalate.
This is a valid issue.
The only way to burn shares in SuperPool is to withdraw, as shares are burned, the assets are decreased too, therefore
Shares per Token
remains the same (and will continue to be inflated by bad debts), this does not help to mitigate this issue.
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.
This does not account for Shares burned when SuperPool is initally deployed, using SuperPoolFactory.sol. Not an issue imo.
This does not account for Shares burned when SuperPool is initally deployed, using SuperPoolFactory.sol. Not an issue imo.
Shares burned when SuperPool is initially deployed only helps to mitigate vault inflation attack, however, this report describe a different issue, and the POC shows how exactly the shares are inflated to overflow.
you're right, this isn't the same. i think the root cause here is the same as #585 but for the SuperPool instead of the Pool as mentioned in the other issue.
you're right, this isn't the same. i think the root cause here is the same as #585 but for the SuperPool instead of the Pool as mentioned in the other issue.
Yes, it's similar to #585 but they are different issues.
I think this issue is a valid Medium. The reason it is not High is because this involves certain external conditions, such as the occurrence of bad debt liquidations, which would inflate the Super Pool shares.
While the overflow potential is significant, it requires multiple bad debt liquidations to occur, making the issue dependent on specific states and not an immediate or guaranteed loss of funds.
I am planning to accept the escalation and make this issue Medium.
Seems like a duplicate of #585 to me, what is the difference?
This issue is different to 585 since it is regarding SuperPool shares, but they both require the liquidator bots to not work for multiple consecutive instances, even though max LTV is 98% so liquidations will be incentivised.
This issue will be the same severity as #585 because it requires multiple bad debt liquidations, and the protocol has off-chain bots that won't allow that.
If #585 is valid after the escalation, this issue will also be valid.
Planning to reject the escalation and leave the issue as is.
This issue will be the same severity as #585 because it requires multiple bad debt liquidations, and the protocol has off-chain bots that won't allow that.
If #585 is valid after the escalation, this issue will also be valid.
Planning to reject the escalation and leave the issue as is.
I don't think this issue's severity should be determined by #585, protocol's off-chain bots will work only when the the liquidation is profitable, and if not (e.g. major price dump), bad debt liquidation will happen, unlike #585, no consecutive bad debt liquidations are needed, even if there are bot liquidations in between, the issue will eventually occur, and it's not a low likelihood event considering the whole lifetime of a SuperPool.
I will agree with the comment @0xh2134
Bad debt liquidation can occur with a high TVL and high price volatility, and the bots may not have the initiative to liquidate an asset. There is already a valid issue related to this in this contest.
Because of that this issue is Medium severity.
I am planning to accept the escalation and make this issue Medium.
Result: Medium Unique
The protocol team fixed this issue in the following PRs/commits: https://github.com/sentimentxyz/protocol-v2/pull/333
h2134
High
Super Pool shares can be inflated by bad debt leading to overflows
Summary
Super Pool shares can be inflated by bad debt leading to overflows.
Vulnerability Detail
Super Pool shares are calculated based on total assets and total supply, i.e $Shares = Deposit Amount * Total Shares / Total Assets$. SuperPool.sol#L194-L197:
At the beginning, when user deposits $1000e18$ asset tokens, they can mint $1000e18$ shares. The assets will be deposited into underlying pools and normally
Shares per Token
is expected to be deflated as interest accrues.However, if the borrowed assets are not repaid, bad debt may occur and it can be liquidated by pool owner. As a result,
Total Assets
owned by the Super Pool will be largely reduced, as a result,Shares per Token
can be heavily inflated to a very large value, eventually leading to overflows if bad debt liquidated for several times.Consider the following scenario in PoC:
Total Assets
is $1000$ andTotal Shares
is $1000$,Shares per Token
is $1$;Total Assets
is $1000$ andTotal Shares
is $1000000000000000001000$,Shares per Token
is inflated to $999000999000999001999000999000999000$;Shares per Token
will be further inflated.Shares per Token
can be inflated to be more thanuint256.max
(around $1e78$) after just 4 bad debt liquidations:Please run the PoC in BigTest.t.sol:
Impact
Shares are inflated by bad debts, the more volatile an asset is, the more likely bad debt occurs. Small bad debt may not be a problem because they can only inflate shares by a little bit, however, a few large bad debts as showed in PoC can cause irreparable harm to the protocol (it is especially so if the asset token has higher decimals), and shares are very likely be inflated to overflow in the long run. As a result, most of the operations can be blocked, users cannot deposit or withdraw.
Code Snippet
https://github.com/sherlock-audit/2024-08-sentiment-v2/blob/main/protocol-v2/src/SuperPool.sol#L456-L472
Tool used
Manual Review
Recommendation
It is recommended to adjust token/share ratio if it has been inflated to a very large value, but ensure the precision loss is acceptable. For example, if the ratio value is $1000000000000000000000000000000000000$ ($1e36$), it can be adjusted to $1000000000000000000$ ($1e18$). This can be done by using a dynamic
AdjustFactor
to limit the ratio to a reasonable range: SuperPool.sol#L456-L472: