Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: low
Valid

Incorrect event can be spammed multiple times via `veRAACToken::recordVote`

Summary

The veRAACToken::recordVote has no restrictions on which proposal is being passed, which will emit an incorrect event in case of a non-exsistent proposal. Even if we consider this as dead code, the incorrect event spam is inevitable.

Vulnerability Details

The veRAACToken::recordVote function is primarily used for recording vote using the voting power of the users, the event is emitted showcasing the weightage of the vote.

function recordVote(
address voter,
uint256 proposalId
) external {
if (_hasVotedOnProposal[voter][proposalId]) revert AlreadyVoted();
_hasVotedOnProposal[voter][proposalId] = true; <<@ - // Lack of restrictions
uint256 power = getVotingPower(voter);
emit VoteCast(voter, proposalId, power);
}

However, the issue lies in lack of restrictions provided here as any non-exsistent proposal can be passed an voted onto, emitting an incorrect event.

Impact

  1. Emits an event which is incorrect as the proposalId which is being voted here does not even exists.

  2. Even if this code is considered to be dead code, malicious actor can still spam incorrect event multiple times.

Proof of Concept

Add the following test case inside the veRAACToken.test.js file:

describe("Anyone can record vote", async () => {
it("should allow anyone to record a vote on behalf of a user", async () => {
await veRAACToken.connect(users[0]).lock(ethers.parseEther("1000"), 365 * 24 * 3600);
await veRAACToken.connect(users[0]).recordVote(users[0].address, 123456); // Emits an incorrect event
});
})

Tools Used

Manual Review
/
Hardhat

Recommendations

Either restrict proposal votes to only proposals which have been proposed (the whole code has to be re-worked / finished) or if this is dead code, kindly remove to avoid event spams.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

veRAACToken::recordVote lacks access control, allowing anyone to emit fake events

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.