Attacker can perform griefing attack via bytes data param ,breaking protocol invariants
It is said that in Distributor: line 👉 108 The winners and percentages array are supposed not to be so long, so the loop can stay unbounded:
but it isn't checked,or given a MAX limit for winner.length so a attacker can still pass data with a very long array of winners and equal percentages.
In ProxyFactory::deployProxyAndDistribute() a attacker can pass data by including a long array of winners ,equally in percentage it will end up in calling _distribute() function then ,
in _distribute(..) function only thing which is checked is if (winners.length == 0 || winners.length != percentages.length) revert Distributor__MismatchedArrays();
Consider admin creates a new contest calling ProxyFactory::setContest(...) passing the address of Jason and giving him a contestId ..otherparms,
So now Jason can call deployProxyAndDistribute() ,he has the authority to pass any arbitrary data to the function
Copy below test into ./test/integration/ProxyFactoryTest.t.sol
Run forge test --match-path ./test/integration/ProxyFactoryTest.t.sol -vvv
OutPut
Attacker can perform griefing attack breaking the invariant at the line 108 Distributer.sol
Foundry
consider adding a check for a limit for max_Winners and check it is equal to percentages.length before the loop
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.