Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Time Check for Predictions has some potential issues, the calculation of the timestamp may be complex and prone to errors which some malicious attacker can take advantage of this to make accurate predictions after the match has elapsed.

Summary

In the ThePredicter::makePrediction function below, the if block code purpose is to ensures that predictions can only be made before the start of the match. However the calculation of the timestamp is complex and prone to errors. This gives opprtunity for malicious attackers to take advantage to predict after the game has elapsed

Vulnerability Details

@> if (block.timestamp > START_TIME + matchNumber * 68400 - 68400) {
revert ThePredicter__PredictionsAreClosed();
}

PoC

if (block.timestamp > START_TIME + matchNumber * 68400 - 68400) {
revert ThePredicter__PredictionsAreClosed();
}

From the if block code statement the block.timestamp would always be greater than zero (START_TIME + matchNumber * 68400 - 68400) at any time.

Impact

The ThePredicter::makePrediction implementation gives opprtunity for malicious attackers to take advantage to predict after the game has elapsed. This gives the attacker leverage to amass maximium points and greater share of the reward

Tools Used

Manual Review

Recommendations

function makePrediction(
uint256 matchNumber,
ScoreBoard.Result prediction
) public payable {
if (msg.value != predictionFee) {
revert ThePredicter__IncorrectPredictionFee();
}
+ if (block.timestamp > START_TIME)
- if (block.timestamp > START_TIME + matchNumber * 68400 - 68400)
{
revert ThePredicter__PredictionsAreClosed();
}
scoreBoard.confirmPredictionPayment(msg.sender, matchNumber);
scoreBoard.setPrediction(msg.sender, matchNumber, prediction);
}
Updates

Lead Judging Commences

NightHawK Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.