Malicious users could use back old values
Per the Teller's User Checklist, it is possible that a potential attacker could go back in time to find a desired value in the event that a Tellor value is disputed. Following is the extract taken from the checklist:\\nEnsure that functions do not use old Tellor values\\nIn the event where a Tellor value is disputed, the disputed value is removed & previous values remain. Prevent potential attackers from going back in time to find a desired value with a check in your contracts. This repo is a great reference for integrating Tellor.\\nThe current implementation lack measure to guard against such attack.\\n```\\nFile: TellorOracle.sol\\n    function getPriceInEth(address tokenToPrice) external returns (uint256) {\\n        TellorInfo memory tellorInfo = _getQueryInfo(tokenToPrice);\\n        uint256 timestamp = block.timestamp;\\n        // Giving time for Tellor network to dispute price\\n        (bytes memory value, uint256 timestampRetrieved) = getDataBefore(tellorInfo.queryId, timestamp - 30 minutes);\\n        uint256 tellorStoredTimeout = uint256(tellorInfo.pricingTimeout);\\n        uint256 tokenPricingTimeout = tellorStoredTimeout == 0 ? DEFAULT_PRICING_TIMEOUT : tellorStoredTimeout;\\n\\n        // Check that something was returned and freshness of price.\\n        if (timestampRetrieved == 0 || timestamp - timestampRetrieved > tokenPricingTimeout) {\\n            revert InvalidDataReturned();\\n        }\\n\\n        uint256 price = abi.decode(value, (uint256));\\n        return _denominationPricing(tellorInfo.denomination, price, tokenToPrice);\\n    }\\n```\\n\\nAnyone can submit a dispute to Tellor by paying a fee. The disputed values are immediately removed upon submission, and the previous values will remain. The attacks are profitable as long as the economic gains are higher than the dispute fee. For instance, this can be achieved by holding large amounts of vault shares (e.g., obtained using own funds or flash-loan) to amplify the gain before manipulating the assets within it to increase the values.
Update the affected function as per the recommendation in Teller's User Checklist.\\n```\\nfunction getPriceInEth(address tokenToPrice) external returns (uint256) {\\n    TellorInfo memory tellorInfo = _getQueryInfo(tokenToPrice);\\n    uint256 timestamp = block.timestamp;\\n    // Giving time for Tellor network to dispute price\\n    (bytes memory value, uint256 timestampRetrieved) = getDataBefore(tellorInfo.queryId, timestamp - 30 minutes);\\n    uint256 tellorStoredTimeout = uint256(tellorInfo.pricingTimeout);\\n    uint256 tokenPricingTimeout = tellorStoredTimeout == 0 ? DEFAULT_PRICING_TIMEOUT : tellorStoredTimeout;\\n\\n    // Check that something was returned and freshness of price.\\n    if (timestampRetrieved == 0 || timestamp - timestampRetrieved > tokenPricingTimeout) {\\n        revert InvalidDataReturned();\\n    }\\n    \\n// Add the line below\\n    if (timestampRetrieved > lastStoredTimestamps[tellorInfo.queryId]) {\\n// Add the line below\\n        lastStoredTimestamps[tellorInfo.queryId] = timestampRetrieved;\\n// Add the line below\\n        lastStoredPrices[tellorInfo.queryId] = value;\\n// Add the line below\\n    } else {\\n// Add the line below\\n     value = lastStoredPrices[tellorInfo.queryId]\\n// Add the line below\\n    }\\n\\n    uint256 price = abi.decode(value, (uint256));\\n    return _denominationPricing(tellorInfo.denomination, price, tokenToPrice);\\n}\\n```\\n
Malicious users could manipulate the price returned by the oracle to be higher or lower than expected. The protocol relies on the oracle to provide accurate pricing for many critical operations, such as determining the debt values of DV, calculators/stats used during the rebalancing process, NAV/shares of the LMPVault, and determining how much assets the users should receive during withdrawal.\\nIncorrect pricing would result in many implications that lead to a loss of assets, such as users withdrawing more or fewer assets than expected due to over/undervalued vaults or strategy allowing an unprofitable rebalance to be executed.
```\\nFile: TellorOracle.sol\\n    function getPriceInEth(address tokenToPrice) external returns (uint256) {\\n        TellorInfo memory tellorInfo = _getQueryInfo(tokenToPrice);\\n        uint256 timestamp = block.timestamp;\\n        // Giving time for Tellor network to dispute price\\n        (bytes memory value, uint256 timestampRetrieved) = getDataBefore(tellorInfo.queryId, timestamp - 30 minutes);\\n        uint256 tellorStoredTimeout = uint256(tellorInfo.pricingTimeout);\\n        uint256 tokenPricingTimeout = tellorStoredTimeout == 0 ? DEFAULT_PRICING_TIMEOUT : tellorStoredTimeout;\\n\\n        // Check that something was returned and freshness of price.\\n        if (timestampRetrieved == 0 || timestamp - timestampRetrieved > tokenPricingTimeout) {\\n            revert InvalidDataReturned();\\n        }\\n\\n        uint256 price = abi.decode(value, (uint256));\\n        return _denominationPricing(tellorInfo.denomination, price, tokenToPrice);\\n    }\\n```\\n