Cannot withdraw RDPX if WETH withdrawn is zero
The VaultLP contract prevents share redemption when the calculated WETH withdrawal amount is zero, even if the user is entitled to RDPX compensation. An attacker could not directly exploit this, but depositors could lose their entire WETH deposit and receive no RDPX if the vault's WETH collateral is fully replaced by RDPX after options settlement.
Submitted by gjaldon, also found by Toshii, QiuhaoLi, Evo, Yanchuan, peakbolt, tapir, HChang26, and rvierdiiev
VaultLP does not allow redemption of shares when it leads to 0 WETH being withdrawn. VaultLP can end up in a state where it has a small amount of WETH and most of its reserves is in RDPX instead. This can happen when most of its WETH is locked as collateral for Put Options and all these Put Options were exercised/settled due to RDPX price dropping.
In this state, many depositors in the LP who have lost their WETH will not even be able to redeem their shares for the RDPX compensation.
Proof of Concept
The following steps will reproduce the issue:
- Depositors
deposit()100_000e18WETH toVaultLP. RdpxV2Corepurchased so many options (since so many users were bonding) that it locked up all100_000e18WETH collateral as backing for all the options.- RDPX price dropped so much that all the Put Options had to be
settled()to bring dpxETH peg back up. This replaces all the100_000e18WETH with RDPX. - Since total WETH collateral of
VaultLPis now 0, none of the depositors canredeem()their shares due to this check:
require(assets != 0, "ZERO_ASSETS");
The above check will always fail since the computation for assets looks like:
shares.mulDivDown(totalCollateral(), supply)
totalCollateral() will return 0 because there is no WETH collateral left in the VaultLP. So the above computation will be shares * 0 / supply which will always equal 0. So even if the depositor has 1_000e18 shares and a lot of RDPX they are supposed to be able to withdraw, they will not be able to. In effect, they would lose 100% of their WETH deposited into VaultLP and get zero RDXP in compensation.
Recommended Mitigation Steps
The validation in redeem() can be replaced with the following:
require((assets + rdpxAmount) != 0, "ZERO_ASSETS");
That way, as long as there is any amount of RDPX or WETH they can withdraw, they will be able to do so.
psytama (Dopex) confirmed and commented:
Modify
requirein theredeemfunction.
Alex the Entreprenerd (Judge) decreased severity to Medium and commented:
The finding is valid in that 0 weth will revert.
But the scenario seems to be extreme, thinking Med due to reliance on external condition.
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
The redeem function requires the calculated WETH amount to be non-zero, ignoring any RDPX compensation that should also be paid out.
Impact
Depositors could lose 100% of their WETH and receive zero RDPX compensation because redemption is blocked when WETH withdrawal amount is zero.
What the attacker needed
Depositors have shares in VaultLP; WETH collateral fully replaced by RDPX
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.
This is a smart contract bug where a check stops users from withdrawing their funds if the amount of one token (WETH) they would get is zero, even though they should still receive another token (RDPX) as compensation. So if the vault runs out of WETH, users cannot get anything back, losing their deposit.
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.