Hawk High

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

Principal can act as a teacher also resulting in taking teacher's wages

Summary

Principal can call LevelOne::addTeacher function for himself which makes him a teacher also.

Vulnerability Details

Principal can act as teacher and he can take all the teacher's wages.

POC:

The principal is adding himself as a teacher also. He can be the sole teacher of the School and later will take all the 35% bursary teacher's fund.

function test_principal_can_be_a_teacher() public{
vm.prank(principal);
levelOneProxy.addTeacher(principal);
assertEq(levelOneProxy.getListOfTeachers()[0],principal);
}

Impact

The Teacher's wages(35% of bursary) are at risk that can be taken by principal.

Recommendations

Add a check in LevelOne::addTeacher function that a Principal can't be a teacher.

function addTeacher(address _teacher) public onlyPrincipal notYetInSession {
.
+ if (_teacher==principal) {
+ revert HH__NotAllowed();
+ }
.
}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

principal can become teacher

Principal can add themselves as teacher and share in teacher pay upon graduation

Support

FAQs

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