The function get_random_slice generates a “random” value using only the system timestamp (timestamp::now_microseconds()). The problem is that this value can be observed or predicted by anyone before the transaction executes, allowing an attacker to anticipate the random_amount a user will receive.
Impact:
An attacker can time their function call to obtain the highest possible value (or a specific desired value) of APT
This breaks fairness in the “random pizza slice” distribution and allows exploitation for unfair gains
On the Aptos network, smart contracts can leverage built-in secure randomness functions to generate unpredictable numbers. For instance, the module aptos_framework::rand provides cryptographically secure random values, ensuring that outcomes cannot be predicted or manipulated by attackers. Using these functions is recommended over relying on predictable sources such as timestamps, which can compromise fairness and security in on-chain applications
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.