-
Notifications
You must be signed in to change notification settings - Fork 0
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
Insufficient Validation in liboracle Contract's Price Data Check in line 60 before calling twapCircuitBreaker() #44
Comments
raymondfam marked the issue as insufficient quality report |
raymondfam marked the issue as duplicate of #4 |
See #8. |
hansfriese marked the issue as unsatisfactory: |
Thank you for judging @hansfriese, I believe this issue is not a duplicate of #4 OR #8, It speaks about a different part of the function. |
Check #164 for details. |
hansfriese removed the grade |
hansfriese marked the issue as not a duplicate |
hansfriese marked the issue as duplicate of #164 |
hansfriese marked the issue as satisfactory |
hansfriese marked the issue as partial-50 |
Lines of code
https://github.com/code-423n4/2024-03-dittoeth/blob/91faf46078bb6fe8ce9f55bcb717e5d2d302d22e/contracts/libraries/LibOracle.sol#L60
Vulnerability details
Impact
The assertion at line 60 of the
liboracle
contract is inaccurately stated and incomplete. The current check only reverts when the value ofprice
is 0 which would have been ok if PRICE was uint256 due to its type beingint256
it is not sufficient andtimestamp
at zero is not checked also . This insufficient validation can lead to potential vulnerabilities and incorrect price calculations, posing a risk to the contract's integrity and security.Proof of Concept
Code Before Mitigation:
Using the code below are examples of others oracle validation checks also in the contract, using them as a reference
Checks used in function oracleCircuitBreaker and function baseOracleCircuitBreaker:
From the reference used, other oracles check all parameters with precisely thus we can assert that the check in line 60 is not suficient enough and
Alice is a user who interacts with the
liboracle
contract to obtain price data. She relies on the contract's price data for her financial transactions. Due to the insufficient validation in the contract's assertion, Alice may receive incorrect or manipulated price data, which could lead her to make financial decisions based on inaccurate information.For example, if the
price
is less than 0 but other conditions are not met, Alice might receive a negative price, causing her to execute a transaction at an incorrect price, resulting in financial loss. Additionally, if thetimeStamp
is 0 due to insufficient validation, Alice may unknowingly use an unupdated or outdated or manipulated price data, leading to inaccurate financial transactions and potential financial losses.Tools Used
Manual code analysis
Recommended Mitigation Steps
To mitigate the potential vulnerabilities and risks associated with the insufficient validation in the
liboracle
contract, the assertion at line 60 should be updated to include a comprehensive check for all relevant conditions affecting the price data.Implement the following mitigation code to enhance the validation:
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: