Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

Missing Validation Checks During Graduation

Summary:

he graduateAndUpgrade(address _levelTwo, bytes memory) function is the critical function where all the graduation-related validations should be enforced before upgrading to the next contract version (LevelTwo).

No Validation of Student Score Against Cutoff

No sessionEnd Time Check

No Validation of Review Count (Must Be 4)

Vulnerability Details:

1. No Validation of Student Score Against Cutoff

  • Issue: The contract fails to verify whether a student's studentScore meets or exceeds the required cutOffScore.

  • Consequence: Students with poor performance or disciplinary issues can still graduate.

  • Recommendation: Add a condition like:

    require(studentScore[student] >= cutOffScore, "Insufficient score to graduate");

2. No sessionEnd Time Check

  • Issue: The principal can trigger graduation before the session officially ends.

  • Consequence: Students might graduate with incomplete review cycles or manipulated sessions.

  • Recommendation: Enforce:

    require(block.timestamp >= sessionEnd, "Session has not ended yet");

3. No Validation of Review Count

  • Issue: The contract does not verify that each student has received all 4 reviews (one per week).

  • Consequence: Students may graduate with partial evaluation, violating documentation invariants.

  • Recommendation: Validate:

    require(reviewCount[student] == 4, "Not all reviews completed");

Impact:

Logic Bypass: Students with poor performance (e.g., < cutOffScore) incorrectly graduate.

Data Integrity: System state will be polluted with ineligible students, potentially affecting future rewards or tracking.

Tools Used:

Mannual Review

Recommendations:

Update the function he graduateAndUpgradefunction:

require(block.timestamp >= sessionEnd, "Session not ended");

for (uint256 i = 0; i < listOfStudents.length; i++) {

address student = listOfStudents[i];

if (!hasPaid[student]) continue;

if (reviewCount[student] < 4) continue;

if (studentScore[student] < cutOffScore) continue; // Graduate the student

graduated[student] = true;

}


Updates

Lead Judging Commences

yeahchibyke Lead Judge 20 days ago
Submission Judgement Published
Validated
Assigned finding tags:

cut-off criteria not applied

All students are graduated when the graduation function is called as the cut-off criteria is not applied.

yeahchibyke Lead Judge 20 days ago
Submission Judgement Published
Validated
Assigned finding tags:

cut-off criteria not applied

All students are graduated when the graduation function is called as the cut-off criteria is not applied.

Support

FAQs

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