Hawk High

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

Incorrect Teacher Wage Distribution

Summary

A critical flaw exists in the teacher wage distribution logic that could cause fund exhaustion and failed transactions when multiple teachers are present.

Vulnerability Details

function graduateAndUpgrade(address _levelTwo, bytes memory) public onlyPrincipal {
..................
// wrong allocates 35% to each teacher instead of dividing it among all teachers
uint256 payPerTeacher = (bursary * TEACHER_WAGE) / PRECISION;
uint256 principalPay = (bursary * PRINCIPAL_WAGE) / PRECISION;
..........................
}

Impact

  • ❗️Fund transfers will fail due to insufficient contract balance

  • ❗️Principal's 5% share becomes unreachable

  • ❗️Graduation/upgrade process becomes permanently blocked

  • ❗️Teachers receive incorrect/inflated payments

Tools Used

  • Manual code review

Recommendations

function graduateAndUpgrade(address _levelTwo, bytes memory) public onlyPrincipal {
..................
// Calculate total teacher pool first
uint256 totalTeacherPool = (bursary * TEACHER_WAGE) / PRECISION;
// Then divide equally between teachers
uint256 payPerTeacher = totalTeacherPool / listOfTeachers.length;
uint256 principalPay = (bursary * PRINCIPAL_WAGE) / PRECISION;
..........................
}

Updates

Lead Judging Commences

yeahchibyke Lead Judge about 1 month ago
Submission Judgement Published
Validated
Assigned finding tags:

incorrect teacher pay calculation

`payPerTeacher` in `graduateAndUpgrade()` is incorrectly calculated.

yeahchibyke Lead Judge about 1 month ago
Submission Judgement Published
Validated
Assigned finding tags:

incorrect teacher pay calculation

`payPerTeacher` in `graduateAndUpgrade()` is incorrectly calculated.

Support

FAQs

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