RageTrade senior vault USDC deposits are subject to utilization caps which can lock deposits for long periods of time leading to UXD instability
The RageTrade senior vault enforces a utilisation cap that blocks withdrawals once loans to the junior vault exceed a set share of deposits. If UXD depegs, a large part of the collateral backing it could be stuck in the vault and impossible to withdraw.
Source: https://github.com/sherlock-audit/2023-01-uxd-judging/issues/253
Found by
0xNazgul, 0x52, ctf_sec, clems4ever
Summary
RageTrade senior vault requires that it maintains deposits above and beyond the current amount loaned to the junior vault. Currently this is set at 90%, that is the vault must maintain at least 10% more deposits than loans. Currently the junior vault is in high demand and very little can be withdrawn from the senior vault. A situation like this is far from ideal because in the even that there is a strong depeg of UXD a large portion of the collateral could be locked in the vault unable to be withdrawn.
Vulnerability Detail
function beforeWithdraw(
uint256 assets,
uint256,
address
) internal override {
/// @dev withdrawal will fail if the utilization goes above maxUtilization value due to a withdrawal
// totalUsdcBorrowed will reduce when borrower (junior vault) repays
if (totalUsdcBorrowed() > ((totalAssets() - assets) * maxUtilizationBps) / MAX_BPS)
revert MaxUtilizationBreached();
// take out required assets from aave lending pool
pool.withdraw(address(asset), assets, address(this));
}
DnGmxSeniorVault.sol#beforeWithdraw is called before each withdraw and will revert if the withdraw lowers the utilization of the vault below a certain threshold. This is problematic in the event that large deposits are required to maintain the stability of UXD.
Impact
UXD may become destabilized in the event that the senior vault has high utilization and the collateral is inaccessible
Code Snippet
Tool used
Manual Review
Recommendation
I recommend three safeguards against this:
- Monitor the current utilization of the senior vault and limit deposits if utilization is close to locking positions
- Maintain a portion of the USDC deposits outside the vault (i.e. 10%) to avoid sudden potential liquidity crunches
- Create functions to balance the proportions of USDC in and out of the vault to withdraw USDC from the vault in the event that utilization threatens to lock collateral
Discussion
WarTech9
Possible usecase for insurance fund.
acamill
This is the main downside of using not fully liquid strategies for the ALM model, upside being higher yield. We can mitigate this issue with buffers but that's always an issue, and adding buffers with either protocol funds or insurance fund is equivalent to using lower yield strategies, as such not an ideal solution either. (and it add complexity)
My personal opinion is to keep the cap on the illiquid strategy to be low enough relative to the total circulating UXD, that way keeping the high yield but reducing the liquidity crunch issue. That's what we are currently doing on Solana, working on smarter rebalancing and better risk management to keep these cap relevant.
WarTech9
As Alex pointed out, this is a known limitation to using a semi-liquid strategy. We will be addressing it in the long term but do not intend to fix as part of the audit.
IAm0x52
Sponsor has acknowledged this limitation
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 withdrawal guard reverts whenever a withdrawal would push borrowing above the maximum utilisation ratio, with no buffer or rebalancing path to free funds.
Impact
UXD could become destabilised if the senior vault has high utilisation and its collateral cannot be withdrawn; the sponsor acknowledged this as a known limitation rather than fixing it.
What the attacker needed
High junior vault borrowing demand; UXD depeg or liquidity crunch
The fix
The sponsor said it would not fix this during the audit; the recommendation was to monitor utilisation, keep part of the USDC outside the vault and add rebalancing functions.
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 holds users' deposits and lends part of them out. To stay safe it refuses withdrawals that would push lending above a fixed share of deposits. Here that rule can trap most of the money when borrowers take a lot, so the stablecoin relying on it may not be able to pay people back.
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.