# UNCX VestingManager: share double-debit drains pooled vesting tokens

UNCX VestingManager double-debits global share count in release/cancel, letting a flash-loaned attacker inflate payout fraction and drain ~88K USD of other vesters' tokens across five ERC-20s.

- Payout: Real-world hack
- Severity: critical
- Program: UNCXSmartTokenVesting
- Analysis by: DeFiHackLabs
- Disclosed: 2026-10-14
- Write-up quality: 9/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2026-10/UNCXSmartTokenVesting_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20261014-uncxsmarttokenvesting
- Tags: area:web3 domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:critical tech:evm tech:solidity technique:chained technique:source-review vuln:accounting-error vuln:business-logic vuln:flash-loan vuln:oracle-manipulation

**Target:** VestingManager
**Root cause:** release() pays a slice of the entire shared pool balance divided by a global _totalTokenShares denominator, and both release() and cancel() debit that same global share count for the same position shares (release leaves _depositedShares intact, cancel ignores schedule.released), so the denominator can be driven below the shares actually backing the pool.
**Steps:**
1. Flash-borrow target token (Uniswap V3 flash for EDGEN, V2 flash swap for pepecoin/PAAL, V4 unlock/take/settle for ZC/LO0P).
2. `createVesting` a payout vesting with tranches ending at T2=1791992998 (one second before fork timestamp 1791992999) so it is fully vested immediately.
3. `createVesting` one or two soft+topable helper vestings with elapsed tranches.
4. `release` the helper vestings to debit `_totalTokenShares` while leaving `_depositedShares` intact.
5. Optionally `transfer` spare token directly into the VestingManager to inflate `balanceOf(address(this))`.
6. `topUpVesting` the helpers then `cancel` them, double-debiting the same shares from `_totalTokenShares` and shrinking the denominator.
7. `release` the payout vesting: `amount = releasableShares * balance / _totalTokenShares` now over-pays against the corrupted denominator and inflated balance.
8. Repay flash loan in same leg; retained profit is the over-withdrawn backing tokens of other vesters.
**How found:** Read the verified VestingManager source and noticed release() computes payout from the whole contract balance over a global share denominator rather than the position's own deposit, and that release() never reduces _depositedShares while cancel() recomputes sharesToRemove ignoring schedule.released — a double-debit of the same shares. Combined with the observation that tranches with past timestamps vest instantly, this yields a permissionless denominator-shrinking drain.
**Exploitation:** Permissionless: attacker EOA 0x78C9...f5B3 deployed exploit contract 0xf6D0...C35E, flash-borrowed each of five tokens, created self-owned instantly-vested positions, released+cancelled helper vestings to shrink the global share denominator while donating token to inflate the pool balance, then released a payout vesting to over-withdraw other vesters' backing tokens, repaying each flash loan in the same leg and retaining ~85.6K USD net.
**Escalation:** Repeated the same share-corruption primitive across five different ERC-20s (EDGEN, ZC, pepecoin, LO0P, PAAL) using three different flash-loan sources to scale total extraction to ~88-89K USD.
**Insight:** When a contract pools all deposits of an asset and pays out proportional to a global share counter, audit every path that mutates that counter for asymmetric debits — release-then-cancel pairs that each subtract the same shares are a classic denominator-corruption primitive, and any vesting/streaming contract that trusts caller-supplied tranche timestamps lets you mint instantly-releasable positions.

## Proof of concept (copied exactly from the original report)

**Exploit contract attack() entry with flash-loan constants**

```
contract UNCXVestingExploit {
    address internal constant VM = 0xA98F06312b7614523d0f5e725e15fd20fB1b99F5;

    address internal constant EDGEN = 0xAa9806c938836627Ed1a41Ae871c7E1889AE02Ca;
    address internal constant ZC = 0x4E67DB19044549fF420860834c91b45BaD298722;
    address internal constant PEPE = 0xA9E8aCf069C58aEc8825542845Fd754e41a9489A; // "pepecoin"
    address internal constant LOOP = 0x00000000000050806673B532D7486ac114c1De3F; // "LO0P"
    address internal constant PAAL = 0x14feE680690900BA0ccCfC76AD70Fd1b95D10e16; // "$PAAL"

    address internal constant UNIV3_EDGEN = 0x4B2C930F88a87D1BfFaC291b6a7e01c9F13dD03e;
    address internal constant UNIV2_PEPE = 0xDDd23787a6B80A794d952f5fb036D0b31A8E6aff;
    address internal constant UNIV2_PAAL = 0x2a6c340bCbb0a79D3deecD3bc5cBc2605ea9259f;
    address internal constant UNIV4_PM = 0x000000000004444c5dc75cB358380D2e3dE08A90;

    uint256 internal constant EDGEN_BORROW = 131_769_607_356_179_331_729_743_626;
    uint256 internal constant PEPE_BORROW = 531_437_174_022_481_383_511_735;
    uint256 internal constant PAAL_BORROW = 494_701_979_586_570;
    uint256 internal constant ZC_TAKE = 47_059_196_744_096_272_543_282_784;
    uint256 internal constant LOOP_TAKE = 280_857_955_066_472_266_672_982;

    uint256 internal constant FLAT_FEE = 0.05 ether;

    // Create tranche end-points: both one second on either side of the fork timestamp so the
    // second (cumulative) point is already fully vested. Top-up points are pushed into the future.
    uint256 internal constant T1 = 1_791_992_997;
    uint256 internal constant T2 = 1_791_992_998;
    uint256 internal constant TA = 1_792_079_399;
    uint256 internal constant TB = 1_792_165_799;

    function attack() external {
```

