https://github.com/Cyfrin/2024-07-the-predicter/blob/839bfa56fe0066e7f5610197a6b670c26a4c0879/src/ThePredicter.sol#L64
A re-entrance attack can be performed in the ThePredicter::cancelRegistration()
function resulting in draining all the funds of the contract
The only condition to withdraw the entranceFee
is that the status of the registration request must be pending
, and the status is changed to canceled
only after the funds are sent. Therefore, the sender
can repeatedly use the call
low level function to perform this action repeatedly to drain the total balance before the status is changed to canceled
.
Use the nonReentrant guard modifier that Openzeppelin provide and set the status to canceled before to send the funds.
The impact is high because a malicious actor can drain the total of funds
Manual review
Reentrancy of ThePredicter::cancelRegistration allows a maliciour user to drain all funds.
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.