Closed sherlock-admin2 closed 1 year ago
1 comment(s) were left on this issue during the judging contest.
Trumpero commented:
invalid, this function used to config the mapping
feeAmountTickDistance
to set the value tickDistance corresponding to each value of fee
JP_Courses
medium
Factory::enableSwapFee() - L152: no zero amount check for
swapFeeUnits
.Summary
Factory::enableSwapFee() - L152: no zero amount check for
swapFeeUnits
.Vulnerability Detail
https://github.com/sherlock-audit/2023-07-kyber-swap/blob/main/ks-elastic-sc/contracts/Factory.sol#L152-L164
Currently it is totally possible to assign zero value to
swapFeeUnits
successfully via the enableSwapFee() functions. It will pass the require checks. Unless it is intended functionality(which I doubt), meaning that it should be possible/acceptable to setswapFeeUnits = 0
, there should be a check to ensure zero value cannot be assigned toswapFeeUnits
.Impact
At least no swap fees, possibly impacting other areas of protocol.
Code Snippet
https://github.com/sherlock-audit/2023-07-kyber-swap/blob/main/ks-elastic-sc/contracts/Factory.sol#L152-L164
Tool used
VSC. Manual Review
Recommendation
There should be a check to ensure zero value cannot be assigned to
swapFeeUnits
: Add the following above L157: