Skip to content
Audit finding Intermediate

The RedstoneCoreOracle has a constant stale price threshold, this is dangerous to use with tokens that have a smaller threshold as the oracle will report stale prices as valid

The RedstoneCoreOracle uses a constant stale price threshold of 3600 seconds for all tokens, but some tokens have a smaller threshold. This means the oracle may accept prices that are actually stale, leading to incorrect collateral valuation and unfair liquidations or incorrect borrowing amounts.

000000 Follow with AlexCzm, Obsidian and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-08-sentiment-v2-judging/issues/126

The protocol has acknowledged this issue.

Found by

000000, AlexCzm, Obsidian, eeshenggoh

Summary

Different tokens have different STALE_PRICE_THRESHOLD. The protocol uses a constant STALE_PRICE_THRESHOLD = 3600 for all tokens in the RedstoneCoreOracle.

The issue arises when the token actually has a STALE_PRICE_THRESHOLD < 3600, then the oracle will report the stale price as valid.

Here are some tokens whose redstone priceFeed has a STALE_PRICE_THRESHOLD < 3600 (1 hour)

  1. TRX/USD 10 minutes
  2. BNB/USD 1 minute

Root Cause

using a constant STALE_PRICE_THRESHOLD = 3600, rather than setting one for each token

Internal pre-conditions

No response

External pre-conditions

Token has a threshold < 3600

Attack Path

No response

Impact

The protocol will report stale prices as valid, this results in collateral being valued using stale prices.

It will lead to unfair liqudiations due to stale price valuation of collateral AND/OR a position not being liquidated due to stale price valuation of collateral

It will also lead to borrowing a wrong amount due to stale price valuation of collateral

PoC

No response

Mitigation

Set a unique STALE_PRICE_THRESHOLD for each token, similar to the chainlink oracle

Discussion

sherlock-admin2

1 comment(s) were left on this issue during the judging contest.

z3s commented:

Each asset has their own instance of a RedstoneOracle, so this param can be changed

0xspearmint1

escalate

The lead judge states that since each asset has it's own instance of the oracle the param can be changed

  1. Firstly, the STALE_PRICE_THRESHOLD is a constant variable that is already set, there is no evidence that the team intended to change the currently set constant variable.

  2. Secondly, since each oracles instance uses 2 price feeds to determine the USD price of the asset (Asset/ETH and ETH/USD), as long as the asset has a different threshold to ETH the described issue in the report will occur.

sherlock-admin3

escalate

The lead judge states that since each asset has it's own instance of the oracle the param can be changed

  1. Firstly, the STALE_PRICE_THRESHOLD is a constant variable that is already set, there is no evidence that the team intended to change the currently set constant variable.

  2. Secondly, since each oracles instance uses 2 price feeds to determine the USD price of the asset (Asset/ETH and ETH/USD), as long as the asset has a different threshold to ETH the described issue in the report will occur.

You've created a valid escalation!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

ruvaag

I think this should be a low because the intended behavior in the described case would be to use the worst stale price threshold which should mitigate this

0xspearmint1

What do you mean by the worst stale price? @ruvaag

If you mean the smaller one, this will cause a serious DOS issue for the token with a larger threshold (liquidations will revert).

If you mean the larger one, this will allow borrowing the other token at a stale price.

The only mitigation is to have a seperate threshold for each token.

cvetanovv

I agree that the constant STALE\_PRICE\_THRESHOLD is not good to be hardcoded to 1 hour because each token pair has a different stale period when it needs to be updated.

Because of this, I agree that this issue is more of a Medium because the price may be outdated.

I plan to accept the escalation and make this issue a Medium severity.

0xspearmint1

Hi @cvetanovv #346 is not a duplicate of this issue, it is actually invalid.

This issue is about using a constant STALE\_PRICE\_THRESHOLD

#346 describes a totally different attack vector which claims that the threshold is too short (threshold is set by the admin).

HHK-ETH

Agree, 346 is similar but incomplete. It only talks about the max duration threshold and not the constant itself. As it was correctly pointed out it could also be an issue to use a duration too small.

It should be removed from duplicates 👍

cvetanovv

@0xspearmint1 @HHK-ETH Thanks for noting that #346 is not a duplicate of this issue. And it indeed uses a different attack vector.

My decision is to accept the escalation and make this issue and its duplicates Medium severity without #346.

WangSecurity

Result: Medium Has duplicates

sherlock-admin4

Escalations have been resolved successfully!

Escalation status:

The original report as published on Sherlock, by 000000. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

The protocol may value collateral using stale prices, leading to unfair liquidations or failure to liquidate, and incorrect borrowing amounts.

What the attacker needed

Token has a threshold < 3600

The fix

Set a unique STALE_PRICE_THRESHOLD for each token, similar to the Chainlink oracle.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

An oracle is a service that provides external data, like prices, to a smart contract. A stale price threshold is the maximum age a price can be before it's considered outdated. If the threshold is too large, the contract might use an old price, which can cause financial losses.

More by 000000

View all

32 more disclosed reports, best first.

More from Sentiment V2

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.