Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

No check on the Players Status can lead to pending player making prediction with no entrance fee

Summary

The makePrediction() function allows players to place bets on a specific game, requiring them to pay a prediction fee beforehand. However, the current implementation lacks a check to verify the player's status before they can place a bet. As a result, a player could register and place a bet without being properly approved, which undermines the integrity of the betting process.

Vulnerability Details

The makePrediction() function has a serious vulnerability: a player can register without approval, place a prediction, and then withdraw their entrance fee without contributing any significant amount. This flaw undermines the integrity of the prediction system and allows players to exploit the protocol without properly participating.

POC

function test_playersWithPendingStatusCanPredict() public {
vm.startPrank(stranger);
vm.deal(stranger, 1 ether);
thePredicter.register{value: 0.04 ether}();
vm.stopPrank();
vm.startPrank(stranger);
thePredicter.makePrediction{value: 0.0001 ether}(
1,
ScoreBoard.Result.Draw
);
thePredicter.cancelRegistration();
vm.stopPrank();
assertEq(stranger.balance, 0.9999 ether);
}

Impact

Malicious players can exploit this vulnerability to drain the protocol by placing predictions without paying the entrance fee. They can register with a pending status, make a prediction, and then use the cancelRegistration() function to withdraw their entrance fee, effectively contributing nothing while still taking advantage of the system.

Tools Used

Manual

Recommendations

Add a require check on makePrediction().
require(playersStatus[msg.sender] == Status.Approved,"Not Allowed")

Updates

Lead Judging Commences

NightHawK Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

makePrediction lacks access control

makePrediction has no access controls and any unapproved user can make predictions causing an incorrect calculation and distribution of rewards.

Support

FAQs

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