Vault: Swaps at parity with swap fee = withdrawal fee
The vault treats all assets as equal in price, allowing users to deposit and withdraw in the same transaction to swap funds at parity, paying only the 0.1% withdrawal fee as a swap fee. This could be exploited for arbitrage, especially with off-peg stablecoins.
Submitted by hickuphh3
Impact
The vault treats all assets to be of the same price. Given that one can also deposit and withdraw in the same transaction, this offers users the ability to swap available funds held in the vault at parity, with the withdrawal protection fee (0.1%) effectively being the swap fee.
Due care and consideration should therefore be placed if new stablecoins are to be added to the vault (eg. algorithmic ones that tend to occasionally be off-peg), or when lowering the withdrawal protection fee.
Recommended Mitigation Steps
- Prevent users from depositing and withdrawing in the same transaction. This would help prevent potential flash loan attacks as well
setWithdrawalProtectionFee()could have a requirement for the value to be non-zero. Zero withdrawal fee could be set insetHalted()whereby only withdrawals will be allowed.- Use price oracles to accurately calculate the shares to be transferred to users for deposits, or token amounts to be sent for withdrawals
GalloDaSballo (judge) commented:
Agree with finding, this vault accounting can be used for arbitrage opportunities as tokens are treated at exact value while they may have imbalances in price
This is not a duplicate as it’s explaining a specific attack vector
GalloDaSballo (judge) commented:
Also raising risk valuation as this WILL be used to extract value from the system
BobbyYaxis (yAxis) noted:
We have mitigated by deploying vaults that only accept the Curve LP token itself used in the strategy. There is no longer an array of tokens accepted. E.g Instead of a wBTC vault, we have a renCrv vault. Or instead of 3CRV vault, we have a mimCrv vault. The strategy want token = the vault token.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the vault's accounting treats all supported tokens as having equal value without using price oracles, enabling parity swaps.
Impact
Attackers could extract value from the system through arbitrage, especially if tokens are off-peg or the withdrawal fee is lowered.
What the attacker needed
Vault accepts multiple tokens; ability to deposit and withdraw in same transaction
The fix
The project mitigated by deploying vaults that only accept the specific Curve LP token used in the strategy, removing the array of accepted tokens.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A vault lets people deposit different tokens and later withdraw them. The vault assumes all tokens are worth the same, so someone can put in one token and immediately take out another, effectively swapping them for a tiny fee. This can be abused to profit if the tokens' real prices differ.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.