FestivalPass::buyPass function is callable by any user(or contract). Any user(or attacker contract) can mint extra pass balance and can earn extra beat tokens by re-entering the buyPass function maliciously
FestivalPass::buyPass function does not follow the proper CEI method and also updates the important state after an external call, which leads to an re-entrancy for an attacker
User can call the buyPass function through a malicious contract which eventually executes an re-entrancy in the buyPass function.
Likelihood: High
User(Attacker) can use an malicious contract to buyPass. Attacker calls the buyPass function using an contract which will pay the initial amount to buyPass and then during the first minting, the attackers contract will re-enter the buyPass function to mint extra pass and earn extra BEAT tokens just paying for initial passes
Attacker will earn extra Pass and BEAT tokens by paying less amount that is originally needed to earn passes and BEAT tokens
Impact: Medium
Attackers can mint extra Passes and earn BEAT tokens by paying less amount that is originally needed to buy passes
This will eventually increases the supply count of pass and attacker will able to earn more BEAT tokens
Add following test in your ./test/ReentrancyAttackBuyPassTest.sol
and to run the test execute the following command forge test --mt testReentrancyAttack -vvvv
Below test uses an malicious contract as an attacker's contract and tries to call the buyPass function and then maliciously re-enters the buyPass function to earn tokens and passes
FestivalPass::buyPass function should follow proper CEI method to prevent the re-entrancy
Can include nonReentrant guard to prevent the reentrancy!!!!!
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.