-
Notifications
You must be signed in to change notification settings - Fork 5
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
Overlapping Price Ranges in RWADynamicOracle Contract #25
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
low quality report
This report is of especially low quality
primary issue
Highest quality submission among a set of duplicates
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Comments
raymondfam marked the issue as primary issue |
raymondfam marked the issue as low quality report |
Your assumptions would be correct if the conditional statements were using Additionally, per the readme: We are aware that if a range is updated the prevRangeClosePrice for subsequent set ranges will be stale. |
This was referenced Sep 7, 2023
Closed
kirk-baird marked the issue as unsatisfactory: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
low quality report
This report is of especially low quality
primary issue
Highest quality submission among a set of duplicates
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/rwaOracles/RWADynamicOracle.sol#L212
https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/rwaOracles/RWADynamicOracle.sol#L214
Vulnerability details
Impact
The RWADynamicOracle contract allows for the setting of different price ranges with different daily interest rates. If the price ranges overlap due to incorrect validations, it can lead to incorrect price calculations, potentially affecting any system or protocol that relies on this oracle for pricing information.
Proof of Concept
In the overrideRange function, there's a potential issue with how the new start and end times for a range are validated against existing ranges.
Line #212: Here, the newStart should be strictly greater than the end time of the previous range. The current check is
newStart < ranges[indexToModify - 1].end
but it should benewStart > ranges[indexToModify - 1].end
.Line #214: Here, the newEnd should be strictly less than the start time of the next range. The current check is
newEnd > ranges[indexToModify + 1].start
but it should benewEnd < ranges[indexToModify + 1].start
.Tools Used
Manual Code Review
Recommended Mitigation Steps
Update the overrideRange function to ensure that the new start and end times for a range do not overlap with existing ranges.
Specifically, modify the checks on lines 212 and 214 as mentioned in the Proof of Concept section.
Assessed type
Context
The text was updated successfully, but these errors were encountered: