When unwinding a leveraged position, the contract repays Aave debt via flash loan, then calculates how much collateral to withdraw. The formula derives collateral from the debt-to-collateral ratio: collateralValue = debtValue / ratio, where the ratio comes from Aave's reserve configuration.
The contract fetches getReserveConfigurationData(unwindParams.collateralToken) and uses the 3rd return value (liquidationThreshold, stored as liqThreshold) in the denominator of the collateral withdrawal formula. The denominator is collateralTokenPrice * (10 ** debtDecimals) * liqThreshold.
There is no validation that liqThreshold > 0. If Aave returns 0 for the liquidation threshold, the division numerator / (denom * 0) reverts with a division-by-zero error. The unwind fails inside the flash loan callback, causing the entire transaction to revert.
The open flow (calculateOpenParams, line 386) correctly guards against this by using require(ltv > 0, "Asset not usable as collateral") when fetching LTV. The unwind flow has no equivalent check for liqThreshold.
Location: src/Stratax.sol:574-588
Likelihood (low):
Aave reserves are typically configured with non-zero liquidation threshold (e.g. 8500 = 85% for ETH).
A zero liquidation threshold could occur if: (1) a reserve is newly added and misconfigured, (2) Aave admin sets it to 0 to disable collateral usage, (3) a future Aave upgrade changes default behavior, or (4) the protocol integrates with a fork or alternative deployment with different config.
Impact (medium):
The revert occurs inside executeOperation, the Aave flash loan callback. The flash loan has already been disbursed; the revert causes the entire callback to fail, so the flash loan is not repaid and the whole transaction reverts.
The unwind cannot be executed. The position remains leveraged; the owner cannot close it until Aave config is fixed or a workaround is deployed.
Severity (low):
Add an explicit guard before the division. When fixing finding 006 (use LTV instead of liqThreshold), include the same guard for LTV:
Note: Per finding 006, the correct fix is to use ltv instead of liqThreshold in the formula. The same require(ltv > 0, "Asset not usable as collateral") guard should be added, matching the open flow at line 387.
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.