Reproduced Exploit

BaseGauge pays the distributor-wide reward rate and empties the other gauge's share

The gauge's own notified rate is 100 ether per second. The shared distributor's getRewardRate is 200 ether per second because a second gauge is funded from the same stream. _calculatePendingRewards writes that rate into currentRate and the single staker is paid 200 ether. claimFixed, which keeps th…

May 2025•Ethereum•logic•3 min read

Loss

100 ether of reward tokens that belonged to the other gauge

Chain

Ethereum

Category

logic

Date

May 2025

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: 66355-h-14-incorrect-reward-calculation-in-calculatependingreward. Standalone Foundry PoC and full write-up: 66355-h-14-incorrect-reward-calculation-in-calculatependingreward_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/logic/reward-calculation

Key info#

FieldValue
Loss100 ether of reward tokens that belonged to the other gauge
Vulnerable contractBaseGauge._calculatePendingRewards
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2025-05
Compilersolc 0.8.27, cancun, via IR
Bug classGauge copies the shared distributor rate

TL;DR#

The gauge's own notified rate is 100 ether per second. The shared distributor's getRewardRate is 200 ether per second because a second gauge is funded from the same stream. _calculatePendingRewards writes that rate into currentRate and the single staker is paid 200 ether. claimFixed, which keeps the notified rate, pays 100 ether and leaves 100 ether in the gauge.

Background#

Pashov Audit Group's May 2025 Regnum Aurum review, finding H-14 (AuditVault 66355). BaseGauge reads the reward rate from IGaugeRewardsDistributor.getRewardRate whenever a distributor is configured. That rate is not this gauge's notified amount.

The vulnerable code#

SOLIDITY
currentRate = rate; // @> VULN: distributor-wide rate replaces this gauge's notified rate
// FIX: keep the rate stored when this gauge was notified

The change that removes the harm:

DIFF
- currentRate = rate;
+ // keep notifiedRate

Root cause#

The pending-reward formula multiplies currentRate by the elapsed time. The assignment replaces the gauge-local rate with the distributor's global rate before that multiplication. One second at timestamp 1 therefore pays 200 ether instead of 100 ether.

Preconditions#

  • Distributor rate is 200 ether per second. This gauge was notified 100 ether per second and was funded with a 200 ether pot.
  • One staker owns the entire gauge supply.
  • lastUpdate is 0 and the block timestamp is 1, so one second of rewards is due.

Attack walkthrough#

  1. The staker deposits 1 ether of gauge weight.
  2. Fair payout at the notified rate is 100 ether.
  3. claim loads getRewardRate and stores 200 ether in currentRate.
  4. The gauge transfers 200 ether to the staker and its balance is 0.
  5. The control claimFixed pays 100 ether and leaves 100 ether in the gauge.

Diagrams#

flowchart TD A["Gauge notified rate is 100 ether per second"] --> B["claim reads the distributor rate"] B --> C["VULN writes 200 ether into currentRate"] C --> D["Staker is paid 200 ether and the pot is empty"] B --> E["Control claimFixed keeps 100 ether and leaves 100 ether"]

Impact#

The staker receives 200 ether. Half of that was the other gauge's allocation. After the buggy claim the reward pot is empty, so the other gauge cannot pay its stakers.

Remediation#

Do not copy getRewardRate from the distributor over the rate stored when this gauge was notified. Pay notifiedRate.

How to reproduce#

BASH
cd 66355-h-14-incorrect-reward-calculation-in-calculatependingreward_exp
forge test -vv

test_exploit is the harm. The control test is the guarded path. Captured output is output.txt.

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.