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
When partyB is liquidated, then partyBLiquidationTimestampis set to it.
Later, liquidatePositionsPartyB function can be called to close positions for partyB. Liquidator provides QuotePriceSig to this call.
This is another one, which checks that current time is not bigger than priceSig + maLayout.liquidationTimeout.
In order to provide valid priceSig it should:
1.priceSig.timestamp <= maLayout.partyBLiquidationTimestamp[partyB][partyA] + maLayout.liquidationTimeout
2.block.timestamp - maLayout.liquidationTimeout > priceSig.timestamp
then we have block.timestamp - maLayout.liquidationTimeout > priceSig.timestamp <= maLayout.partyBLiquidationTimestamp[partyB][partyA] + maLayout.liquidationTimeout
This condition is actually incorrect, because it depends on block.timestamp, which means that if liquidator will not call this function in this time period, then he will not be able to call it later.
This means that liquidator should provide signature that was created between maLayout.partyBLiquidationTimestamp[partyB][partyA] and maLayout.partyBLiquidationTimestamp[partyB][partyA] + maLayout.liquidationTimeout period.
Impact
Liquidator will not be able to call function.
Code Snippet
Provided above
Tool used
Manual Review
Recommendation
Use this condition to allow signature: maLayout.partyBLiquidationTimestamp[partyB][partyA] >= priceSig.timestamp <= maLayout.partyBLiquidationTimestamp[partyB][partyA] + maLayout.liquidationTimeout
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
rvierdiiev
medium
LiquidationFacetImpl.liquidatePositionsPartyB doesn't check provided signature timestamp correctly
Summary
LiquidationFacetImpl.liquidatePositionsPartyB doesn't check provided signature timestamp correctly
Vulnerability Detail
When partyB is liquidated, then
partyBLiquidationTimestamp
is set to it.Later,
liquidatePositionsPartyB
function can be called to close positions for partyB. Liquidator providesQuotePriceSig
to this call.There are 2 checks of
priceSig
that are going to validate if it's provided for correct timestamp.https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/liquidation/LiquidationFacetImpl.sol#L318-L322
This is first one and it checks that
priceSig
is not more in future then liquidation time + maLayout.liquidationTimeout.https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/liquidation/LiquidationFacetImpl.sol#L327-L330
This is another one, which checks that current time is not bigger than
priceSig
+ maLayout.liquidationTimeout.In order to provide valid
priceSig
it should:1.
priceSig.timestamp <= maLayout.partyBLiquidationTimestamp[partyB][partyA] + maLayout.liquidationTimeout
2.
block.timestamp - maLayout.liquidationTimeout > priceSig.timestamp
then we have
block.timestamp - maLayout.liquidationTimeout > priceSig.timestamp <= maLayout.partyBLiquidationTimestamp[partyB][partyA] + maLayout.liquidationTimeout
This condition is actually incorrect, because it depends on block.timestamp, which means that if liquidator will not call this function in this time period, then he will not be able to call it later.
Correct condition should be:
maLayout.partyBLiquidationTimestamp[partyB][partyA] >= priceSig.timestamp <= maLayout.partyBLiquidationTimestamp[partyB][partyA] + maLayout.liquidationTimeout
This means that liquidator should provide signature that was created between maLayout.partyBLiquidationTimestamp[partyB][partyA] and maLayout.partyBLiquidationTimestamp[partyB][partyA] + maLayout.liquidationTimeout period.
Impact
Liquidator will not be able to call function.
Code Snippet
Provided above
Tool used
Manual Review
Recommendation
Use this condition to allow signature:
maLayout.partyBLiquidationTimestamp[partyB][partyA] >= priceSig.timestamp <= maLayout.partyBLiquidationTimestamp[partyB][partyA] + maLayout.liquidationTimeout
Duplicate of #113
The text was updated successfully, but these errors were encountered: