Reproduced Exploit

Burve — normalizing a single weight reverts the swap

Weight normalization turns an amount into a fraction with mulDivX256(weight, totalWeight). That helper requires the denominator to be strictly greater than the numerator. A one-element weight array has weight == totalWeight, so the require reverts, the swap reverts with it, and the 1000 underlying…

Jan 2025•Other•dos•3 min read

Chain

Other

Category

dos

Date

Jan 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: 55213-h-02-normalizing-token-weights-can-result-in-a-revert-pashov. Standalone Foundry PoC and full write-up: 55213-h-02-normalizing-token-weights-can-result-in-a-revert-pashov_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/dos/frozen-funds · vuln/logic/wrong-condition

Key info#

ProtocolBurve
FindingPashov Audit Group H-02, AuditVault 55213
Vulnerable codemulDivX256 requires denominator > num
HarmThe swap reverts and 1000 stays in the pool. The two-weight pool pays the trader 1000.
Chainlocal synthetic

TL;DR#

Weight normalization turns an amount into a fraction with mulDivX256(weight, totalWeight). That helper requires the denominator to be strictly greater than the numerator. A one-element weight array has weight == totalWeight, so the require reverts, the swap reverts with it, and the 1000 underlying deposited into the pool stays there. Weights 1 and 3 of a total of 4 pass the check, and that pool pays the trader 1000.

The vulnerable code#

SOLIDITY
self.weights[i] = FullMath.mulDivX256(
    self.weights[i],
    self.totalWeight
);
SOLIDITY
require(denominator > num, "0");

The report says to set the element to type(uint256).max when the two values are equal.

Root cause#

A single weight is the whole total. The fixed-point helper rejects that equality, so normalization cannot finish and every swap that normalizes first reverts.

Preconditions#

The pool's only weight is 100 and totalWeight is 100. The swap calls normalize before paying. The trader has deposited 1000 underlying into the pool in the same transaction.

Attack walkthrough#

  1. weights(0) equals totalWeight.
  2. 1000 underlying is transferred into the pool.
  3. swap calls normalize, which calls mulDivX256(100, 100).
  4. require(denominator > num) reverts. The swap frame reverts with it.
  5. The pool still holds 1000 and the trader has received nothing.
  6. The control pool has weights 1 and 3. Both are below 4, normalization succeeds, and the trader is paid 1000.

Diagrams#

flowchart TD A["Single weight equals totalWeight"] --> B["1000 is deposited"] B --> C["VULN: mulDivX256 reverts"] C --> D["Swap reverts and 1000 stays"] D --> E["Weights 1 and 3 pay 1000"]

Impact#

The swap cannot complete, so the 1000 underlying that entered the pool in this call does not come back out. A pool whose weights are not equal to the total pays the trader that 1000.

Remediation#

When weight == totalWeight, store the full-scale value, type(uint256).max, instead of calling mulDivX256.

How to reproduce#

BASH
cd 55213-h-02-normalizing-token-weights-can-result-in-a-revert-pashov_exp
forge test -vv

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.