The setPrediction
function allows any address to access and change the predictions of any player who has used the ThePredicter::makePrediction
function. Until the block.timestamp
passes the designated cutoff time, predictions can be altered. This enables a malicious player to change another player's prediction to Pending
just before the cutoff, causing the affected player to receive no points. This also allows the malicious player to maximize their profit by ensuring other players' scores remain at zero
The following code is to be used in ThePredicter.test.sol
file.
We have 3 players called player1
, player2
and player3
who have registered, have addresses approved by organizer
and make 3 predictions each player.
The organizer
sets the scores, for this example we set them all at once with results of First
. Meanwhile player1
has changed the predictions of player2
and player3
for games 1 and 2 to Pending
giving them a score of 0.
We then warp the timestamp to 1723888799
for game #3, have player1
change the predictions of player2
and player3
to result of Pending
.
player2
realises that their score isnt reflecting what they have predicted, player2
tries to change the prediction using setPrediction
to result of First
, but because it is after the allocated time, score has been set and cant be reversed leaving with a score of 0 as per following scores below.
organizer
calls withdrawPredictionFees
to receive the amount to pay hall rent according to the README.md
file.
player1
withdraws their reward prize, draining the prize pool maximising their earnings.
The impact of this vulnerability is that a player can change other players' predictions without their knowledge until the designated time has passed. As a result, the affected player cannot change their prediction back, leading to potential manipulation and unfair outcomes.
Manual review
Add the onlyThePredicter
modifier to ensure that it is only ThePredicter
contract that calls and execute this function.
setPrediction has no access control and allows manipulation to Players' predictions.
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.