The current random implementation of get_random_slice
uses let time = timestamp::now_microseconds();
to derive a random amount value based on block timestamp (+100) to determine the amount of APT to award a user on claim.
The current implementation creates predictability as all information is visible and stored on the blockchain and therefore is not truely random and can create a biased reward allocation if abused by the owner, or a block proposer.
Due to the randomness being predictable, this can enable claim manipulation creating a biased and unfair environment for its user, especially if the owner acts in coordination with a bad-actor.
Likelihood: LOW
The RNG is not random, but predictable. Therefore the owner can time submissions
If working with the owner, a block proposer can pick a beneifical timestamp for maximum output.
Impact: MEDIUM
Ability to choose who to send maximum APT Claims to
Potential ability to drain the contract due to predictable RNG Claims.
The below script can be added to the test section with an artificial timestamp showing a max-reward is possible.
Aptos has its own inbuilt randomness. Consult the documentation in references at the bottom and implement it correctly.
Within the framework imports at the top, utilise the Aptos randomness framework.
and remove get_random_slice
entirely.
Aptos Randomness - https://aptos.dev/build/smart-contracts/move-security-guidelines#randomness
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.