sherlock-audit / 2023-06-symmetrical-judging

5 stars 4 forks source link

Kose - Malicious PartyB can force their PartyA's into liquidation #331

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

Kose

medium

Malicious PartyB can force their PartyA's into liquidation

Summary

PartyB's have too many privileges and system is running around their actions and choices. Using these privileges, if partyB sees that their partyA is on the road to liquidation but trying to get rid of: they can block their partyA's request by simply locking new quotes and not accepting other requests.

Vulnerability Detail

In Symmetrical, the control over funds are mostly within the hands of partyB. Although this is the intented choice, it actually can create opportunities for partyB's to use them maliciously. Let's examine one scenario:

  1. PartyA's funds are losing value and hence he/she is at the risk of liquidation.
  2. PartyA wants to save their funds. The ways to prevent liquidity are:
    1. Closing position (via requestToClosePosition function)
    2. Opening hedge positions (via sendQuote function)
    3. Depositing and/or allocating new funds

Assuming user can not use option 3, now I will show how partyB can maliciously act to put obstacles into the option 1 and 2.

Although you might think that then this malicious behaviour gets punished, it actually won't happen because partyB has do nothing wrong in this scenario, he/she act according to his/her rights and it seems completely ok to the protocol to lock quotes without opening it, and prevent closing positions with this manner. Although whitelisting partyB's while sending quote might solve this issue, since this is not the default action in sendQuote we can obviously assume that this scenario is more than likely considering liquidations of partyA, leads to gain for partyB's.

Impact

PartyB's have too many privileges and can use them maliciously without doing anything malicious according to protocol. Using these privileges partyB's can prevent their partyA's new actions and forcefully liquidate them if they are on the dangerous zone (close to liquidation) in order to make profit.

Tool used

Manual Review

Code Snippets

Provided above

Recommendation

I would like to especially point out that this issue can not be solved by just changing forceCloseCooldown parameter. In markets everything can happen so fast and even choosing 1 hour period for this parameter again does not prevent malicious partyB's to reach their goals. One possible solution to this situation:

Duplicate of #224

kosedogus commented 1 year ago

Escalate

This issue is not a duplicate of #254. As I pointed out in recommendation section, changing forceCloseCooldown is not a solution to the problem provided above. What this issue is trying to show is Malicious partyB can prevent their partyA's to take any action and forcefully liquidate them as showed above. This issue is not just about force closing, it is also about maliciously locking quote's without opening (without even opening intention) them in order to make partyA liquidateable. One possible solution to this is provided above. I would like this issue to carefully reconsidered.

sherlock-admin2 commented 1 year ago

Escalate

This issue is not a duplicate of #254. As I pointed out in recommendation section, changing forceCloseCooldown is not a solution to the problem provided above. What this issue is trying to show is Malicious partyB can prevent their partyA's to take any action and forcefully liquidate them as showed above. This issue is not just above force closing, it is also about maliciously locking quote's without opening (without even opening intention) them in order to make partyA liquidateable. One possible solution to this is provided above. I would like this issue to carefully reconsidered.

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.

Evert0x commented 1 year ago

@ctf-sec I agree this is not a duplicate of 254, but do you think it's a valid issue on it's own?

hrishibhat commented 1 year ago

Result: Medium Duplicate of #224 This is a valid duplicate of #224

sherlock-admin2 commented 1 year ago

Escalations have been resolved successfully!

Escalation status: