The standard flow of execution of the protocol can be completely halted, if the winner of a raffle is a smart contract that does not accept payments in native tokens. As the transaction to send the prize to the winner (the smart contract) will revert, the raffle smart contract is frozen in a state where the last raffle cannot be closed, and a new one cannot be started, completely halting functionality.
The flow of execution at the end of a raffle is the following:
the protocol requests a random value to the VRF
after an unknown period of time, the VRF performs a callback to the raffle smart contract, calling rawFulfillRandomWords
, which triggers the execution of the following internal function:
This function should reward the winner and set the smart contract in a state that is ready to start a new raffle.
However, the protocol does not account for the possibility that the final send
fails and reverts.
Let's suppose, for example, that the winner of the raffle is the following smart contract:
This smart contract can take part in the raffle, but is not able to receive the native tokens that come with winning a raffle.
If this smart contract were to win the raffle, the callback from VRF would always revert, meaning that the status of the raffle would be stuck in Calculating
, not able to close this raffle and start a new one, completely freezing the protocol, forcing the deployment of a new contract.
To test this scenario, using the above smart contract as an attacker, the following test can be used:
This test shows the denial of service caused by a winning smart contract not capable of handling incoming native tokens. The winner cannot get rewards, and the status of the raffle cannot be closed (first revert). Additionally, it is not possible to enter a new raffle (second revert).
The protocol is halted in an unusable, frozen state. All funds in the smart contract are lost forever. The winner cannot redeem their win, and, in order to run new raffles, a new protocol has to be deployed.
Manual review, VSCode, Pytest
The smart contract should check that send was successful, and account for the possibility that the winner is a smart contract that cannot handle incoming native tokens.
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.