Submitted by hickuphh3, also found by 0xDjango, cccz, JMukesh, and Ruhum
LibSwap.sol#L29-L58
It is probable for _swapData.fromAmount to be greater than the actual amount used (eg. when swapping for an exact output, or when performing another swap after swapping with an exact input). However, these funds arent returned back to the user and are left in the lifi contract.
AnyswapFacet.test.ts#L153-L194
The test referenced above swaps for MATIC for 1000 USDT exactly. Logging the matic amounts before and after the swap and bridge call, one will find 18.01 MATIC is unused and left in the contract when it should be returned to the user.
Store the contracts from balance before and after the swap. Refund any excess back to the user.
This comes with the requirement that the funds for every swap should be pulled from the user.
H3xept (Li.Fi) resolved and commented:
maxklenk (Li.Fi) disagreed with High severity and commented:
gzeon (judge) decreased severity to Medium and commented:
