this is a critical business logic caused due to Arithmetic Error calculation
, where the earning of Teachers
must be 35% of all school fees paid
but the logic to perform this process is implemented incorrectly causing to give each Teacher a complete 35% of all school fees paid
instead of sharing a 35% of all fees
among teachers. This is a critical flaw because if the total teachers exists >= 3 teachers then the total money received will equal : 3 × 35% = 105%, which exceeds the total fees collected
, causing the LevelOne::graduateAndUpgrade
function to revert and no one will be collected with their wage not even the Principal
.
1- Navigate to test/LeveOnelAndGraduateTest.t.sol
file.
2- Add the following PoC code to the test
file:
3- In the command line, run the following command: forge test --match-test testEachTeacherTake35PercentOfAllFees -vvv
4- Note the output :
The balance of both alice and bob is 35% of Total school Fees For each.
5- Now change the content of this function and uncomment
all the comments in this function (This would add a third teacher). The output will be like this:
Note the transaction has been reverted and no one get paid.
payout function & graduate/update function LevelOne::graduateAndUpgrade
which is the most critical function for the Principal
& Teachers
to get paid and for Students
to graduate to become unusable.
Manual Recon.
foundry Test Suite
.
in the LevelOne::graduateAndUpgrade
function the Arithmetic flow for the Teachers
to get their wage should be as following:
`payPerTeacher` in `graduateAndUpgrade()` is incorrectly calculated.
`payPerTeacher` in `graduateAndUpgrade()` is incorrectly calculated.
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.