Arbitrary ERC20 tokens can be passed as assets[0].
With a transfer, the received amount should be calculated every time to take into consideration a possible fee-on-transfer or deflation.
Also, it's a good practice for the future of the solution.
Recommended Mitigation Steps
Use the balance before and after the transfer to calculate the received amount instead of assuming that it would be equal to the amount passed as a parameter in the IERC20(assets[0]).transferFrom(address(LP_VAULT), address(this), amountOwing) call.
Lines of code
https://github.com/code-423n4/2022-04-dualityfocus/blob/main/contracts/vault_and_oracles/FlashLoan.sol#L57-L58
Vulnerability details
Impact
Wrong
amountOwing
approvedProof of Concept
Arbitrary ERC20 tokens can be passed as
assets[0]
. With a transfer, the received amount should be calculated every time to take into consideration a possible fee-on-transfer or deflation. Also, it's a good practice for the future of the solution.Recommended Mitigation Steps
Use the balance before and after the transfer to calculate the received amount instead of assuming that it would be equal to the amount passed as a parameter in the
IERC20(assets[0]).transferFrom(address(LP_VAULT), address(this), amountOwing)
call.