Public Function - High Impact
Anyone can call (get_random_slice) .
Let's say you gave a pizza lover such as myself 100 slices instead of 500, now I am upset and I can see this vulnerability in your code. And because I am greedy and want 500 slices I would just call this function over and over until I get 500 slices instead of the 100 you gave me.
P.S. I know you will give me 500 slices because now you know I love pizza and you guys are cool!
Likelihood: Pretty sure i'm not the only pizza lover who can read code, so it's highly likely
Reason 1 // The reason is the lack of proper ownership checks on the function, you need to add a modifier that allows only the contract owner to call this function
Reason 2 no other checks or functions that would prevent any registered user from exploiting this function
Impact: High
Impact 1: people can manipulate the amount of slices they get ( sorry if I sound repetitive. I'm just not sure how to explain the impacts in a different way :D)
Impact 2: would make the competition unfair and might even drain the amount of pizzas so not everyone would get some
First, we run a local node with the following command
Then we initialize 2 accounts by running
We fund both the accounts
Then we deploy the PizzaDrop contract using the "deployer" account (had to skip the dependencies update because it wasn't working for me)
The other account "user" directly calls the "get_random_slice" function without being registered by the owner
The above steps demonstrates that anyone can self register bypassing owner control, which goes against the competition's rules.
As of now there is only transfer logic without the proper checks to limit who can register, by adding the checks, each function caller will be checked against a list that stores the registered addresses allowing them to call the function
For this you can either change the visibility of your function to something more restricted or you can add an ownership check where only the contract owner can call it
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.