Skip to content

Fixed price never expires #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
code423n4 opened this issue Jan 17, 2023 · 4 comments
Open

Fixed price never expires #310

code423n4 opened this issue Jan 17, 2023 · 4 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue grade-b Q-12 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-01-ondo/blob/main/contracts/lending/OndoPriceOracle.sol#L64

Vulnerability details

Impact

Once a fixed price has been set by owner, it never expires until owner explicitly sets it to 0. This could be risky where contract might be working with an obsolete price, if Owner failed to update price timely

Proof of Concept

  1. Owner sets fixed price P1 for fToken F using setPrice function
function setPrice(address fToken, uint256 price) external override onlyOwner {
    uint256 oldPrice = fTokenToUnderlyingPrice[fToken];
    fTokenToUnderlyingPrice[fToken] = price;
    emit UnderlyingPriceSet(fToken, oldPrice, price);
  }
  1. After X days, if the getUnderlyingPrice is retrieved then price P1 will be returned for fToken F. This shows that fixed price which was set X days ago still works and never expires
function getUnderlyingPrice(
    address fToken
  ) external view override returns (uint256) {
    if (fTokenToUnderlyingPrice[fToken] != 0) {
      return fTokenToUnderlyingPrice[fToken];
    } else {
      ...
    }
  }

Recommended Mitigation Steps

Fixed price must expire after x seconds of addition. This will prevent contract from using obsolete prices

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Jan 17, 2023
code423n4 added a commit that referenced this issue Jan 17, 2023
@c4-judge c4-judge added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax downgraded by judge Judge downgraded the risk level of this issue and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Jan 23, 2023
@c4-judge
Copy link
Contributor

trust1995 changed the severity to QA (Quality Assurance)

@c4-judge
Copy link
Contributor

trust1995 marked the issue as grade-b

@c4-sponsor
Copy link

tom2o17 marked the issue as sponsor acknowledged

@c4-sponsor c4-sponsor added the sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons label Jan 23, 2023
@tom2o17
Copy link

tom2o17 commented Jan 23, 2023

Not super concerned with having the price expire. This manual setting of the oracle price is really only intended to be used wrt to CASH token

@C4-Staff C4-Staff added the Q-12 label Feb 7, 2023
@Simon-Busch Simon-Busch removed the Q-12 label Feb 8, 2023
@C4-Staff C4-Staff added Q-12 and removed Q-12 labels Feb 8, 2023
@Simon-Busch Simon-Busch removed the Q-12 label Feb 8, 2023
@C4-Staff C4-Staff added the Q-12 label Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue grade-b Q-12 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

6 participants