Open sherlock-admin opened 1 year ago
We consider this issue as a medium severity issue, because the cost of an attacker to benefit from this vulnerability and steal some token1 as expensive. The attacker needs to provide the equivalent amount of token0.
The calculated amount to supply the token mismatched the actually supplied amount depends on the ticker range and the over-charged part from user fund is lost, recommend maintaining the high severity.
Escalate
Apart from #142
The issues #65 #118 #149 and #269 are not duplicates of this issue.
Regardless on their own validity, the mitigation is different, pointing to different root causes.
Emm You may need to edit from "Escalate for 10 USDC" to "Escalate" in the comments.
Escalate
Apart from #142
The issues #65 #118 #149 and #269 are not duplicates of this issue.
Regardless on their own validity, the mitigation is different, pointing to different root causes.
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.
The calculated amount to supply the token mismatched the actually supplied amount depends on the ticker range and the over-charged part from user fund is lost, recommend maintaining the high severity.
Should be medium considering high is defined as "This vulnerability would result in a material loss of funds, and the cost of the attack is low (relative to the amount of funds lost)."
Escalate
This is a medium severity issue. The miscalculation won't cause a loss of funds since the wrong amount will be rejected by the underlying Uniswap pool. Also, the protocol has robust slippage protections, which won't allow users to deposit more tokens than required.
All in all, the issue doesn't demonstrate an attack scenario, or a scenario when users lose significant funds, thus it cannot have a high severity.
Escalate
This is a medium severity issue. The miscalculation won't cause a loss of funds since the wrong amount will be rejected by the underlying Uniswap pool. Also, the protocol has robust slippage protections, which won't allow users to deposit more tokens than required.
All in all, the issue doesn't demonstrate an attack scenario, or a scenario when users lose significant funds, thus it cannot have a high 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.
After reading the escalation, seems like the severity is medium
When the current price is equal to the left boundary of the range, the uniswap pool will request both token0 and token1, but arrakis will only request from the user token0 so the pool will lose some token1 if it has enough to cover it.
this does cause protocol to lose fund because the protocol's fund instead of user's fund is used to add liquidity.
but mainly because the attacker not able to leverage this bug to steal fund and the pre-condition:
current price is equal to the left boundary of the range
Recommend changing severity from high to medium
I will adress 0xRobocoop's escalation seperately
we agree that this issue is medium.
Result: Medium Has duplicates Accepting both escalations. This is a valid medium issue. and only #142 is the duplicate
We replace it with strict inequality here. PR: https://github.com/ArrakisFinance/v2-core/pull/159
Fix looks good. Now uses <
instead of <=
0xRobocop
medium
Then getAmountsForDelta function at Underlying.sol is implemented incorrectly
Summary
The function
getAmountsForDelta()
at theUnderlying.sol
contract is used to compute the quantity oftoken0
andtoken1
to add to the position given a delta of liquidity. These quantities depend on the delta of liquidity, the current tick and the ticks of the range boundaries. Actually,getAmountsForDelta()
uses the sqrt prices instead of the ticks, but they are equivalent since each tick represents a sqrt price.There exists 3 cases:
token0
should be added.token0
andtoken1
should be added.token1
should be added.Vulnerability Detail
The issue on the implementation is on the first case, which is coded as follows:
The implementation says that if the current price is equal to the price of the lower tick, it means that it is outside of the range and hence only
token0
should be added to the position.But for the UniswapV3 implementation, the current price must be lower in order to consider it outside:
Reference
Impact
When the current price is equal to the left boundary of the range, the uniswap pool will request both
token0
andtoken1
, but arrakis will only request from the usertoken0
so the pool will lose sometoken1
if it has enough to cover it.Code Snippet
https://github.com/sherlock-audit/2023-06-arrakis/blob/main/v2-core/contracts/libraries/Underlying.sol#LL311-L318
Tool used
Manual Review
Recommendation
Change from:
to: