The Pizza Drop contract allows the owner to register users for APT rewards through the register_pizza_lover
function.
The register_pizza_lover
function calls a separate entry
function get_random_slice
. The get_random_slice
function lacks owner checks, allowing any user to bypass authorization and register themselves directly by calling this function.
Likelihood:
The get_random_slice
function is directly callable through Aptos CLI or explorer
Users can easily discover this bypass through blockchain explorers
Impact:
Any user can register themselves for rewards
Owner's control over registration is completely bypassed
Airdrop access control is effectively non-existent
Attack can claim rewards without authorization on as many addresses as he wants
The following CLI commands demonstrate how any user can bypass the owner check and register themselves:
This shows that:
Attacker can directly call get_random_slice
through CLI or on the explorer
The transaction succeeds without any owner checks
Registered addresses are allocated a claim amount
The owner's authorization is completely bypassed
An attack can do this as many times as he would like, spamming the airdrop contract and effectively draining it.
Make get_random_slice
private to prevent direct external calls and remove #[randomness]
attribute from this function:
Add #[randomness]
attribute to the register_pizza_lover
function, as this is the entry function exposing the randomness.
This ensures that:
Only the module's own functions can call get_random_slice
All registration must go through the owner-checked register_pizza_lover
External calls through CLI or contracts are prevented
The owner's control over registration is properly enforced
Most importantly, this fix ensures that the airdrop's access control cannot be bypassed, maintaining the owner's exclusive ability to register users for rewards.
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.