Skip to content
Business logic Audit finding Beginner

Can’t claim last part of airdrop

The claim() function in the airdrop contract used an assert that fails when the remaining unclaimed amount equals the claimable amount, so a user could not claim the final portion of their airdrop through that function. An alternative function, claimExact(), still allowed the last part to be claimed, so funds were not lost but availability was affected.

gpersoon Follow

Originally disclosed on Code4rena

Submitted by gpersoon

Impact

Suppose you are eligible for the last part of your airdrop (or your entire airdrop if you haven’t claimed anything yet). Then you call the function claim() of AirdropDistribution.sol, which has the following statement: assert(airdrop\[msg.sender].amount - claimable != 0); This statement will prevent you from claiming your airdrop 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/AirdropDistribution.sol#L522-L536

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

Recommended Mitigation Steps

Remove the assert statement. Also add the following to validate() , to prevent claiming the airdrop again: require(validated\[msg.sender]== 0, "Already validated.");

chickenpie347 (Boot Finance) confirmed:

Patched it with assert(airdrop[msg.sender].amount - claimable >= 0); the >=0 check is just to ensure the claimant does not end up claiming more than allocated due to any fringe case.

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 assert condition was inverted or mis-specified: it required the remaining balance minus the claimable amount to be non-zero, which fails precisely when the user claims the exact remainder.

Impact

A user could not claim the last part of their airdrop through claim(), though claimExact() provided an alternative path, so funds were not lost but availability was compromised.

What the attacker needed

Eligibility for an airdrop; unclaimed airdrop balance

The fix

The assert was patched to check that the remaining amount minus the claimable amount is greater than or equal to zero, and the reporter also recommended adding a guard in validate() to stop repeat validation.

How it was found

  1. Become eligible for an airdrop and leave the final portion unclaimed.
  2. Call the claim() function of the airdrop contract.
  3. The assert statement evaluates to zero and halts execution, so the claim fails.

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.

An airdrop hands free tokens to eligible users, and a smart contract tracks how much each person can still collect. A check in the claim function was written so that it crashes exactly when someone tries to take their last remaining tokens, blocking that path. A different function still worked, so the tokens were not lost, just harder to get.

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.