You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.
sherlock-admin opened this issue
Jul 3, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
The setSymbolsPrice function of the LiquidationFacetImpl library does not check if the priceSig is too old. This can result in the wrong uPnL, total unrealized loss and symbol prices being used in the liquidation process.
Vulnerability Detail
The liquidation process of a party A consists of 4 steps where a liquidator calls liquidatePartyA, setSymbolsPrice, liquidatePendingPositionsPartyA and liquidatePositionsPartyA functions of the library LiquidationFacetImpl.
The issue is that in the setSymbolsPrice there is no verification for the priceSig being too old. Note also that there is no check in LibMuon:verifyPrices function for party A nonce, so any previous valid signature for party A can be used.
Notice also that once the liquidationType for party A has been set, new calls to the setSymbolsPrice will revert if the priceSig.upnl and priceSig.totalUnrealizedLoss are not equal to the ones used in the first call. So even if an honest liquidator tried to update the liquidation data, it will fail.
Impact
A malicious liquidator can use an outdated signature which will result in the wrong uPnL, total unrealized loss and symbol prices being used in the liquidation process. This can result in party A being liquidated for a smaller or bigger amount than it should be.
Another possible impact is that the priceSig does not include all the symbols that party A has positions in, because it was signed before party A created the current quotes. This can result in the liquidation process not being able to liquidate all the positions of party A and getting stuck forever.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
shaka
high
No check for expired
priceSig
insetSymbolsPrice
Summary
The
setSymbolsPrice
function of theLiquidationFacetImpl
library does not check if thepriceSig
is too old. This can result in the wrong uPnL, total unrealized loss and symbol prices being used in the liquidation process.Vulnerability Detail
The liquidation process of a party A consists of 4 steps where a liquidator calls
liquidatePartyA
,setSymbolsPrice
,liquidatePendingPositionsPartyA
andliquidatePositionsPartyA
functions of the libraryLiquidationFacetImpl
.The issue is that in the
setSymbolsPrice
there is no verification for thepriceSig
being too old. Note also that there is no check inLibMuon:verifyPrices
function for party A nonce, so any previous valid signature for party A can be used.Notice also that once the
liquidationType
for party A has been set, new calls to thesetSymbolsPrice
will revert if thepriceSig.upnl
andpriceSig.totalUnrealizedLoss
are not equal to the ones used in the first call. So even if an honest liquidator tried to update the liquidation data, it will fail.Impact
A malicious liquidator can use an outdated signature which will result in the wrong uPnL, total unrealized loss and symbol prices being used in the liquidation process. This can result in party A being liquidated for a smaller or bigger amount than it should be.
Another possible impact is that the
priceSig
does not include all the symbols that party A has positions in, because it was signed before party A created the current quotes. This can result in the liquidation process not being able to liquidate all the positions of party A and getting stuck forever.Code Snippet
https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/liquidation/LiquidationFacetImpl.sol#L38-L44
https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/libraries/LibMuon.sol#L50-L68
Tool used
Manual Review
Recommendation
Add a check for the
priceSig
being too old in eitherLiquidationFacetImpl:setSymbolsPrice
orLibMuon:verifyPrices
functions.Duplicate of #113
The text was updated successfully, but these errors were encountered: