Submitted by rbserver, also found by eierina, 0x52, kwhuo68, joestakey, ladboy233, Jeiwan, __141345__, bin2chen, yixxas, koxuan, 8olidity, 0xdeadbeef0x, fs0c, 0xDecorativePineapple, Rolezn, rvierdiiev, and gzeon
As mentioned by https://docs.tigris.trade/protocol/oracle, Prices provided by the oracle network are also compared to Chainlinks public price feeds for additional security. If prices have more than a 2% difference the transaction is reverted. The Chainlink price verification logic in the following TradingLibrary.verifyPrice function serves this purpose. However, besides that IPrice(_chainlinkFeed).latestAnswer() uses Chainlinks deprecated latestAnswer function, this function also does not guarantee that the price returned by the Chainlink price feed is not stale. When assetChainlinkPriceInt != 0 is true, it is still possible that assetChainlinkPriceInt is stale in which the Chainlink price verification would compare the off-chain price against a stale price returned by the Chainlink price feed. For a off-chain price that has more than a 2% difference when comparing to a more current price returned by the Chainlink price feed, this off-chain price can be incorrectly considered to have less than a 2% difference when comparing to a stale price returned by the Chainlink price feed. As a result, a trading transaction that should revert can go through, which makes the price verification much less secure.
https://github.com/code-423n4/2022-12-tigris/blob/main/contracts/utils/TradingLibrary.sol#L91-L122
Based on https://docs.chain.link/docs/historical-price-data, the following can be done to avoid using a stale price returned by the Chainlink price feed.
The following steps can occur for the described scenario.
VS Code
https://github.com/code-423n4/2022-12-tigris/blob/main/contracts/utils/TradingLibrary.sol#L113 can be updated to the following code.
GainsGoblin (Tigris Trade) acknowledged and commented:
Alex the Entreprenerd (judge) commented:
GainsGoblin (Tigris Trade) confirmed and commented:
For this contest, 12 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by brgltd received the top score from the judge.
The following wardens also submitted reports: Deivitto,
rbserver,
0xNazgul,
Aymen0909,
joestakey,
hansfriese,
unforgiven,
IllIllI,
0xSmartContract,
0x4non, and
chrisdior4
.
