Skip to content
Business logic Audit finding Beginner

Old delegatee not deleted when delegating to new tokenId

The delegate function did not remove a token from its previous delegatee when delegating to a new token, so a user could delegate the same token to multiple token IDs and multiply its voting power. An attacker could therefore inflate their governance voting weight.

Lambda Follow

Originally disclosed on Code4rena

Submitted by Lambda, also found by 0x52, 0xA5DF, 0xDjango, 0xpiglet, 0xsanson, arcoun, Bahurum, berndartmueller, cccz, dipp, GalloDaSballo, GimelSec, GiveMeTestEther, Green, kenzo, kyteg, MEP, neumo, obront, panprog, rajatbeladiya, scaraven, and Twpony

VoteEscrowDelegation.sol#L80

In delegate, when a user delegates to a new tokenId, the tokenId is not removed from the current delegatee. Therefore, one user can easily multiply his voting power, which makes the toking useless for voting / governance decisions.

Proof Of Concept

Bob owns the token with ID 1 with a current balance of 1000. He also owns tokens 2, 3, 4, 5. Therefore, he calls delegate(1, 2), delegate(1, 3), delegate(1, 4), delegate(1, 5). Now, if there is a governance decision and getVotes is called, Bobs balance of 1000 is included in token 2, 3, 4, and 5. Therefore, he quadrupled the voting power of token 1.

Recommended Mitigation Steps

Remove the entry in delegatedTokenIds of the old delegatee or simply call removeDelegation first.

zeroexdead (Golom) confirmed

zeroexdead (Golom) commented:

Fixed.

Ref: https://github.com/golom-protocol/contracts/commit/c74d95b4105eeb878d2781982178db5ca08a1a9b


The original report as published on Code4rena, by Lambda. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 delegate function added the token ID to the new delegatee's list without removing it from the previous delegatee's list.

Impact

A user could multiply their voting power, making the token useless for voting and governance decisions.

What the attacker needed

Own at least two tokens; be able to call delegate

The fix

The issue was fixed by removing the token ID from the old delegatee's list, for example by calling removeDelegation first.

How it was found

  1. Bob owns token 1 with balance 1000 and also tokens 2, 3, 4, 5.
  2. Bob calls delegate(1, 2), delegate(1, 3), delegate(1, 4), delegate(1, 5).
  3. When getVotes is called, Bob's balance of 1000 is counted for tokens 2, 3, 4 and 5.

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, a token holder can assign their voting power to another token (called a delegatee). The bug meant that when they changed the delegatee, the old assignment was not cancelled, so the same voting power was counted in several places at once. This let someone make their vote count multiple times.

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.

More by Lambda

View all

64 more disclosed reports, best first.

More from Golom contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.