Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

cergyk - Price signature reuse in setSymbolsPrice can heavily influence liquidation outcome #79

Closed
sherlock-admin opened this issue Jul 3, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Jul 3, 2023

cergyk

high

Price signature reuse in setSymbolsPrice can heavily influence liquidation outcome

Summary

Any older price signature can be used to call setSymbolsPrice, and can be used by a malicious liquidator to liquidate partyA in unfair conditions.

Vulnerability Detail

While there is a condition for the price to not be too far in the future from the liquidation time:
https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/liquidation/LiquidationFacetImpl.sol#L40-L44

There is conversely no check to ensure that a signature too old is not used here.

We can notice that this is handled correctly in partyB's liquidation where both checks are enforced:
https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/liquidation/LiquidationFacetImpl.sol#L318-L330

A liquidator can either manipulate this field to get their maximum share of liquidation fee if that's not actually possible under market conditions, or collude with either partyB or partyA to make a favorable outcome to either one of them at the expense of the other given how funds are redistributed during liquidatePartyAPositions:

https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/liquidation/LiquidationFacetImpl.sol#L152-L156

and

https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/liquidation/LiquidationFacetImpl.sol#L163-L174

Impact

A malicious liquidator can use older signature for symbols prices, and influence liquidation outcome to be more favorable/defavorable to any actor partyA/partyB/liquidator.

Code Snippet

Tool used

Manual Review

Recommendation

Use a check similar as in partyB's liquidation:
https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/liquidation/LiquidationFacetImpl.sol#L327-L330

Duplicate of #113

@github-actions github-actions bot added High A valid High severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Jul 10, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Jul 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant