<!-- canonical: https://0xsimao.com/findings/ostium-collateral-revert-index-exist -->

# updateGroupCollateral() should revert if the _pairIndex does not exist

Low/Info · Three Sigma · RWA perpetuals DEX · 19th February, 2024

Finding 3S-OS-N17 of the Ostium security review.

- Protocol: https://www.ostium.com/
- Report: /reports/ostium
- Source: https://cdn.sanity.io/files/qoqld077/production/a95b9c69e0f65d1d6b0e649f0d62a362358ca8ce.pdf

---

### Description

[OstiumPairsStorage::updateGroupCollateral()](https://github.com/0xOstium/smart-contracts-threeSigma/blob/audit-feedback/src/OstiumPairsStorage.sol#L186) does not check for the pair's index
existence, which means that it would update group with index 0 incorrectly.

### Recommendation

Add if (!isPairIndexListed[_pairIndex]) revert PairNotListed(_pairIndex); to
the function.

### Status

Addressed in [#ee024b2](https://github.com/0xOstium/smart-contracts-threeSigma/pull/58/commits/ee024b2e2369233816d0d14e23a9eab34494c841).

---

Related findings:

- [`borrowing::liquidate()` sends the wrong liquidation index to the destination chain, overwritting liquidation information and getting collateral stuck](https://0xsimao.com/findings/autonomint-liquidate-liquidation-index-stuck): Autonomint
- [Drained lender due to `LenderCommitmentGroup_Smart::acceptFundsForAcceptBid()` `_collateralAmount` by `STANDARD_EXPANSION_FACTOR` multiplication](https://0xsimao.com/findings/teller-finance-bid-collateral-factor-multiplication): Teller Finance
- [`FlashRolloverLoan_G5` will fail for `LenderCommitmentGroup_Smart` due to `CollateralManager` pulling collateral from `FlashRolloverLoan_G5`](https://0xsimao.com/findings/teller-finance-flash-rollover-collateral-pulling): Teller Finance
- [Anyone can steal pool shares from lender group if no-revert-on-failure tokens are used](https://0xsimao.com/findings/teller-finance-steal-shares-revert-failure): Teller Finance
