Submitted by WatchPug
https://github.com/code-423n4/2022-01-sandclock/blob/a90ad3824955327597be00bb0bd183a9c228a4fb/sandclock/contracts/strategy/NonUSTStrategy.sol#L66-L69
NonUSTStrategy will swap the deposited non-UST assets into UST before depositing to EthAnchor. However, the swap fee is not attributed to the depositor correctly like many other yield farming vaults involving swaps (ZapIn).
An attacker can exploit it for the swap fees paid by other users by taking a majority share of the liquidity pool.
The swap fee of depositing is not paid by the depositor but evenly distributed among all users.
Given:
The attacker can do the following:
If the vault happens to have enough balance (from a recent depositor), the attacker can now receive 1M of FRAX.
A more associated attacker may combine this with issue #160 and initiate a sandwich attack in step 3 to get even higher profits.
As a result, all other users will suffer fund loss as the swap fee is essentially covered by other users.
Consider changing the way new shares are issued:
In essence, the depositor should be paying for the swap fee and slippage.
CrisBRM (Sandclock) confirmed and disagreed with severity:
dmvt (judge) changed severity and commented:
