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

Unrestricted Modification of Match Results by Contract Owner

Summary

The setResult function in the ScoreBoard contract allows the contract owner to set or modify the match results without any constraints. This lack of restrictions can lead to potential exploitation where the match results can be tampered with at any time, undermining the integrity of the betting system.

Vulnerability Details

The setResult function is designed to set the result of a match based on the matchNumber and result parameters provided by the contract owner. However, there are several critical issues with the current implementation:

  1. No Value Verification: There is no validation to ensure that the result parameter is a valid result and not the default Pending value.

  2. Unrestricted Timing: The function can be called at any time, allowing the owner to modify the results both before and after the match end date. This means the owner can prematurely set the result before the match has concluded or alter the results after they have been initially set.

  3. Multiple Modifications: The function does not prevent the owner from modifying the result of a match multiple times, which could lead to manipulation of the outcome.

Code Snippet

ScoreBoard.sol contract

function setResult(uint256 matchNumber, Result result) public onlyOwner {
results\[matchNumber] = result;
}

Tool used

Manual Review

Impact

The ability to modify match results at any time poses a significant risk to the fairness and transparency of the betting system. This vulnerability can be exploited by a malicious owner to alter match results in their favor, potentially leading to financial losses for honest participants and undermining the credibility of the system.

Recommendations

To mitigate this issue, the following changes should be implemented:

  1. Result Validation: Ensure that the result parameter is validated and cannot be set to the Pending state once the match has concluded.

  2. Single Modification: Implement a mechanism to ensure that the result of a match can only be set once and cannot be modified thereafter.

  3. Timing Constraints: Introduce time-based restrictions to ensure that the result can only be set after the match has concluded and within a reasonable time frame.

Updates

Lead Judging Commences

NightHawK Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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