Shadow Arena #012: Lybra Finance V2
Lybra V2 is a Liquity-architecture-adjacent CDP, but the collateral is stETH and the rebase makes everything harder. The protocol issues eUSD against LSD collateral (stETH, wstETH, rETH, wbETH) with CR-gated mint/burn/liquidate/redeem flows that mirror Liquity invariants, plus a non-rebasing peUSD twin for cross-chain use. The Code4rena audit found 31 unique High and Medium vulnerabilities in 1,762 SLOC — the densest finding-per-LoC ratio of any of the Liquity-family forks. The lesson: you built single-collateral ETH Liquity V1. What happens when you swap in stETH and the collateral itself silently rebases under you? Every assumption the Stability Pool's P/S decay made about a non-rebasing balance breaks, every share-vs-supply invariant gets a new attacker path, and the rigidRedemption primitive (Lybra's redeemCollateral analogue) ends up using a different collateral ratio formula than liquidate. (License footnote: the Code4rena snapshot does not contain a top-level LICENSE file. Upstream LybraV2 must be checked before publishing the Shadow Arena fork — the public audit grants reproduction rights for educational use of the findings themselves.)
Scope (1762 SLOC)
| File | SLOC |
|---|---|
| contracts/lybra/pools/LybraStETHVault.sol | 63 |
| contracts/lybra/pools/LybraWstETHVault.sol | 60 |
| contracts/lybra/pools/LybraRETHVault.sol | 65 |
| contracts/lybra/pools/LybraWbETHVault.sol | 60 |
| contracts/lybra/pools/base/LybraEUSDVaultBase.sol | 180 |
| contracts/lybra/pools/base/LybraPeUSDVaultBase.sol | 185 |
| contracts/lybra/token/EUSD.sol | 174 |
| contracts/lybra/token/PeUSDMainnetStableVision.sol | 118 |
| contracts/lybra/configuration/LybraConfigurator.sol | 183 |
| contracts/lybra/pools/ProtocolRewardsPool.sol | 155 |
| contracts/lybra/miner/EUSDMiningIncentives.sol | 193 |
| contracts/lybra/governance/LybraGovernance.sol | 111 |
Documentation
Part of the Liquity V1 Path
This shadow audit connects to the Liquity V1 Build module. Students who built the CDP protocol have an advantage because they understand Trove accounting, Stability Pool P/S decay, redistribution liquidations, and redemption-driven peg mechanics.
View Build Module