Describe the normal behavior in one or more sentences
Answer: The contract intends to assign each user a random amount of APT between 100 and 500 (in Octas) upon registration. This should prevent users from predicting or influencing their assigned reward.
Explain the specific issue or problem in one or more sentences
Answer: The contract uses the current timestamp (timestamp::now_microseconds()) modulo 401 to determine the random reward. Timestamps are public, predictable, and miner/validator-influenced, meaning the “randomness” is not actually secure. An attacker can time their transaction to get the maximum or minimum reward.
Likelihood:
Reason 1 // Describe WHEN this will occur (avoid using "if" statements)
Answer: This will always occur when a user is registered since reward calculation relies solely on timestamp.
Reason 2
Answer: Validators/miners can manipulate timestamps slightly, and users can spam transactions until they hit favorable values.
Impact:
Impact 1
Answer: Attackers can consistently obtain maximum slices (close to 500 APT), draining the airdrop pool faster.
Impact 2
Answer: Honest users receive smaller random values, creating an unfair distribution and potential contract bankruptcy.
Owner legitimately registers a user.
Attacker predicts the assigned pizza slice size since it’s derived from timestamp::now_microseconds() % 401. By creating many addresses and calling register_pizza_lover repeatedly until the modulus produces a high value, attacker ensures a maximum reward (500 APT).
This test demonstrates how an attacker can game the random function by exploiting predictable timestamp-based randomness.
Use Aptos’ native randomness source instead of timestamp. The aptos_std::rand or #[randomness] API provides secure, verifiable randomness that cannot be manipulated by attackers.
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.