Describe the normal behavior:
The get_random_slice()
function assigns a pseudo-random reward between 100 and 500 APT to users during registration, using the current blockchain timestamp.
Explain the specific issue or problem:
Because the function relies solely on timestamp::now_microseconds()
, the output is predictable and deterministic within each block, allowing attackers to manipulate registration timing and consistently extract maximum-value rewards.
Likelihood:
The vulnerability is likely to occur whenever multiple users are registered in the same block, since timestamp::now_microseconds()
returns the same value within that block, resulting in identical "random" rewards.
Attackers can brute-force registration timing by scripting wallet interactions and repeatedly calling the register_pizza_lover()
function to find high-reward timestamps and farm multiple accounts in that window.
Impact:
The attacker can manipulate the airdrop to consistently claim high-value rewards, extracting disproportionate value and undermining fairness.
Over time, this can lead to centralised token distribution, financial loss for the project, and reputational damage due to perceived manipulation or unfairness.
This vulnerability was demonstrated using the following unit test, which shows that reward values are entirely determined by the current timestamp, resulting in identical outcomes for multiple users registered within the same logical time window:
This test registers two separate users in quick succession and retrieves the reward amount assigned to each. Since both registrations occur within the same microsecond timestamp window - the randomness function (get_random_slice()
) returns the same value to both users. The final assertion confirms this determinism.
By extension, an attacker could simulate this pattern off-chain, identify when a high-value reward (e.g., 500 APT) would be granted, and then register multiple wallets during that same timestamp window to extract maximum value - fully bypassing the intended randomness of the airdrop.
Below are two recommended mitigation strategies, shown in pseudocode with inline comments.
The `get_random_slice` function should only be called by the owner via the `register_pizza_lover` function. Also, the `owner` is trusted and will not choose a specific time for a new user to register. Therefore, I disagree with the claim of most reports in this group that an attacker can manipulate the random number of pizza slices. But I agree with the root cause of the reports in this group, that the random distribution is not completely random.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.