Target is hidden
This information is not publicly available.
Root cause: SolvencyEngine.worstCaseLoss() aggregates all debt and collateral within an ilk before applying max(debt - stressedRecoverable, 0). This lets surplus collateral belonging to a healthy independent vault cancel another vault's shortfall even though liquidation and settlement cannot seize that surplus for the other debt.
Exploit condition: An attacker holds USDR minted by a vault with positive stress shortfall while any unrelated vault of the same collateral type has enough excess collateral to make the per-ilk aggregate appear covered.
Impact: The false zero-loss result clears committed escrow and lets the attacker redeem RAIN-backed USDR for the full victim-funded stable reserve. The shielding vault remains safe and non-liquidatable, so its owner's collateral cannot cover the attacker debt.
Primary proof: pocs/RUSDR-004_cross_vault_loss_netting/artifacts/run_poc.txt
Weakness: Business Logic Errors (HackenProof) / Protocol insolvency / CWE-682: Incorrect Calculation
Severity: Critical under HackenProof Smart Contracts v2.0, which classifies direct theft and protocol insolvency as Critical.
Scope asset: https://github.com/hackenproof-public/rain-usdr-contracts/tree/bd6e03abe34936b7dbece2509b90457bd5c9b119
Affected:
rain-usdr-contracts commit bd6e03abe34936b7dbece2509b90457bd5c9b119, the revision pinned by the HackenProof scope asset.A PSM depositor first supplies 200 USDT to the reserve. The attacker then deposits 800 RAIN, opens a 400%-collateralized vault, mints 200 USDR, and exits it as transferable tokens. At the launch stress parameters, the attacker vault has 60 USDR of shortfall: 200 - (800 * 50% * 35%) = 60. This issuance remains within the 180-USDR threshold, so the exploit requires no prior breach or failure of the debt-issuance gate. The invariant commits 60 USDR and correctly rejects the attacker's attempt to redeem all 200 USDR because only 140 is free slack.
An unrelated user owns a healthy vault with 1,000 RAIN and 100 USDR of debt. Its individual shortfall is zero because stressed recovery is 175 USDR. Correct per-vault loss remains 60 + 0 = 60. The implementation instead aggregates both vaults into 300 debt and 1,800 collateral, then computes max(300 - 315, 0) = 0.
The attacker repeats the same redemption. The PSM calls checkInvariant(), accepts zero loss, clears committed escrow, and transfers all 200 USDT to the attacker. Under the modeled price shock, the honest vault remains safe and bark() rejects its liquidation, confirming that its collateral cannot cover the attacker's position. The reserve depositor retains 200 USDR against an empty reserve.
SolvencyEngine.worstCaseLoss() reads each ilk's aggregate globalArt and globalInk, calculates one aggregate recoverable value, and adds only the positive aggregate difference. Because max() is applied after aggregation, excess recoverable value in one vault offsets a shortfall in another.
VaultEngine.frob() stores collateral and debt per vaultId and checks each vault's safety independently. LiquidationTrigger.bark() likewise tests and seizes only the unsafe vault. It has no right to seize a healthy sibling's excess collateral.
Although the specification describes maximum loss as net, that netting must respect the vault boundaries through which collateral can actually repay debt. Aggregate custody does not make one owner's safe-vault surplus available for another owner's shortfall.
PegStabilityModule.buyStable() recomputes this understated loss immediately before redemption and trusts the resulting freeSlack. This turns the accounting error into a stable-reserve withdrawal.
Rain's USDR specification includes CDP shortfall risk in Stress-MaxLoss and promises that merely minting USDR against RAIN grants no access to committed escrow. Cross-vault netting violates both boundaries because collateral owned by a separate safe vault is not available to resolve the attacker's CDP shortfall.
The attacker receives all 200 USDT that another user supplied, while the reserve depositor retains 200 USDR and the attacker debt remains. Of that withdrawal, 140 USDT was already free slack; the faulty netting releases the additional 60 USDT that the control proves must remain committed, and this final withdrawal empties the reserve despite the shortfall. At the shipped 50% markdown and 35% depth factors, a same-ilk vault begins contributing excess stressed recovery above approximately 1 / (0.5 * 0.35) = 5.71x collateralization, only about 1.43 times the 400% minimum; the PoC uses a 10x shielding vault. The attacker neither controls nor risks the honest shielding collateral. The amount at risk scales to the stable reserve and the configured volatile debt ceilings.
Compute volatile CDP shortfall per vault and then sum the positive shortfalls:
loss[ilk] = sum_vault max(vaultDebt - stressedRecoverable(vaultCollateral), 0)
Do not apply the positive-part operation only after aggregating vaults. Since iterating every vault on chain is unbounded, maintain an incrementally updated risk accumulator or a conservative bucketed structure during frob, grab, liquidation, and settlement transitions. Add regression coverage with two same-ilk vaults whose aggregate shortfall is zero but whose per-vault shortfall sum is positive.
The bundle is in pocs/RUSDR-004_cross_vault_loss_netting/. run.sh fetches the exact scope commit, verifies the checked-out HEAD, installs exact @openzeppelin/[email protected], copies CrossVaultLossNettingPoC.t.sol into the test directory, and runs only test_crossVaultNettingReleasesReserveCommittedToAnotherVault under Foundry 1.5.1.
unzip RUSDR-004_cross_vault_loss_netting.zip
cd RUSDR-004_cross_vault_loss_netting
./run.sh --preflight
./run.sh
[PASS] test_crossVaultNettingReleasesReserveCommittedToAnotherVault(), then Control: isolated attacker loss is 60 USDR and blocks the 200-USDT redemption., Exploit: unrelated excess collateral erases reported loss and the same redemption succeeds., Impact: the reserve reaches zero although the honest shield vault cannot cover attacker debt., and RESULT: PASS. Use ./run.sh --verbose or ./run.sh --full-output for full diagnostics.run.sh removes its unique temporary checkout automatically on success, failure, and interruption. It starts no service, container, local chain process, or live target session.RUSDR-004_cross_vault_loss_netting.zip - complete deterministic PoC bundle for upload.pocs/RUSDR-004_cross_vault_loss_netting/artifacts/run_poc.txt - primary proof with the native Foundry pass and emitted state deltas.pocs/RUSDR-004_cross_vault_loss_netting/CrossVaultLossNettingPoC.t.sol - exploit and control test against the pinned contracts.pocs/RUSDR-004_cross_vault_loss_netting/artifacts/control_comparison.txt - concise expected-versus-vulnerable boundary comparison.
Comments are hidden
This information is not publicly available.