Non unique contest id allows for a signature replay attack between different versions. If an owner creates a new contest with the same contestId and organizer but a different implementation an attacker can reuse organizer's old signature to distribute funds.
Distribute by signature doesn't have AC set which allows anyone including the attacker to call this function.
https://github.com/Cyfrin/2023-08-sparkn/blob/main/src/ProxyFactory.sol#L152
Consider a case when there are 2 contests with the same contestId organized by the same entity BUT the implementation is different due to a version upgrade for example. There's NOTHING preventing that from happening since setContest only checks for salt collision
https://github.com/Cyfrin/2023-08-sparkn/blob/main/src/ProxyFactory.sol#L114
This means that if prize distribution for the first contest happened via signature scheme then one of the winners can reuse the same signature to distribute funds for the second one.
Add to ProxyFactoryTest.t.sol:
Stolen funds
Easiest fix would be to set AC to onlyOwner for deployProxyAndDistributeBySignature
An alternative solution would be to make a contestId unique
With this implementation one just needs to pass contestId when distributing funds. No need for (organiser, constestId, implementation). This is more expensive in terms of gas but you can free up storage once the contest finishes and get a refund.
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.