You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Deviation is calculated incorrectly allowing more than permitted manipulations of pool spot prices
Vulnerability Detail
When computing the deviations of prices from TWAP in Bunni and UniV3 Deviation.isDeviatingWithBpsCheck() always uses the highest of the two values as the denominator
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
hash
medium
Incorrect deviation check
Summary
Deviation is calculated incorrectly allowing more than permitted manipulations of pool spot prices
Vulnerability Detail
When computing the deviations of prices from TWAP in Bunni and UniV3
Deviation.isDeviatingWithBpsCheck()
always uses the highest of the two values as the denominatorThis allows for underreporting of the deviation causing the pool to be manipulated outside of acceptable limits
Example
TWAP = 100
Spot Price = 200
maxDeviationBps = 51%
Actual deviation = (200 - 100) / 100 == 100%
Calculated deviation = (200 - 100) / 200 == 50%
Impact
Pools can be manipulated outside of expected limits
Code Snippet
deviation lib
https://github.com/sherlock-audit/2023-11-olympus/blob/main/bophades/src/libraries/Deviation.sol#L69
bunni deviation check
https://github.com/sherlock-audit/2023-11-olympus/blob/main/bophades/src/modules/PRICE/submodules/feeds/BunniPrice.sol#L255-L265
uniV3 deviation check
https://github.com/sherlock-audit/2023-11-olympus/blob/main/bophades/src/modules/PRICE/submodules/feeds/UniswapV3Price.sol#L227-L235
Tool used
Manual Review
Recommendation
Keep TWAP in the denominator
Duplicate of #193
The text was updated successfully, but these errors were encountered: