The addTreat
function is vulnerable to an arithmetic overflow when the treats array grows beyond type(uint16).max
. This causes a panic condition that makes the contract completely unusable, as core functionality like adding new treats and retrieving the treat list will fail.
Location: src/TrickOrTreat.sol:addTreat()
Proof of Concept:
The contract becomes completely unusable once array length exceeds uint16 max. All core functionality fails due to panic condition. There is no way to recover once the panic condition is reached. This could permanently lock funds in the contract.
Forge
Add a maximum limit to the number of treats that can be added
Consider pagination for getTreats()
Add explicit bounds checking before adding new treats:
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.