Skip to content
Smart contracts Audit finding Intermediate

LinearVesting does not calculate vested amount linearly

The linear vesting contract calculates the claimable amount incorrectly, so after a partial claim the user receives less than the correct linear share. An attacker or user could claim less than entitled, but the text does not describe an exploit to steal funds.

xYrYuYx Follow

Originally disclosed on Code4rena

Submitted by xYrYuYx

Impact

These calculations are incorrect for linear vesting.

Proof of Concept

i.e. if start amount is 10000, and duration is 100 seconds. After 50 seconds, user can claim 5000 which is 50%

After another 10 seconds, user need to claim 1000 which is 10%, but current calculation return 500.

Tools Used

Manual

Recommended Mitigation Steps

Change formula to User total amount * (block.timestamp – start) / (vesting duration) – user claimed amount.

SamSteinGG (Vader) confirmed

The original report as published on Code4rena, by xYrYuYx. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

Likely the formula subtracts the already claimed amount from the wrong base or applies the percentage to the remaining amount instead of the total vested amount.

What the attacker needed

A vesting schedule with partial claims

How it was found

  1. Set start amount to 10000 and duration to 100 seconds.
  2. After 50 seconds, claim 5000 (50%).
  3. After another 10 seconds, the correct claimable amount is 1000 (10%), but the contract returns 500.

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 releases tokens gradually over time. This one miscalculates how many tokens are available after a partial claim, giving the user too few tokens. The report shows a simple example where the user should get 1000 but gets 500.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by xYrYuYx

View all

3 more disclosed reports, best first.

More from Vader Protocol contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.