Users can initiate swaps with USD amounts smaller than the base fee, causing refund attempts to revert and permanently locking funds.
The StabilityBranch::initiateSwap
function lacks validation that amountsIn[i] >= baseFeeUsd
. When combined with refundSwap's
unsafe subtraction:
This creates an underflow risk if baseFeeUsd > depositedUsdToken
, making refunds impossible and trapping funds indefinitely.
Proof of Concept:
Base fee configured to 10 USD
User initiates swap with 5 USD (amountIn = 5)
Request expires normally
refundSwap attempts 5 - 10 = underflow revert
5 USD permanently stuck in contract
Permanent loss of user funds
Requires admin intervention to recover
Violates core protocol safety guarantees
Manual Review
Foundry
Add validation in StabilityBranch::initiateSwap
:
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.