# boostedValue should be added to permanentTotalSupply for permanently locked tokens

Fenix VotingEscrow omits boostedValue from permanentTotalSupply, so the last permanent locker's unlockPermanent reverts on underflow, locking their FNX.

- Payout: Audit contest
- Severity: medium
- Program: Fenix Finance
- Found by: KupiaSec
- Disclosed: 2024-10-11
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-09-fenix-finance-findings/issues/11
- Library page: https://bugbountylibrary.com/r/c4%3A2024-09-fenix-finance%3AM-04
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:dos

**Target:** VotingEscrowUpgradeableV2.sol (_processLockChange / unlockPermanent)
**Root cause:** _processLockChange adds boostedValue to newLocked.amount but only adds amount_ to permanentTotalSupply for permanent locks, so permanentTotalSupply under-accounts boosted amounts; unlockPermanent subtracts the full locked amount, underflowing.
**Steps:**
1. Alice and Bob each lock 100 FNX for 1 week (< getMinLockedTimeForBoost).
2. Both permanently lock: permanentTotalSupply = 200.
3. Alice deposits 1000 FNX (>= getMinFNXAmountForBoost) with _boostFNXPercentage 1000 (10%): boostedValue=100, locked amount=1200, permanentTotalSupply=1200.
4. Alice calls unlockPermanent: permanentTotalSupply = 1200 - 1200 = 0.
5. Bob calls unlockPermanent: `permanentTotalSupply -= state.locked.amount` underflows and reverts.
**How found:** Code reading of _processLockChange vs unlockPermanent accounting: noticed boostedValue added to locked amount at L465 but not to permanentTotalSupply at L470, then traced the subtraction at L219 to an underflow.
**Exploitation:** Any user who permanently locks and then receives a boost inflates their locked amount without inflating permanentTotalSupply; when they unlock, permanentTotalSupply is drained to zero, causing subsequent unlockPermanent calls to revert on underflow. Last permanent locker cannot unlock.
**Insight:** When a boost/reward value is folded into a user's locked balance, check every aggregate supply counter that the unlock path subtracts from; asymmetric accounting between per-user amount and global supply yields underflow DoS on the last withdrawer.

