Fraud Organizer Can Pass his own address or some other address to steal funds.
NOTE:
Some checks can be done off-chain for that but still wants to share my thoughts on Downside
The Organizer in the Protocol is responsible for sending funds to winners (also can be done by owner if not done by him). But he can manipulate the protocol in Two ways:
pass his own address and can call the deployProxyAndDistribute function to transfer the funds to the winners. And in that way he would be able to steal the funds.
An Organizer can pass some different fraud address to take the funds.
Here is a Test That Verifies that: [Test]
Only Doing Verification using KYC or some other way on frontend is not a solution for this as if he is able to withdraw all the tokens then retrieving the tokens would take a lot of time because of many issues(ex. legal process). And this may incur some extra cost as well.
Yes we need to make a lot of changes(some are mentioned in the Recommendations section) when organizer use some other address for stealing funds. This needs to be implemented properly. For this we can go with KYC like way. But for first case, we can add a condition like (winner address != organizer address). This can give us little bit guarantee that organizer cannot commit fraud or what could happen is he might send his own address mistakenly among the addresses of the winners. This check can help to prevent that.
Funds can be drained from the contract.
Manual Review
For the first case, It would be better if we can add a check during the transfer of funds in _distribute function to check if the winner is equal to Organizer or not(Yes we have to add the address of the organizer in the contract as well).
And In second case, The way could be little gas expensive if we want to protect the tokens from some different fraud address. Below are some ways to do that:
store an array of the winners in the ProxyFactory contract or Proxy contract and check against the list of winner's with the winners in the contract. And exmaple code:
Or we can use Merkle Trees(Can be created easily with Openzeppelin contracts) to store the same info in more gas efficient manner. An example code:
NOTE:
Make appropriate checks for who can use these functions
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.