Griefer can minimize delegatee’s voting power
The delegate function allowed the same lock NFT to be delegated multiple times, so an attacker could fill a victim's delegated token array with worthless tokens up to the 500 limit, reducing the victim's voting power to zero. This could be used to grief a delegatee during a live proposal.
Submitted by 0xDjango, also found by 0x52, 0xsanson, kenzo, MEP, and simon135
Similar to a previous submission, there are no checks preventing against delegating the same lock NFT multiple times. This opens an avenue to an expensive but potentially profitable griefing attack where the malicious user fills the victim’s delegated token array with minimum voting power. The attacker can ensure that a delegatee has 0 voting power.
Proof of Concept
Taking a look at the delegate() function below, there are no checks that a lock NFT has not already been delegated. Therefore, an attacker can delegate their token with minimum voting power (threshold initialized with value 0) to the victim.
function delegate(uint256 tokenId, uint256 toTokenId) external {
require(ownerOf(tokenId) == msg.sender, 'VEDelegation: Not allowed');
require(this.balanceOfNFT(tokenId) >= MIN_VOTING_POWER_REQUIRED, 'VEDelegation: Need more voting power');
delegates[tokenId] = toTokenId;
uint256 nCheckpoints = numCheckpoints[toTokenId];
if (nCheckpoints > 0) {
Checkpoint storage checkpoint = checkpoints[toTokenId][nCheckpoints - 1];
checkpoint.delegatedTokenIds.push(tokenId);
_writeCheckpoint(toTokenId, nCheckpoints, checkpoint.delegatedTokenIds);
} else {
uint256[] memory array = new uint256[](1);
array[0] = tokenId;
_writeCheckpoint(toTokenId, nCheckpoints, array);
}
emit DelegateChanged(tokenId, toTokenId, msg.sender);
}
There is a limit of 500 delegated tokens per delegatee. Therefore, the attacker can ensure minimum voting power if they delegate a worthless token 500 times to the victim:
function _writeCheckpoint(
uint256 toTokenId,
uint256 nCheckpoints,
uint256[] memory _delegatedTokenIds
) internal {
require(_delegatedTokenIds.length < 500, 'VVDelegation: Cannot stake more');
A more likely scenario would be as follows:
- A proposal is live.
- Users delegate their voting power to addresses of their choosing.
- A and B are around the same voting power.
- A and B both have 400 delegatees.
- Malicious address A delegates minimum voting power 100 times to fill B’s array to 500.
- Address A can self-delegate just a bit more to obtain more voting power.
Recommended Mitigation Steps
Firstly, removing the ability to delegate the same lock NFT would make this griefing attack much more expensive. Even if that is patched, a griefing attack is still possible by simply creating more locks and delegating them all once.
I believe that removing the 500 delegated token limit would prove to mitigate this issue.
We plan to keep sufficiently high
MIN_VOTING_POWER_REQUIREDto prevent spam.
Removed the ability to delegate same NFT. If user is trying to delegate same NFT, the old delegation will be removed.
Reference: https://github.com/golom-protocol/contracts/commit/c74d95b4105eeb878d2781982178db5ca08a1a9b
I agree with the ranking of medium. This is a direct attack vector, but it’s unlikely to be used.
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 delegate function lacked a check to prevent the same lock NFT from being delegated more than once, and the delegated token array had a hard limit of 500 entries.
Impact
The attacker could ensure that a delegatee has 0 voting power, but the attack is expensive and unlikely to be used.
What the attacker needed
Attacker owns a lock NFT with minimum voting power; victim has a delegated token array near the 500 limit; a proposal is live
The fix
The ability to delegate the same NFT was removed, so re-delegating replaces the old delegation.
How it was found
- A proposal is live and users delegate their voting power.
- Attacker A and victim B have similar voting power and both have 400 delegatees.
- Attacker A delegates a minimum-voting-power token 100 times to fill B's array to 500.
- Attacker A self-delegates a bit more to gain more voting power than B.
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 voting system, people lock tokens and can delegate their voting power to someone else. The code did not stop someone from delegating the same locked token over and over. An attacker could spam a victim's list of delegated tokens with tiny amounts until it was full, so the victim's real voting power was ignored.
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.