-
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
BalancerOracle::update()
can return stale price
#124
Comments
@0xtj24 Sponsors are not allowed to close, reopen, or assign issues or pull requests. |
That logic updates the price only after a certain |
koolexcrypto changed the severity to QA (Quality Assurance) |
koolexcrypto marked the issue as grade-c |
This previously downgraded issue has been upgraded by koolexcrypto |
Since |
koolexcrypto marked the issue as satisfactory |
koolexcrypto marked the issue as selected for report |
Lines of code
https://github.com/code-423n4/2024-07-loopfi/blob/57871f64bdea450c1f04c9a53dc1a78223719164/src/oracle/BalancerOracle.sol#L114-L136
Vulnerability details
Impact
Whenever
block.timestamp - lastUpdate > updateWaitWindow
and needs to update the price it will return a stale price because it will fetch the price from the lastUpdate not the currentUpdate.Proof of Concept
In the
update()
function these are the lines we'll findfrom the code we can see that the currentPrice is the last thing updated.
and whenever there updateWindow reaches or passes for us to fetch a new price the safePrice is updated first which is the value from the lastUpdate which is "stale".
it can be argued that its a design decision meaning the updateWindow is just time it needs to fetch a new price but it doesn't mean the price is old. However the
updateWindow
can be passed and not updated right after meaning the price is two times back because it wasn't updated right away.Tools Used
manual review
Recommended Mitigation Steps
Revisit the logic to be able to fetch fresh price whenever there need to be a new price fetched
Assessed type
Oracle
The text was updated successfully, but these errors were encountered: