Anyone can enter the protocol with ThePredictor::register
. Upon entry, the user has a status of Pending
. During the Pending
phase, a user can be Approved
by the organizer, or the user can exit the protocol using ThePredicter::cancelRegistration
. If the user interacts with cancelRegistration
, they have the opportunity to drain all funds with an attack contract.
ThePredicter::cancelRegistration
lacks reentry mitigation and it makes an external call to msg.sender
:
The user enters the protocol as a malicious contract... msg.sender
will call cancelRegistration
whenever it receives ether:
The malicious user will become the owner of this contract on deployment.
This contract will enter the protocol as a player.
This contract will call cancelRegistration
initiating the reentrancy loop
This is a high impact vulnerability that can drain the protocol of all its funds. Any of the non 'trusted' participants can perform this attack. The smart contract does not need to perform any calculations and only needs to call cancelRegistration
repeatedly until all funds are drained.
Manual Review
Foundry
There are a few courses of action that can help mitigate reentrancy
Update state (CEI pattern) before making an external call
Consider using OpenZeppelin's ReentrancyGuard
Adjust ThePredicter::register
so contracts can't enter the protocol
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.