AirdropBroker : Airdrops in epoch 4 can participate and exercise options in subsequent epochs
The AirdropBroker contract does not clear the phase4Users mapping between the five weekly sub-epochs of phase 4, so a user who did not claim their airdrop in epoch 4 can still claim it in epoch 5. This lets them receive more tokens than intended and disrupts the planned distribution.
In AirdropBroker, the owner calls registerUsersForPhase with _phase = 4 to airdrop to users in epoch 4 to 8.
else if (_phase == 4) {
for (uint256 i; i < _users.length; i++) {
phase4Users[_users[i]] = _amounts[i];
}
}
And the documentation says:
Phase Four will have five sub phases, each bearing one week epochs. Four of the sub phases will be rewarded to twTAP lockers each weekly epoch over four weeks. Unclaimed aoTAP in each epoch will roll over to the next epoch, until the final sub phase.
The problem here is that phase4Users is not cleared before the start of the 5 sub-phases of phase 4, which results in users being able to participate and exercise the epoch 4 options in epoch 5.
} else if (cachedEpoch >= 4) {
aoTAPTokenID = _participatePhase4();
}
...
function _participatePhase4() internal returns (uint256 oTAPTokenID) {
uint256 _eligibleAmount = phase4Users[msg.sender];
if (_eligibleAmount == 0) revert NotEligible();
// Close eligibility
phase4Users[msg.sender] = 0;
Consider the following scenario. There are 10,000 aoTAPs in phase 4, which means that epoch 4, 5, 6, and 7 will receive 2,500 aoTAPs respectively, and the remaining unclaimed aoTAPs will be rolled over to the next epoch.
In epoch 4, Alice received 1000 airdrops, but Alice did not participate.
At epoch 5, the total airdrop will become 2500 + 1000 = 3500 and distributed.
However. Alice can participate and exercise the epoch 4 options in epoch 5, and making the total airdrop in epoch 5 become 3500 + 1000 = 4500.
I believe this is a valid M. It’s not any admin error stuff. It’s a code level error, the code uses the same variables to manage airdrops at different epochs.
The only way to get rid of it is if the admin calls newEpoch() to enter a new epoch while resetting all the phase4Users variables, but newEpoch() is a public function and anyone can call it, which makes it hard for the admin to get rid of it.
function newEpoch() external tapExists {
if (block.timestamp < lastEpochUpdate + EPOCH_DURATION) {
revert TooSoon();
}
// Update epoch info
lastEpochUpdate = uint64(block.timestamp);
epoch++;
// At epoch 4, change the epoch duration to 7 days
if (epoch == 4) {
EPOCH_DURATION = 7 days;
}
// Get epoch TAP valuation
(bool success, uint256 _epochTAPValuation) = tapOracle.get(tapOracleData);
if (!success) revert Failed();
epochTAPValuation = uint128(_epochTAPValuation);
emit NewEpoch(epoch, epochTAPValuation);
}
And as the report says, using different variables to manage airdrops for different epochs is the right way.
The original report as published on Code4rena, by cccz. 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.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
Likely the phase4Users mapping is not reset at the start of each new epoch, so eligibility from a previous epoch persists.
Impact
A user could claim more airdrop tokens than intended, potentially disrupting the planned distribution across epochs.
What the attacker needed
User is registered for phase 4 airdrop; user does not claim in epoch 4; user claims in a later epoch
The fix
The phase4Users mapping should be cleared in newEpoch(), or separate mappings should be used for each sub-epoch.
How it was found
In epoch 4, Alice is registered for 1000 airdrops but does not participate.
In epoch 5, the total airdrop is 2500 plus the rolled-over 1000, totalling 3500.
Alice participates in epoch 5 and claims her epoch 4 allocation, making the total 4500.
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.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
A smart contract gives out free tokens (an airdrop) over several weeks. The list of who gets what is stored in a mapping, which is like a dictionary. The contract never resets that dictionary between weeks, so someone who skipped week one can still take their week-one share in week two, getting extra 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.