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

1 stars 0 forks source link

`getReserves` does not check if tokens match #30

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.getReserves function does not check if the tokens are the pair's underlying tokens. It blindly assumes that the tokens are in the wrong order if the first one does not match but they could also be completely different tokens.

Impact

It could be the case that output amounts are computed for completely different tokens because a wrong pair was provided.