FraxFinance / dev-fraxswap

Fraxswap for Fraxtal
0 stars 0 forks source link

bug[low]: No validations of `FraxswapStepData.pool` can lead to unrestricted external calls #11

Closed pegahcarter closed 7 months ago

pegahcarter commented 7 months ago

Description

Within a FraxswapRoute, a caller can pass in an array of FraxswapStepData, each of which gives a specific execution path. If FraxswapStepData.swapType < 2, there are several unverified external calls on FraxswapStepData.pool. A caller can pass in their own contract as a pool and exit the intended logic gates.

Impact

Low - worst case scenario (that I can think of) is an attacker can drain the Multihop of any residual tokens (which there shouldn't be).

Recommendation

Add a PairFactory call to ensure that the pool was created from the PairFactory.

@denett

denett commented 7 months ago

This is the intended setup. There can be arbitrary calls to arbitrary contracts during a swap to be super flexible. To be safe, the router must have the following security properties: