Skip to content
Business logic Audit finding Beginner

Investor can’t claim the last tokens (via claim() )

The claim() function in InvestorDistribution.sol contains a require statement that reverts when the remaining claimable amount is zero, preventing an investor from claiming their last tokens. An attacker cannot steal funds, but the availability of the investor's tokens is compromised because the normal claim path fails.

gpersoon Follow

Originally disclosed on Code4rena

Submitted by gpersoon

Impact

Suppose you are an investor and want to claim the last part of your claimable tokens (or your entire set of claimable tokens if you haven’t claimed anything yet). Then you call the function claim() of InvestorDistribution.sol, which has the following statement: require(investors\[msg.sender].amount - claimable != 0); This statement will prevent you from claiming your tokens because it will stop execution.

Note: with the function claimExact() it is possible to claim the last part.

Proof of Concept

// https://github.com/code-423n4/2021-11-bootfinance/blob/7c457b2b5ba6b2c887dafdf7428fd577e405d652/vesting/contracts/InvestorDistribution.sol#L113-L128

function claim() external nonReentrant {
...
require(investors\[msg.sender].amount - claimable != 0);
investors\[msg.sender].amount -= claimable;

Tools Used

Recommended Mitigation Steps

Remove the require statement.

chickenpie347 (Boot Finance) commented:

Duplicate of issue #130

chickenpie347 (Boot Finance) commented:

I just noticed it’s different files. The AirdropDistrbution.sol and InvestorDistribution.sol contracts were built on the same base, with slight changes.

0xean (judge) commented:

Downgrading to medium risk as an alternative path does exist for claiming the drop. Funds are not lost, but the availability of them is compromised. Per Docs:

2 — Med: Assets not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.
3 — High: Assets can be stolen/lost/compromised directly (or indirectly if there is a valid attack path that does not have hand-wavy hypotheticals).

The original report as published on Code4rena, by gpersoon. 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 require statement incorrectly rejects a zero remaining balance instead of allowing the final claim.

Impact

The availability of the investor's tokens is compromised because the normal claim path fails, though funds are not lost and an alternative path exists.

What the attacker needed

An investor with claimable tokens; calling claim() for the last part

The fix

The require statement should be removed so the final claim can succeed.

How it was found

  1. An investor calls claim() to collect the last part of their claimable tokens.
  2. The require statement evaluates the remaining amount and reverts because it is zero.
  3. The investor cannot claim the last tokens through claim().

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 smart contract lets investors collect tokens over time. The function meant to collect them has a check that stops the transaction when the remaining amount is zero, so the last part cannot be collected through that function. Another function exists that can still collect the tokens.

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.

More by gpersoon

View all

47 more disclosed reports, best first.

More from Boot Finance contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.