Submitted by WatchPug, also found by cmichel and jonah1005
The total balance should NOT be simply added from different tokens tokenAmounts, considering that the price of tokens may not be the same.
Vault.sol L324
Controller.sol L396
Vault.sol L310
An attacker can steal funds from multi-token vaults. Resulting in fund loss of all other users.
If there is a multi-token vault with 3 tokens: DAI, USDC, USDT, and their price in USD is now 1.05, 0.98, and 0.95. If the current balances are: 2M, 1M, and 0.5M.
An attacker may do the following steps:
As 2M of DAI + 1M of USDC worth much more than 3M of USDT. The attacker will profit and all other users will be losing funds.
Always consider the price differences between tokens.
BobbyYaxis (yAxis) acknowledged
GalloDaSballo (judge) commented:
BobbyYaxis (yAxis) noted:
