In the current implementation, once a user's status changes from Pending
to Approved
, they could technically call the register
function again because the status check only prevents users with a Pending status from registering again.
The register
function only checks if a user’s status is Pending
to prevent re-registration. Once a user’s status is changed from Pending
to Approved
, they can call the register
function again, which is unintended behavior and can lead to double registration.
The issue is in this function:
https://github.com/Cyfrin/2024-07-the-predicter/blob/main/src/ThePredicter.sol#L46-L60
Proof of Concept (PoC)
User calls register
and their status is set to Pending
.
The organizer approves the user, changing their status to Approved
.
The user calls register
again and successfully registers, because their status is no longer Pending
.
Users can register multiple times by getting their status approved and then registering again. This can lead to misuse of registration slots and potentially disrupt the intended gameplay mechanics.
Manual Review
Update the register
function to check for both Pending
and Approved
statuses (or any other relevant statuses) to prevent re-registration:
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.