-
Notifications
You must be signed in to change notification settings - Fork 4
xiaoming90 - Position value can fall below the minimum acceptable quote value #248
Comments
The lockedValues amount of remaining open portion of the position is already validated in the 'requestToClose' function, so there's no need to check 'minAcceptableQuoteValue' within the 'closeQuote' function. https://github.com/sherlock-audit/2023-06-symmetrical/blob/6d2b64b6732fcfbd07c8217897dd233dbb6cd1f5/symmio-core/contracts/facets/PartyA/PartyAFacetImpl.sol#L175 |
Considering this a non issue based on the above sponsor comments |
@hrishibhat @MoonKnightDev I do not understand the reasoning. The scenario can be:
|
If someone requests to close 100% of the position, The |
I mean passing 100% in |
Agree with @shaka0x |
Fixed code PR link: |
xiaoming90
medium
Position value can fall below the minimum acceptable quote value
Summary
PartyB can fill a LIMIT order position till the point where the value is below the minimum acceptable quote value (
minAcceptableQuoteValue
). As a result, it breaks the invariant that the value of position must be above the minimum acceptable quote value, leading to various issues and potentially losses for the users.Vulnerability Detail
https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/libraries/LibQuote.sol#L196
If the user has already sent the close request, but partyB has not filled it yet, the user can request to cancel it by calling the
CancelCloseRequest
function. This will cause the quote's status to change toQuoteStatus.CANCEL_CLOSE_PENDING
.PartyB can either accept the cancel request or fill the close request ignoring the user's request. If PartyB decided to go ahead to fill the close request partially, the second branch of the if-else statement at Line 196 will be executed. However, the issue is that within this branch, PartyB is not subjected to the
minAcceptableQuoteValue
validation check. Thus, it is possible for PartyB to fill a LIMIT order position till the point where the value is below the minimum acceptable quote value (minAcceptableQuoteValue
).Impact
In the codebase, the
minAcceptableQuoteValue
is currently set to 5 USD. There are many reasons for having a minimum quote value in the first place. For instance, if the value of a position is too low, it will be uneconomical for the liquidator to liquidate the position because the liquidation fee would be too small or insufficient to cover the cost of liquidation. Note that the liquidation fee is computed as a percentage of the position value.This has a negative impact on the overall efficiency of the liquidation mechanism within the protocol, which could delay or stop the liquidation of accounts or positions, exposing users to greater market risks, including the risk of incurring larger losses or having to exit at an unfavorable price.
Code Snippet
https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/libraries/LibQuote.sol#L196
Tool used
Manual Review
Recommendation
If the user sends a close request and PartyB decides to go ahead to fill the close request partially, consider checking if the remaining value of the position is above the minimum acceptable quote value (
minAcceptableQuoteValue
) after PartyB has filled the position.The text was updated successfully, but these errors were encountered: