The PizzaDrop protocol is designed to distribute random APT allocations to registered users through the get_random_slice()
function. Each user should receive a genuinely random amount between 100-500 units, ensuring fair and unpredictable distribution across all participants. The randomness mechanism is intended to prevent users from gaming the system to obtain preferential allocations.
The get_random_slice()
function uses timestamp::now_microseconds()
as its sole source of randomness, making allocations completely predictable. The allocation formula random_amount = 100 + (timestamp % 401)
allows sophisticated users to calculate their exact allocation before registration and manipulate timing to guarantee maximum (500-unit) or minimum (100-unit) rewards. This predictable behavior violates the protocol's core fairness assumption and enables systematic exploitation.
The vulnerability stems from the randomness implementation in the get_random_slice()
function:
Likelihood:
Technical users regularly analyze smart contract code before interacting with protocols, making discovery of the predictable timestamp formula highly probable during normal due diligence processes.
Registration timing is user-controlled through the register_pizza_lover()
function, enabling attackers to execute multiple registration attempts with precise timing coordination to achieve desired allocation outcomes.
Impact:
Systematic unfair advantage enables sophisticated users to guarantee maximum 500-unit allocations while regular users receive random 100-500 unit amounts, creating a 5x economic disparity that fundamentally undermines the protocol's fair distribution model.
Protocol integrity violation destroys the core randomness assumption, potentially leading to user loss of confidence, reduced participation, and reputational damage when the predictable allocation pattern becomes publicly known.
The following test demonstrates the predictable nature of the allocation system by successfully predicting exact allocation amounts based on timestamp manipulation:
Replace the predictable timestamp-based randomness with proper cryptographic randomness using Aptos Framework's secure randomness API:
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.