xiaoming90 - PartyB can settle PartyA’s losing positions even when it is unnecessary and detrimental to Party A’s allocated balance #46
Labels
Sponsor Disputed
The sponsor disputed this issue's validity
Won't Fix
The sponsor confirmed this issue will not be fixed
xiaoming90
High
PartyB can settle PartyA’s losing positions even when it is unnecessary and detrimental to Party A’s allocated balance
Summary
PartyB can settle PartyA’s losing positions, even when it is unnecessary and only further decreases PartyA's allocated balance. This unnecessary and premature settling causes PartyA to realize losses at unfavorable market conditions and prices, without giving them the opportunity to react or potentially recover from the temporary downturn. As a result, Party A is unfairly exposed to significant financial harm, having their positions closed at the worst possible moments, leading to a loss of assets for them.
Root Cause
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
Per Symm IO v0.8.3 documentation, the purpose of the newly implemented
settleUpnl
function is as follows:This new feature is intended to solve the problem where a hedger cannot fill PartyA's close request because PartyA does not have enough allocated balance, as described in the documentation's example. As shown in the documentation's example, only PartyA's winning positions (those with positive PnL) need to be settled. Once these winning positions are settled, PartyA's allocated balance will increase, and there will be sufficient allocated balance in PartyA's account to execute PartyA's close request for its losing positions.
With that in mind, it does not make sense to allow hedgers to settle the losing positions of PartyA under any circumstance because:
However, it was observed that the
settleUpnl
allows hedgers to settle the losing positions of PartyA.Assume that PartyA's LONG position with symbol=ETH,
quote.openedPrice = 3000 USDC
,quote.quantity = 1
, anddata.currentPrice = 2000 USC
. This position is losing position for PartyA as the ETH's price dropped after the position was opened. However, none of the price validation checks at Lines 57-67 below prevents PartyB from settling a losing position of PartyA.https://github.com/sherlock-audit/2024-09-symmio-v0-8-4-update-contest/blob/main/protocol-core/contracts/libraries/LibSettlement.sol#L57
Impact
PartyB can settle PartyA’s losing positions, even when it is unnecessary and only further decreases PartyA's allocated balance. This unnecessary and premature settling causes PartyA to realize losses at unfavorable market conditions and prices, without giving them the opportunity to react or potentially recover from the temporary downturn. As a result, Party A is unfairly exposed to significant financial harm, having their positions closed at the worst possible moments, leading to a loss of assets for them.
PoC
No response
Mitigation
Update the
settleUpnl
function to ensure that only positions/quotes that increase the target account's allocated balance can be settled. In this report's example, PartyB should only be allowed to settle PartyA's winning positions, as only this settlement will increase PartyA's allocated balance.The text was updated successfully, but these errors were encountered: