Description: The initial creator funding is the state which is intended to be static and not changeable, so that the voters have correct expectations. If the funding changes after some voters voted, it breaks the expectations. Moreover, if the voting is in the attacker's interest, the voters can always be incentivized by increasing the funding. Smart contract should provide voters with 100% rights equality, so that no one could break or change them. Even though the contract does not have fallback/receive
functions, the attacker can increase the funding by his/her own contract's selfdestruct
command. Thus, the voting results can be corrupted.
Impact: The voting results can be corrupted by interested person.
Proof of Concept:
The creator creates the voting contract with 1 ETH funding.
Some voters want to vote "against".
The attacker can incentivize the "against" voters to vote "for", by proposing the bigger funding, which will be distributed among the "for" voters by the smart contract itself.
Attacker send more ETH to the voting contract, the "against" voters become "for" voters (bad voters), the bad voters receive free money, attacker receives needed voting result, classical corruption environment inside the smart contract
Proof of Code
Place the following into VotingBoothTest.t.sol
And also place the following into VotingBoothTest.t.sol
after the test contract:
Recommended Mitigation: It is recommended to create the separate i_funding
immutable variable, which will be written by the creator in the constructor with the sent msg.value
. Then the contract should use i_funding
instead of address(this).balance
to distribute among the voters. Thus, even though attacker can send money to the contract, the voters will not receive higher rewarding.
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.