Malicious organizer can set close time to current time, deploy and distribute the tokens sent to the precomputed proxy address to himself
Let's take a look at the deployProxyAndDistribute
function in ProxyFactory.sol
:
Notice the comment above the if (saltToCloseTime[salt] > block.timestamp) revert ProxyFactory__ContestIsNotClosed();
check . It says :
// can set close time to current time and end it immediately if organizer wish
. This is allowed by design in the protocol. However here is what can happen due to this feature:
The owner sets a contest with a particular organizer address
In this scenario the sponsor must not be the organizer himself. So a sponsor loads the precomputed proxy address from the getProxyAddress
function with tokens
Then the organizer calls deployProxyAndDistribute
with the array of winners being his address and the percentage being 95 percent or 95000 basis points , so the checks in Distributor.sol._distribute()
work
The result is that the organizer transfers 95 percent of the prize pool to himself.
Failure to distribute earned prizers to supporters
Manual Review
I believe this feature should be disallowed. For that purpose the check in deployProxyandDistribute
on L134 can be rewritten to :
if (saltToCloseTime[salt] >= block.timestamp) revert ProxyFactory__ContestIsNotClosed();
Additionaly it can be checked that winners[i] != tx.origin in the Distributor.sol._distribute()
function. Tx.origin is used here because it will be equal to the initial caller of the deployProxyAndDistribute
which is the orgranizer. I am convinced that none of the risks associated with the use ot tx.origin can endanger the protocol if it is used as I proposed above.
So , having in mind my missing address(0) check for winners[i] finding, the L125-L133 section of the Distributor.sol._distribute()
method can look like this
The second mitigation also keep the feautre of having the right to end a contest immediately as an organizer.
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.