The LevelOne::startSession
function is missing ainput vaidation on the given _cutOffScore
variable impacting the graduating logic; can be set for everyone to fail or everyone to pass.
When a principal calls the LevelOne::startSession
function, a _cutOffScore
argument needs to be provided in order to determine the logic of how students will graduate to the next level.
When a student enrolls into Hawk High, they start of with a score of 100. For each good review, their score remains the same while for each bad review, their score drops by 10.
The Code Issue
The startSession
function is missing input validation on the argument given, meaning a Principal can set the _cutOffScore
to either:
Very low: meaning everyone will pass
Very High: meaning no one will pass
The current cutOffScore
logic does not reflect and relate to their existing score meaning students are vulnerable to score abuse/exploitation. A Principal can incorrectly set everyone to pass or fail regardless of the number of bad/good reviews.
The expected logic should have a input validation check that relates to the starting score for students.
Affected Code Area
Exploitation
A Principal sets the _cutOffScore
to 40. Even if a student gets 4 bad reviews they will still be above the cut of score and graduate to the next level. Conversely, if the Principal sets the _cutOffScore
to above 100, then no student will graduate.
The Impact of this severity is Medium as it breaks the school logic and opens up the door to potential issues.
There is a logical breakage as the graduation logic becomes meaningless of a low score, ie everyone still passes regardless of bad reviews
The Principal can abuse this by setting a high cutOffscore making no one to pass; again breaking graduation logic.
Walkthrough
Principal calls startSession
with a low cutOffSore e.g 10
Teacher each week gives a student X bad review.
At the end of session, student X has score of 60. They aer still above the cuttOfScore and therefore are eligible to be upgraded to the next level.
In order to prevent abuse - unintentional or malicious - the contract should perform input validation on the _cutOffScore
variable.
For example,
the the minimum allowed input should be 70
This allows for a student to have at 3 bad and 1 good review to pass. If they get 4 bad reviews they fail.
The maximum input should be less than 100 e.g 90.
This allows 2 good and 2 bad reviews allowing a pass or alternatively, 3 bad and 1 good review meaning a fail
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.