An underflow vulnerability exists in the Invariable:getTokenEntitlementsAndBalances
function, specifically in the line entitlements[i] += (s.sys.fields[j].harvestable - s.sys.fields[j].harvested);
. This can occur if s.sys.fields[j].harvestable
is less than s.sys.fields[j].harvested
, leading to an underflow in subtraction, which can cause incorrect entitlement calculations.
See the following code:
The transaction will revert if underflow occurs, causing a DoS condition for any function relying on this calculation.
Manual Review
To mitigate this vulnerability, implement checks to ensure that harvestable is always greater than or equal to harvested before performing the subtraction.
Invalid as per docs https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.