# SecondSwap_Marketplace vesting listing order affects how much the vesting buyers can claim at a given step

VestingManager inherits stepsClaimed from first listed vesting, so later buyers of unclaimed listings inherit stale claimed steps and cannot claim.

- Payout: Contest reward
- Severity: high
- Program: SecondSwap
- Credited: 0xloscar01
- Disclosed: 2025-02-18
- Write-up quality: 6/10
- Original: https://code4rena.com/reports/2024-12-secondswap#h-01
- Library page: https://bugbountylibrary.com/r/c4%3A2024-12-secondswap%3AH-01
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** SecondSwap_Marketplace / SecondSwap_StepVesting listing and claim logic
**Root cause:** When the VestingManager has no prior vesting for a beneficiary, createVesting copies stepsClaimed from the listed vesting into the manager's record; subsequent listings mix with this inherited value.
**Steps:**
1. Deploy vesting plan with 200 steps; create vesting for seller1 (and seller2 in case 2).
2. Warp 10 days; seller1 claims then lists 10% via `marketplace.listVesting`.
3. Seller2 lists 10% without claiming (case 2) or seller1 lists second tranche after claim (case 1).
4. Buyer calls `marketplace.spotPurchase(_listingId: 1, _amount: amount)` paying amount + buyerFee.
5. Call `vesting.claimable(vestingBuyer)`; in case 2 the inherited stepsClaimed makes claimable 0 at current step.
**How found:** Reading SecondSwap_StepVesting.sol L288-290, noticed the `totalAmount == 0` branch copies `_stepsClaimed` from the listed vesting into the manager's record, then reasoned about listing order effects.
**Exploitation:** A buyer purchasing a listing whose vesting was transferred to the VestingManager inherits the manager's stale stepsClaimed, so their claimable amount is reduced/zeroed at the current step despite paying full price.
**Insight:** When a contract lazily initializes a beneficiary record from a transferred asset, check whether state like stepsClaimed is copied from the source and whether ordering of transfers changes later buyers' entitlements.
