Closed sherlock-admin closed 1 year ago
2 comment(s) were left on this issue during the judging contest.
panprog commented:
invalid, because any manipulation in the "older" period will also be detected while it's more recent and will trigger trading pause, besides manipulations in older time windows won't affect the average price (because it's calculated over AVG_UNISWAP_WINDOW)
MohammedRizwan commented:
valid
Invalid because any manipulation/data outside of the 2 * UNISWAP_AVG_WINDOW
period is irrelevant and does not impact the calculations in any way. Not a duplicate of #40, which is valid and deals with a separate issue.
feelereth
high
The metric calculation in consult() is vulnerable to manipulation further back than 2*UNISWAP_AVG_WINDOW.
Summary
The metric calculation in consult() assumes manipulation only happened in the last 2*UNISWAP_AVG_WINDOW seconds. An attacker could manipulate further back to evade detection
Vulnerability Detail
The metric calculation in consult() is vulnerable to manipulation further back than 2*UNISWAP_AVG_WINDOW. Here is how the vulnerability works: The key part of the metric calculation is:
The key assumption is that only manipulation in the last UNISWAP_AVG_WINDOW is reflected in meanTick0To2W. An attacker could manipulate further back, in the range [-2*UNISWAP_AVG_WINDOW, -UNISWAP_AVG_WINDOW]. This would affect meanTickWTo2W but NOT meanTick0To2W. So the difference and metric would be small, evading detection. The impact is allowing manipulation without detection. An attacker could systematically manipulate in alternating windows to suppress the metric.
Impact
The effect is that price manipulation attacks could go undetected if the manipulation happened further back than 2*UNISWAP_AVG_WINDOW seconds. This could allow attackers to manipulate prices without being caught. The severity depends on the value of UNISWAP_AVG_WINDOW, but I would categorize this as a high severity issue since it
Code Snippet
https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/libraries/Oracle.sol#L98-L100 https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/libraries/Oracle.sol#L135
Tool used
Manual Review
Recommendation
The metric should compare current values versus a longer historical baseline, rather than just recent windows. A suggestive example:
This would detect large deviations versus a longer history, making manipulation harder. Other options like expanding the windows, detecting threshold breaches, or adding reference checks could also help strengthen monitoring.