-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Users will never be able to withdraw their claimed airdrop fully in ERC20Airdrop2.sol contract #245
Comments
minhquanym marked the issue as primary issue |
minhquanym marked the issue as sufficient quality report |
This seems to be a valid bug report. |
dantaik (sponsor) acknowledged |
Fixed in taikoxyz/taiko-mono#16596 |
adaki2004 (sponsor) confirmed |
I think the current status here is: confirmed. It is indeed a bug in the flow, while we removed Airdrop2, it is still a confirmed finding on the repo for auditing. |
0xean marked the issue as satisfactory |
0xean marked the issue as selected for report |
Lines of code
https://github.com/code-423n4/2024-03-taiko/blob/f58384f44dbf4c6535264a472322322705133b11/packages/protocol/contracts/team/airdrop/ERC20Airdrop2.sol#L117
Vulnerability details
Impact
Context:
The ERC20Airdrop2.sol contract is for managing Taiko token airdrop for eligible users, but the withdrawal is not immediate and is subject to a withdrawal window.
Users can claim their tokens within claimStart and claimEnd. Once the claim window is over at claimEnd, they can withdraw their tokens between claimEnd and claimEnd + withdrawalWindow. During this withdrawal period, the tokens unlock linearly i.e. the tokens only become fully withdrawable at claimEnd + withdrawalWindow.
Issue:
The issue is that once the tokens for a user are fully unlocked, the withdraw() function cannot be called anymore due to the ongoingWithdrawals modifier having a strict
claimEnd + withdrawalWindow < block.timestamp
check in its second condition.Impact:
Although the tokens become fully unlocked when block.timestamp = claimEnd + withdrawalWindow, it is extremely difficult or close to impossible for normal users to time this to get their full allocated claim amount. This means that users are always bound to lose certain amount of their eligible claim amount. This lost amount can be small for users who claim closer to claimEnd + withdrawalWindow and higher for those who partially claimed initially or did not claim at all thinking that they would claim once their tokens are fully unlocked.
Proof of Concept
Coded POC
How to use this POC:
test/team/airdrop/ERC20Airdrop2.t.sol
forge test --match-test testAirdropIssue -vvv
Logs
Tools Used
Manual Review
Recommended Mitigation Steps
In the modifier ongoingWithdrawals(), consider adding a buffer window in the second condition that gives users enough time to claim the fully unlocked tokens.
Assessed type
Timing
The text was updated successfully, but these errors were encountered: