The initiateSwap
function incorrectly assumes that all vaults in the vaultIds
array share the same collateral price. It initializes ctx.collateralPriceX18
using the first vault's price and reuses it for all swaps in the batch, potentially leading to incorrect asset calculations.
The function sets ctx.collateralPriceX18
once before the loop using the first vault’s price (vaultIds[0]
), this can lead to underpriced or overpriced swaps, depending on how the price of the first vault differs from the others.
A malicious user could manipulate the vault order in vaultIds to use a lower price vault first, allowing them to receive more collateral than expected when swapping from a higher-price vault.
Update ctx.collateralPriceX18
inside the loop to ensure each vault uses its correct collateral price:
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.