Reproduced Exploit

A flat takeFees call zeroes the next management fee

Anyone can call takeFees while the share value is still equal to the high water mark. No shares are minted, but feesUpdatedAt becomes the current timestamp. After the vault accrues yield, the management fee for that elapsed second is 0. A second vault that does not get the flat call mints more than…

Dec 2024•Ethereum•logic•3 min read

Loss

The fee recipient is minted 0 shares instead of more than 1000 ether

Chain

Ethereum

Category

logic

Date

Dec 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: 45888-attacker-can-grief-the-management-fee-to-be-lesser-than-expe. Standalone Foundry PoC and full write-up: 45888-attacker-can-grief-the-management-fee-to-be-lesser-than-expe_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/logic/fee-calculation · vuln/dos/griefing

Key info#

FieldValue
LossThe fee recipient is minted 0 shares instead of more than 1000 ether
Vulnerable contractFeeVault.takeFees
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2024-12
Compilersolc 0.8.27, cancun, via IR
Bug classManagement-fee clock updates with no accrual

TL;DR#

Anyone can call takeFees while the share value is still equal to the high water mark. No shares are minted, but feesUpdatedAt becomes the current timestamp. After the vault accrues yield, the management fee for that elapsed second is 0. A second vault that does not get the flat call mints more than 1000 ether of fee shares for the same second.

Background#

Zokyo's December 2024 VaultCraft review. The report shows fees.feesUpdatedAt = uint64(block.timestamp) running even when the call minted nothing. Management fee is managementFee times assets times the time since feesUpdatedAt, divided by a 365.25 day year.

The vulnerable code#

SOLIDITY
feesUpdatedAt = uint64(block.timestamp); // @> VULN: clock moves even when share value did not and no fee was minted
// FIX: if (fee == 0) return; do not write feesUpdatedAt

The change that removes the harm:

DIFF
- feesUpdatedAt = uint64(block.timestamp);
+ if (fee > 0) feesUpdatedAt = uint64(block.timestamp);

Root cause#

The fee formula's only time input is block.timestamp - feesUpdatedAt. Writing the timestamp on a zero-fee call deletes the elapsed time. The next call, even after assets increase, multiplies by zero.

Preconditions#

  • Both vaults start with assets and supply equal to 31557600 * 1000 ether, a 100 percent management fee, and feesUpdatedAt of 0.
  • The block timestamp is 1.
  • The griefed vault is called once before the yield and once after. The control vault is called only after the yield.

Attack walkthrough#

  1. Flat takeFees mints 0 and sets feesUpdatedAt to 1.
  2. Assets increase by 1 ether.
  3. The second takeFees computes a zero duration and mints 0.
  4. The control vault's single takeFees uses a one-second duration and mints more than 1000 ether of shares to the fee recipient.

Diagrams#

flowchart TD A["takeFees while share value is flat"] --> B["VULN feesUpdatedAt becomes the current timestamp"] B --> C["Yield accrues"] C --> D["Next fee multiplies by a zero duration and mints 0"] A --> E["Control skips the flat call and mints more than 1000 ether"]

Impact#

The fee recipient of the griefed vault receives no shares for that second of assets under management. The control recipient receives more than 1000 ether of shares. A caller can repeat the flat call and keep the management fee at 0.

Remediation#

Write feesUpdatedAt only when a nonzero fee was minted, which is the report's recommendation not to update the clock when share value did not increase.

How to reproduce#

BASH
cd 45888-attacker-can-grief-the-management-fee-to-be-lesser-than-expe_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.