Reproduced Exploit

ULTI: an existing top contributor kicks the lowest seat

When the top-contributor list already holds 33 entries, a later deposit still removes the lowest contributor and then sets the caller. If the caller is already on the list, set only updates that row, so the list shrinks from 33 to 32 and the lowest score is gone. A new account depositing 1 then fit…

Nov 2024•Ethereum•logic•4 min read

Loss

A sybil with score 1 takes the seat of a contributor with score 968 and is paid that seat's 100 ULTI. The rem…

Chain

Ethereum

Category

logic

Date

Nov 2024

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 43911-c-02-the-lowest-contributor-of-the-top-contributors-list-can. Standalone Foundry PoC and full write-up: 43911-c-02-the-lowest-contributor-of-the-top-contributors-list-can_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/logic/missing-check · vuln/logic/reward-calculation

Key info#

FieldValue
LossA sybil with score 1 takes the seat of a contributor with score 968 and is paid that seat's 100 ULTI. The removed contributor is paid 0
Vulnerable contract_updateTopContributors
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2024-11
Compilersolc 0.8.27, cancun, via IR

TL;DR#

When the top-contributor list already holds 33 entries, a later deposit still removes the lowest contributor and then sets the caller. If the caller is already on the list, set only updates that row, so the list shrinks from 33 to 32 and the lowest score is gone. A new account depositing 1 then fits in the freed seat. The bonus pays 100 ULTI to every remaining seat. The sybil receives 100. The removed contributor, whose score is 968, receives 0.

The vulnerable code#

SOLIDITY
if (updated > minContribution) {
    address doomed = minContributor;
    if (fixedMode) {
        bool added = _insert(who, updated);
        if (added) _remove(doomed);
    } else {
        _remove(doomed); // @> VULN: lowest is removed even though `who` is already on the list
        values[who] = updated;
        kicked = doomed;
    }
}

The review only removes the minimum when the caller was not already present:

DIFF
 if (updatedContribution > minContribution) {
-    _topContributors.remove(minContributor);
-    _topContributors.set(contributorAddress, updatedContribution);
+    if (_topContributors.set(contributorAddress, updatedContribution)) {
+        _topContributors.remove(minContributor);
+    }
 }

MAX_TOP_CONTRIBUTORS is 33, the same cap as the reviewed contract.

Root cause#

remove runs before the code knows whether set will insert a key. An update of an existing key does not insert, so the removal is not balanced by an addition. The length drops by one. The next depositor, at any positive score, takes the open seat because the length check is < 33 and no longer compares against the contributor who was just deleted.

Preconditions#

  • The list is full. The caller is on it with a score of 1,000,000. Thirty-two other scores fill the rest. The lowest is address 32 at 968.
  • The bonus pool holds 3300 ULTI, 100 per seat.
  • The caller then deposits 1 more, and a second account deposits 1.

Attack walkthrough#

  1. The first 33 deposits fill the list. The minimum is address 32 at 968.
  2. The same caller deposits 1. The score is still the highest on the list.
  3. The unfixed branch removes address 32 and writes the caller's updated score. kicked is address 32. Length is 32.
  4. The sybil deposits 1. Length is below 33, so the sybil is inserted.
  5. pay sends 100 ULTI to each of the 33 keys. The sybil's balance is 100. Address 32's balance is 0.
  6. The control updates the existing row in place, leaves address 32 seated, refuses the sybil, and pays address 32 the 100 ULTI.

Diagrams#

flowchart TD A["33 seats are full and the lowest score is 968"] --> B["That caller deposits 1 more"] B --> C["VULN removes the lowest seat"] C --> D["List length falls to 32"] D --> E["A score of 1 takes the open seat"] E --> F["Sybil is paid 100 ULTI and the removed contributor is paid 0"] B --> G["Control updates the existing row only"] G --> H["The 968 score stays and is paid 100 ULTI"]

Impact#

The contributor with score 968 loses the 100 ULTI seat bonus and is no longer in the set the review says is used for the pump and for top-distributor rewards. The replacement score is 1. The caller's own second deposit is what creates the hole. No other contributor has to cooperate.

How to reproduce#

BASH
cd 43911-c-02-the-lowest-contributor-of-the-top-contributors-list-can_exp
forge test -vv

test_exploit_sybil_takes_the_kicked_seat asserts the victim is gone, the sybil is seated, the sybil received 100 ULTI, and the victim received 0. test_control_existing_depositor_does_not_kick asserts the victim stays, the sybil is excluded, and the victim is paid 100 ULTI.

Sources#


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.