getsmNFTPastVotes incorrectly checks for Voting Power leading to some NFTs incorrectly being eligible to vote
The getsmNFTPastVotes function checks whether a token is currently a smart NFT rather than whether it was one at the queried timestamp, so tokens that became smart NFTs later are counted as having voting power at earlier times. This can give an account more past voting power than it should have, letting it propose or vote with inflated weight in the BlackGovernor contract.
Originally disclosed on Code4rena
Submitted by hakunamatata
https://github.com/code-423n4/2025-05-blackhole/blob/main/contracts/VotingEscrow.sol#L1263-L1279
The getsmNFTPastVotes function checks what was the voting power of the some account at specific point in time.
function getsmNFTPastVotes(
address account,
uint timestamp
) public view returns (uint) {
uint32 _checkIndex = VotingDelegationLib.getPastVotesIndex(
cpData,
account,
timestamp
);
// Sum votes
uint[] storage _tokenIds = cpData
.checkpoints[account][_checkIndex].tokenIds;
uint votes = 0;
for (uint i = 0; i < _tokenIds.length; i++) {
uint tId = _tokenIds[i];
if (!locked[tId].isSMNFT) continue;
// Use the provided input timestamp here to get the right decay
votes =
votes +
VotingBalanceLogic.balanceOfNFT(
tId,
timestamp,
votingBalanceLogicData
);
}
return votes;
We can see in the snippet above that if specific token is not smNFT RIGHT NOW (as locked mapping stores current state of tokenId); it skips its voting power in the calculation. However, the function DOES NOT take into the consideration that specific tokenId can be smNFT right now, but could be permanent/not permanent NFT at timestamp - timestamp. This means that if some NFTs at timestamp X was not-permanent locked position, now it’s smNFT (it is possible inside the VotingEscrow to update NFTs to smNFTs), the voting power from the timestamp X will be added to the votes variable calculation which is incorrect as at this point in time X, the nft WAS NOT smNFT.
The biggest impact here is that BlackGovernor contract uses the getsmNFTPastVotes to determine the voting power of the account at some point in time (and the calculation is incorrect). This leads to some users having calculated bigger voting power than they should have leading to for example proposals being proposed from users who SHOULD NOT have that ability or votes casted using bigger power than actual.
Recommended mitigation steps
When calculating check whether at timestamp NFT was actually smNFT.
Status: Mitigation confirmed. Full details in reports from maxvzuvex and rayss.
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 function filters tokens using the current isSMNFT flag instead of the token's state at the requested timestamp.
Impact
Accounts could have inflated past voting power, potentially allowing proposals from users who should not have that ability or votes cast with more weight than actual.
What the attacker needed
A token that became a smart NFT after the timestamp
The fix
The check should verify whether the NFT was actually a smart NFT at the queried timestamp, and the project confirmed a mitigation.
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 NFT is a special locked token that carries voting power. The function that looks up how much voting power an account had in the past checks the token's current type instead of its type at that past moment, so a token that only became a smart NFT later is wrongly counted. This can let someone appear to have had more voting power than they really did.
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.