The graduateAndUpgrade function in LevelOne.sol fails to update the bursary variable after paying teachers and the principal, causing an inflated balance. This misrepresents available funds, risking errors or exploits in future contract upgrades. Updating bursary by subtracting total payouts fixes the issue.
The LevelOne::graduateAndUpgrade function processes payouts to teachers (teacherWage * listOfTeachers.length) and the principal (principalWage) but does not update the LevelOne::bursary state variable, which tracks the total student fees collected. This results in an inflated bursary value that does not reflect the actual remaining funds after payouts. The bug can lead to incorrect financial accounting and issues in future contract upgrades, as the next implementation may rely on an accurate bursary value for fund allocation or logic.
Proof of Concept:
Students pay fees, increasing bursary (e.g., bursary = 100 ETH).
graduateAndUpgrade pays 10 ETH to teachers and 5 ETH to the principal (total payout = 15 ETH).
Contract balance decreases by 15 ETH, but bursary remains 100 ETH instead of updating to 85 ETH.
Future functions or upgraded contracts read 100 ETH, leading to incorrect assumptions about available funds.
PoC
Incorrect Accounting: bursary misrepresents the contract’s available funds, potentially causing errors in functions or audits that depend on it.
Upgrade Risks: If LevelOne uses a proxy pattern for upgrades, the inflated bursary could lead to over-allocation, logic errors, or exploits in the new implementation.
Security: Incorrect bursary values may enable unauthorized withdrawals or miscalculations if used in access control or fund distribution logic.
Manual Review, Foundry
After payouts in graduateAndUpgrade, update bursary to reflect the remaining balance:
The bursary is not updated after wages have been paid in `graduateAndUpgrade()` function
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.