Skip to content
DoS Audit finding Intermediate

getVotes inside the BlackGovernor incorrectly provides block.number instead of block.timestamp , leading to complete DOS of proposal functionality

The BlackGovernor contract's proposal function passes block.number instead of block.timestamp to getVotes, causing the voting power check to always revert because it looks up a timestamp far in the past. This prevents any proposal from being created, completely blocking governance functionality.

hakunamatata Follow with Egbe

Originally disclosed on Code4rena

Submitted by hakunamatata, also found by Egbe

https://github.com/code-423n4/2025-05-blackhole/blob/main/contracts/BlackGovernor.sol#L95-L107

https://github.com/code-423n4/2025-05-blackhole/blob/main/contracts/governance/Governor.sol#L268-L271

https://github.com/code-423n4/2025-05-blackhole/blob/main/contracts/governance/Governor.sol#L414-L416

https://github.com/code-423n4/2025-05-blackhole/blob/main/contracts/governance/Governor.sol#L746-L753

https://github.com/code-423n4/2025-05-blackhole/blob/main/contracts/VotingEscrow.sol#L1263-L1279

Finding description and impact

Whenever user is making a proposal inside the BlackGovernor, the contract checks whether their voting power meets the proposal threshold. However, this check is copied from the ThenaFi contracts which is incorrect. I disclosed the vulnerability to the ThenaFI team, however, the bug is not present in the live contracts as ThenaFI team has informed me.

The check is incorrect as it passes the (block.number - 1) to the getVotes function that expects timestamp:

function  _proposal(

address[] memory targets,

uint256[] memory values,

bytes[] memory calldatas,

string  memory description

) internal virtual returns (uint256) {

//@audit CRITICAL getVotes expects timestamp and calls getsmNFTPastVotes that also expects timestamp

require(
getVotes(_msgSender(), block.number - 1) >= proposalThreshold(),

"Governor: proposer votes below proposal threshold"

);

We can see from the code that function calls getVotes, providing block number instead of timestamp, which calls getsmNFTPastVotes that expects timestamp and will check checkpoint that is “closest” (not exactly it’s a mental shortcut) to the provided timestamp which will be blocknumber - 1 in this case.

As block.number is way smaller than block.timestamp the check of proposal threshold will always revert leading to DOS of proposal functionality. This is due to the fact that it will check the voting power at the timestamp that is even before the project has launched (because block.number is way smaller than the block.timestamp).

This bug prevents all proposals from being created, which breaks core governance functionality. Given its impact and the fact that it can occur under normal usage without any external trigger,I believe this qualifies as a High severity issue.

Recommended mitigation steps

Change block.number to block.timestamp.

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

This POC shows that even if user meets threshold proposal, due to incorrect value passed to getVotes the call reverts. If one would change the block.number to block.timestamp. The proposal call does not revert.

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 GovernanceProposeRevertTest 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_proposeRevertGetVote() 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);
                vm.expectRevert( "Governor: proposer votes below proposal threshold");
        uint proposalId = blackGovernor.propose(
            targets,
            values,
            calldatas,
            "Nudge proposal"
        );

}
}

Blackhole mitigated

Status: Mitigation confirmed. Full details in reports from rayss, lonelybones and maxvzuvex.

The sponsor team requested that the following note be included:

This issue originates from the upstream codebase, inherited from ThenaV2 fork. Given that ThenaV2 has successfully operated at scale for several months without incident, we assess the severity of this issue as low. The implementation has been effectively battle-tested in a production environment, which significantly reduces the practical risk associated with this finding. Reference: https://github.com/ThenafiBNB/THENA-Contracts/blob/main/contracts/governance/Governor.sol#L256


The original report as published on Code4rena, by hakunamatata. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

The code passes block.number to getVotes, which expects a timestamp, causing the voting power lookup to use a time far in the past.

Impact

All proposals are blocked, completely disabling governance functionality.

What the attacker needed

User has enough voting power; User attempts to create a proposal

The fix

The fix is to change block.number to block.timestamp in the proposal threshold check.

How it was found

  1. Deploy the contracts and set up a user with enough tokens.
  2. User locks tokens in VotingEscrow to gain voting power.
  3. User calls propose on BlackGovernor.
  4. The transaction reverts with 'Governor: proposer votes below proposal threshold'.

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.

A smart contract for governance checks if a user has enough voting power before allowing them to create a proposal. It mistakenly uses the current block number (a count of blocks) instead of the current timestamp (time in seconds), so it looks up voting power at a time before the project even existed. As a result, the check always fails and no one can create proposals.

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.

More by hakunamatata

View all

7 more disclosed reports, best first.

More from Blackhole

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.