57510 sc high stale locked collateral tracking during price appreciation causes disproportionate redemption losses
Description
Brief/Intro
Vulnerability Details
function _sync(uint256 tokenId) internal {
Account storage account = _accounts[tokenId];
// STEP 1: Calculate collateral removal based on STALE rawLocked
uint256 collateralToRemove = PositionDecay.ScaleByWeightDelta(
account.rawLocked, // ← Stale value from old price
_collateralWeight - account.lastCollateralWeight
);
account.collateralBalance -= collateralToRemove;
// STEP 2: Process redemptions and debt updates
// ... redemption logic ...
// STEP 3: Update rawLocked to reflect current price (TOO LATE)
account.rawLocked = convertDebtTokensToYield(account.debt)
* minimumCollateralization / FIXED_POINT_SCALAR;
// Update checkpoints
account.lastCollateralWeight = _collateralWeight;
// ...
}Impact Details
mitigation
Proof of Concept
Proof of Concept
Previous56442 sc high inflated totallocked because vault yield accrual would skew collateralweight calculationNext57745 sc high syn fails to update the rawlocked valuation leading to a loss of fund for users with rawlock 0 when total lock become 0
Was this helpful?