Proposal vote power can be easily manipulated
The voting power for a proposal is calculated using the token balance at a single block before the proposal was created, so an attacker could take a large loan for that one block and use the borrowed tokens to vote. This could let them pass arbitrary proposals with minimal risk.
Submitted by DadeKuma
Lines of code
https://github.com/code-423n4/2023-07-arcade/blob/main/contracts/ArcadeGSCCoreVoting.sol#L32
Impact
ArcadeGSCCoreVoting can be a target of vote manipulation. An attacker might be able to take a huge loan (even uncollateralized) for a single block before creating a proposal.
When voting, only this single block is checked when calculating the votingPower. This may lead to an attacker being able to execute arbitrary proposals with minimal risks involved.
Proof of Concept
When a proposal is created, the timestamp registered is the block before the creation. This mitigates flash loan attacks, but it’s still possible to manipulate the vote with a normal loan:
proposals[proposalCount] = Proposal(
proposalHash,
// Note we use blocknumber - 1 here as a flash loan mitigation.
uint128(block.number - 1), //@audit created
uint128(block.number + lockDuration),
uint128(block.number + lockDuration + extraVoteTime),
uint128(quorum),
proposals[proposalCount].votingPower,
uint128(lastCall)
);
During a vote, the msg.sender voting power is queried and it will use the previous created field:
for (uint256 i = 0; i < votingVaults.length; i++) {
// ensure there are no voting vault duplicates
for (uint256 j = i + 1; j < votingVaults.length; j++) {
require(votingVaults[i] != votingVaults[j], "duplicate vault");
}
require(approvedVaults[votingVaults[i]], "unverified vault");
votingPower += uint128(
IVotingVault(votingVaults[i]).queryVotePower(
msg.sender,
proposals[proposalId].created,
extraVaultData[i]
)
);
}
If the attacker took a huge loan (even uncollateralized) for that single block, they would be able to manipulate the vote with minimal slippage, as it’s only one block.
If this happens, they would be able to execute any arbitrary code, if queryVotePower depends on the amount of tokens held by the attacker.
Note about severity
By reading the comments in ArcadeGSCCoreVoting it seems that the voting vault used will be the ArcadeGSCVault:
* The Arcade GSC Core Voting contract allows members of the GSC vault to vote on and execute proposals
* in an instance of governance separate from general governance votes.
In this case, this issue can’t occur, as the votingPower does not depend on the amount held by the attacker:
// If the address queried is the owner they get a huge number of votes
// This allows the primary governance timelock to take any action the GSC
// can make or block any action the GSC can make. But takes as many votes as
// a protocol upgrade.
if (who == owner) {
return 100000;
}
// If the who has been in the GSC longer than idleDuration
// return 1 and otherwise return 0.
if (
members[who].joined > 0 &&
(members[who].joined + idleDuration) <= block.timestamp
) {
return 1;
} else {
return 0;
}
However, it’s worth noting that this situation might change in the future, as ArcadeGSCCoreVoting approved vaults can be multiple, and they are not immutable:
/// @notice Updates the status of a voting vault.
/// @param vault Address of the voting vault.
/// @param isValid True to be valid, false otherwise.
function changeVaultStatus(address vault, bool isValid) external onlyOwner {
approvedVaults[vault] = isValid;
}
As there are other vaults that use tokens as voting power (e.g. LockingVault), there is a real possibility that this might occur in the future, so I’m flagging it as high severity.
Recommended Mitigation Steps
Consider using a TWAP to check the voting power of a proposal, instead of checking only the block before the proposal was created.
Assessed type
Timing
PowVT (Arcade.xyz) confirmed, disagreed with severity and commented:
Should make adding approved vaults to the
ArcadeGSCcontract revert. Will only use theGSCVaulthere and can eliminate any potential for the scenario described above. I would mark it as medium, as this is not the intended usage of theGSCCoreVotingcontract and there are high custom quorums for sensitive actions like approving a new vault.
0xean (judge) decreased severity to Medium and commented:
Will only use the GSCVault here and can eliminate any potential for the scenario described above.
Based on this being a vote among the steering council I think M is the correct severity here.
- The Arcade GSC Core Voting contract allows members of the GSC vault to vote on and execute proposals.
- In an instance of governance separate from general governance votes.
I would argue this issue is medium. The report says an attacker can take a loan in certain block to take most of the voting power. I argue that if attackers can lend this amount, they already own this amount, and
TWAPwon’t save protocol; it just requires the funds to be frozen in this governance token for several blocks to become available in voting. But it doesn’t mitigate the described attack.The lending market, especially in blockchain, is overcollateralized; you can’t lend more than deposited. I don’t see the difference between the described attack vector and the 51% attack which is obviously out of scope. This issue is more suitable in an analysis report.
The lending market, especially in blockchain, is overcollateralized; you can’t lend more than deposited.
This is false, undercollateralized lending exists.
TWAPitself doesn’t make the protocol immune to multi-block attacks, but it definitely helps mitigate the issue by making them exponentially difficult to perform in comparison to a single-block check.The solution proposed by the sponsor mitigates this issue if multiple vaults are not required:
Should make adding approved vaults to the
ArcadeGSCcontract revert. Will only use theGSCVaulthere and can eliminate any potential for the scenario described above. I would mark it as medium, as this is not the intended usage of theGSCCoreVotingcontract and there are high custom quorums for sensitive actions like approving a new vault.
- From an economic view, there is no undercollateralized lending. What you refer to is more similar to real life lending, where you provide collateral; not immediately, but undertake to repay it in the future. In other words, you can’t lend more than you will have to at the end of repayment; no one will give you money for free. Otherwise it is just crowdfunding for a 51% attack.
- Compound-like governance framework and
ERC20Votesis at least battle tested and they use similar approach in counting votes. Can it be medium vulnerability?As I understand (but can be wrong), the proposed solution by the sponsor blocks the usage of vaults with voting tokens. But I argue that these vaults are not vulnerable.
To add another note here, since there is no way to override the
changeVaultStatusin CoreVoting because it is not virtual, the other easier fix would be to set thecustomQuorumfor interacting with this function unattainably high. This is more than likely the direction we will pursue, since no contract changes are needed.
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
Likely the voting power is checked at a single historical block (the block before proposal creation) rather than averaged over time, allowing a temporary token balance to influence the vote.
Impact
An attacker could manipulate votes and execute arbitrary proposals, but the report notes that with the intended GSCVault this cannot occur because voting power does not depend on token holdings; the risk exists only if other token-based vaults are approved in the future.
What the attacker needed
A voting vault that uses token balance; ability to obtain a large loan for one block; proposal creation and voting in same block
The fix
The sponsor suggested making adding approved vaults to the ArcadeGSC contract revert, or setting an unattainably high custom quorum for changing vault status; the report recommends using a TWAP to check voting power.
How it was found
- Take a large loan (even uncollateralized) for a single block.
- Create a proposal in that same block so the recorded creation block is the one with the loaned tokens.
- Vote on the proposal using the loaned tokens as voting power.
- Execute the proposal if it passes.
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 some blockchain voting systems, your voting power is based on how many tokens you hold at a specific moment. If that moment is just one block in the past, someone can borrow a huge number of tokens for that single block, vote, and then return them, without really owning them. This report points out that such a trick could let an attacker pass proposals they shouldn't be able to.
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.