InflationaryVest.vy: Missing update of self.claimed allows infinite multiple claims by the recipient
The claim function in InflationaryVest.vy does not update the self.claimed variable after transferring tokens, so the recipient can call claim repeatedly and receive the same vested amount each time. This allows the recipient to drain the vesting reserves multiple times.
Source: https://github.com/sherlock-audit/2025-08-yield-basis-judging/issues/20
Found by
0xAsen, 0xDemon, 0xc0ffEE, 0xding99ya, 0xzey, AnomX, Audinarey, ClownStr1k3, CoheeYang, Colin, Freescore, Josh4324, Matin, Varun_05, Waydou, ZeroEx, axelot, bam0x7, boredpukar, djshaneden, emarai, holtzzx, maigadoh, montecristo, rsam_eth, snapishere
Summary
The missing update of self.claimed will cause infinite reward extraction for the recipient as an attacker will repeatedly call claim() and receive the same allocation multiple times. Affected contract: InflationaryVest.vy
Root Cause
In InflationaryVest.vy:76 the function _claimable() subtracts self.claimed, but self.claimed is never updated inside claim().
@internal
@view
def _claimable() -> uint256:
initial_vest_reserve: uint256 = self.initial_vest_reserve
claimed: uint256 = self.claimed
return (INITIAL_YB_RESERVE - staticcall YB.reserve()) * initial_vest_reserve // INITIAL_YB_RESERVE - self.claimed # <==
@external
@view
def claimable() -> uint256:
return self._claimable() # self.claimed <== never updated
@external
def claim() -> uint256:
claimable: uint256 = self._claimable() # self.claimed <== never updated
recipient: address = self.recipient
extcall YB.transfer(recipient, claimable)
log Claim(recipient=recipient, claimed=claimable)
return claimable
Because of this, the contract does not keep track of previously claimed amounts.
Internal Pre-conditions
- The protocol deploys InflationaryVest.vy with a non-empty recipient.
- self.claimed is initialized to 0 and never modified.
- Vesting reserves are available in the YB token contract.
External Pre-conditions
- The YB.reserve() decreases as vesting is meant to unlock.
- Gas price and network state allow repeated claim() calls.
Attack Path
- The recipient calls claim() once and receives the full claimable amount.
- Because self.claimed is never updated, the next call to claim() recalculates the same claimable amount.
- The recipient can repeat step (2) indefinitely, draining the entire vesting allocation multiple times.
Impact
- The protocol suffers 100% loss of the vested reserves.
- The attacker (recipient) gains the entire allocation repeatedly.
- Vesting logic is completely bypassed, making the distribution system broken.
PoC
...
Mitigation
Update self.claimed inside the claim() function after a successful transfer. Example fix:
def claim() -> uint256:
claimable: uint256 = self._claimable()
recipient: address = self.recipient
extcall YB.transfer(recipient, claimable)
self.claimed += claimable # <-- fix
log Claim(recipient=recipient, claimed=claimable)
return claimable
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/yield-basis/yb-core/commit/c34df8a659c0540172bae024a65a3e1f5c94b5ee
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The claim function transfers tokens but never increments self.claimed, so the contract cannot track previous claims.
Impact
The recipient could drain the entire vesting allocation multiple times, causing a 100% loss of the vested reserves.
What the attacker needed
InflationaryVest.vy deployed with a recipient; self.claimed initialised to 0 and never modified; Vesting reserves available in YB token contract
The fix
The claim function should update self.claimed after a successful transfer, and the protocol team fixed this issue in a commit.
How it was found
- The recipient calls claim() once and receives the full claimable amount.
- Because self.claimed is never updated, the next call to claim() recalculates the same claimable amount.
- The recipient can repeat step (2) indefinitely, draining the entire vesting allocation multiple times.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A vesting contract is supposed to release tokens gradually and keep track of how many have already been claimed. Here, the contract forgets to record that a claim happened, so every time the recipient asks for tokens, it pays out the same amount again. This means the recipient can keep calling the claim function and take far more than they should.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.