The get_random_slice
function is declared as entry fun
, allowing anyone to call it directly via CLI and completely bypass the owner-controlled registration mechanism in register_pizza_lover
. This enables attackers to register unlimited addresses and drain the protocol funds.
The function get_random_slice
is declared as entry fun
instead of private fun
, making it callable as a transaction entry point. Additionally, despite its name suggesting "get", it actually modifies state by setting reward amounts in the table which is also a questionable issue as get function should be read only and not set state.
Key issues:
entry fun
allows direct CLI calls bypassing access control
Function name misleads - "get" but actually "sets" table values
No authorization check within get_random_slice
itself
Enables unlimited registration by any attacker
Likelihood: High - Trivially exploitable via standard CLI commands
Impact: High - Complete protocol fund drainage through unlimited registrations
High severity because:
Completely bypasses intended owner-only registration control
Allows unlimited address registration draining all protocol funds
Enables mass Sybil attacks with minimal cost per registration
Function name deception hides the state-modifying behavior
Live demonstration on Aptos Devnet using a terminal CLI and BASH
Attack Vectors:
Direct CLI Bypass - Call get_random_slice
directly
Mass Registration - Script hundreds of address registrations
Sybil Attack - Create multiple accounts, register each
Fund Drainage - Claim rewards from all registered addresses
Remove entry
visibility from get_random_slice
to prevent direct calls:
Additional security improvements:
Rename function to assign_random_slice
to reflect state modification
Add owner check within the function as defense in depth
This ensures only the owner-controlled register_pizza_lover
can assign rewards, properly enforcing the intended access control mechanism.
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.