code-423n4 / 2021-04-marginswap-findings

1 stars 0 forks source link

Missing checks if pairs equal tokens #29

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Email address

mail@cmichel.io

Handle

@cmichelio

Eth address

0x6823636c2462cfdcD8d33fE53fBCD0EdbE2752ad

Vulnerability details

The UniswapStyleLib.getAmountsOut, PriceAware.setLiquidationPath (and others) don't check that path.length + 1 == tokens.length which should always hold true. Also, it does not check that the tokens actually match the pair.

Impact

It's easy to set faulty liquidation paths which then end up reverting the liquidation transactions.

Recommended mitigation steps

Add the missing checks.