Stratax::getMaxLeverage computes the theoretical maximum leverage using the geometric series formula 1 / (1 - LTV). Scaled to integer arithmetic, the correct formula is (LEVERAGE_PRECISION * LTV_PRECISION) / (LTV_PRECISION - ltv). The result is used to validate that desiredLeverage does not exceed the physical maximum for a given collateral asset.
The implementation uses LEVERAGE_PRECISION twice in the numerator instead of LEVERAGE_PRECISION * LTV_PRECISION. Because both constants are currently equal to 1e4, the bug produces the correct result by coincidence. If either constant is changed in a future refactor, getMaxLeverage will silently overstate the maximum leverage by a factor of LEVERAGE_PRECISION / LTV_PRECISION, allowing the leverage validation check to be bypassed.
Likelihood:
LEVERAGE_PRECISION is increased for finer leverage granularity (e.g. to 1e6) while LTV_PRECISION stays at 1e4 — a common precision refactor in DeFi protocols.
Either constant is changed independently during an upgrade, since their equality is not enforced or documented as an invariant.
Impact:
The require(details.desiredLeverage <= maxLeverage) check in _validateAndCalculatePosition passes for physically impossible leverage values, allowing positions that Aave cannot support to be submitted.
The flash loan amount calculated from the oversized leverage causes the Aave pool call to fail or results in an immediately liquidatable position, with the user losing funds to liquidation penalties.
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.
The contest is complete and the rewards are being distributed.