makePrediction()
from ThePredicter.sol
contract should have an onlyPlayer
modifier allowing only an authorized player to make a prediction.
https://github.com/Cyfrin/2024-07-the-predicter/blob/main/src/ThePredicter.sol#L85-L99
makePrediction()
calls setPrediction()
but setPrediction()
is a public function but should be internal
otherwise what's the point of using makePrediction()
which is payable and need to pay a fee to make a prediction while setPrediction()
is accessible to simple users without paying any fee.
A simple user (not a Player, meaning a non authorized user) is able to make a prediction using makePrediction()
. But more than that, a user can overpass the fee he normally has to pay for a prediction, by using directly the setPrediction()
function which is accessible (public function).
A non authorized user can bypass the "Player restrictions" AND make a prediction at no cost (no prediction fee payed) !
It is a pretty huge vulnerability. More than bypassing the rules, it also breaks the economy of the prediction game.
VisualCode.
1) Should add an onlyPlayer
modifier in makePrediction()
function
2) Should change setPrediction()
from public
to internal
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.