This repository has been archived by the owner on Mar 10, 2024. It is now read-only.
panprog - liquidatePartyA
requires signature which doesn't have nonce, making possible unfair liquidation and loss of funds for all parties
#5
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A valid High severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
panprog
high
liquidatePartyA
requires signature which doesn't have nonce, making possible unfair liquidation and loss of funds for all partiesSummary
liquidationSig
provided by liquidator toliquidatePartyA
doesn't have nonces of neither partyA nor partyB. This means that this signature is valid even if partyA and/or partyB do some actions before the liquidation with this signature happens. There are numerous scenarios possible, both happening by itself and caused by malicious parties, where this can lead to loss of funds for some or all parties involved.Vulnerability Detail
Example Scenario:
4.1. Available Balance = 59-5 - 100 = -46
4.2. Liquidation type = OVERDUE (46 > 5), deficit = 41
4.3. Corresponding partyB receives 50 - 50*46/100 = 27
4.4. PartyA allocated balance is set to 0
4.5. Liquidators receives 0 (because it's OVERDUE liquidation)
The result:
All 3 parties have lost funds. Protocol basically stole those funds.
Impact
Unfair liquidation for partyA, loss of funds for liquidator and partyB in many possible situations during partyA liquidation - happening by itself or caused by malicious actors.
Proof of Concept
Add this to any test, for example to
ClosePosition.behavior.ts
.Console execution result:
As can be noticed, partyA + partyB have 1109 total after closing, but only 1079.5 after liquidation.
If the
fillCloseRequest
is commented out, then liquidation produces correct result:Code Snippet
Notice that there are no nonces of either party in the liquidation signature:
https://github.com/sherlock-audit/2023-08-symmetrical/blob/main/symmio-core/contracts/libraries/LibMuon.sol#L54-L67
Tool used
Manual Review
Recommendation
Include partyA and partyB nonces in the liquidation signature.
The text was updated successfully, but these errors were encountered: