Normally, airdrop amounts should be assigned to users in a way that is unpredictable and tamper-resistant.
The get_random_slice
function currently uses the timestamp (timestamp::now_microseconds()
) modulo 401 to assign claim amounts. Since blockchain timestamps are predictable or manipulable by validators, an attacker can calculate or influence the assigned amount, leading to unfair advantage or draining the pool.
Likelihood:
Any user can call get_random_slice
directly and predict the random amount.
Validators or miners can slightly manipulate timestamps to increase their assigned amount.
Impact:
Users can maximize their airdrop gain by predicting the output.
Attackers may unfairly drain the contract’s pool by repeatedly exploiting predictable randomness.
Effect of Mitigation:
Randomness becomes unpredictable and resistant to timestamp manipulation.
Attackers cannot reliably predict or influence the assigned airdrop amounts.
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.