Closed sherlock-admin2 closed 1 year ago
2 comment(s) were left on this issue during the judging contest.
panprog commented:
low, because the seemsLegit is expected to return false when pool seems to be manipulated - this is not easy to achieve and if it does return false/true in some edge case, it's better to be on a safer side and pause trading until it is true. Simple same-block pool manipulation can not make seemsLegit false on its own.
MohammedRizwan commented:
low severity
Escalate. Unrelated to #63 - "IV Can be Decreased for Free."
The suggested impact here is "Contract will be reverted in some cases when users call Borrower#modify() function." which does not relate with the "IV Manipulation" issue this labelled a duplicate of.
The core elements of the valid issue are:
This issue refers to slot0
price manipulation and seemsLegit
, both of which are unrelated to the dupe issue. It should be considered a seperate issue with low severity.
Escalate. Unrelated to #63 - "IV Can be Decreased for Free."
The suggested impact here is "Contract will be reverted in some cases when users call Borrower#modify() function." which does not relate with the "IV Manipulation" issue this labelled a duplicate of.
The core elements of the valid issue are:
- depositing a large amount of liquidity into the active tick
- using this to decrease IV
This issue refers to
slot0
price manipulation andseemsLegit
, both of which are unrelated to the dupe issue. It should be considered a seperate issue with low severity.
You've created a valid escalation!
To remove the escalation from consideration: Delete your comment.
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
slot0
sqrtPriceX96¤tTick could be manipulated by depositing a large amount of liquidity.data
parameter here be used to calculate the iv
parameter here inside update
function.The modify
function is just one of the affected functions, the key is iv
could be manipulated with flashloan.
Just addressing the original submission, seemsLegit
is the TWAP oracle manipulation detection mechanism, and is designed to pause the modify
function when the price has deviated far from the current price in the recent pass. This is not a DOS, but a pause designed by the protocol as a safety mechanism.
The original submission does only describe the Borrower.modify()
function, the information that @yuliyu123 added 4 days ago is not contained in the original submission.
I agree with both @Banditx0x and @panprog (who judged this as invalid in the judging contest) that what is described in the original submission is intended behavior.
The added context from 4 days ago:
The modify function is just one of the affected functions, the key is iv could be manipulated with flashloan.
is correct. But this was not contained in the original submission and simply states again what the parent issue talks about.
Planning to accept the escalation, de-duplicate this issue from #63, and mark this issue as invalid.
Result: Invalid Unique
pks_
medium
Borrower#modify()
function may Dos in some casesSummary
Borrower#modify()
function may Dos in some cases.Vulnerability Detail
Factory#pause
is a public function, this function calledBorrower#getPrices()
and returnseemsLegit
parameter. IfseemsLegit
is false,getParameters[pool].pausedUntilTime
can be increased. ThepausedUntilTime
parameter is used inBorrower#modify()
function:as we can see, this function will revert if
seemsLegit
is false orblock.timestamp > pausedUntilTime
.The
Borrower#getPrices()
call trace is shown below:Borrower#getPrices() -> Borrower#_getPrices() -> ORACLE.consult(UNISWAP_POOL, oracleSeed)
the
lastWrites[pool]
parameter is updated inVolatilityOracle#update
function, one member oflastWrites
struct isiv
, this parameter is calculated byVolatility.estimate(cachedMetadata[pool], data, a, b, IV_SCALE)
function, and thedata
parameter returned byOracle#consult
function is get frompool.slot0()
. However,slot0()
is easy to manipulate in uniswap. So malicious user can monitor the mempool and can modifylastWrites[pool]
to makeseemsLegit = false
and increasepausedUntilTime
. Or when market volatility is great, theBorrower#modify()
is also reverted when user call this function.Impact
Contract will be reverted in some cases when users call
Borrower#modify()
function.Code Snippet
https://github.com/aloelabs/aloe-ii/blob/6fb1d96a1ad5a2913eefa476faf302bf5c4443ed/core/src/Borrower.sol#L478-L483 https://github.com/aloelabs/aloe-ii/blob/6fb1d96a1ad5a2913eefa476faf302bf5c4443ed/core/src/libraries/Oracle.sol#L45 https://github.com/aloelabs/aloe-ii/blob/6fb1d96a1ad5a2913eefa476faf302bf5c4443ed/core/src/VolatilityOracle.sol#L52-L89
Tool used
vscode, Manual Review
Recommendation
To make any calculation use a TWAP instead of slot0.