Back to Blog

Kurze Analyse der wilden Ausbeutung von CVE-2021–39137

Code Auditing
August 28, 2021
3 min read

CVE-2021-39137 ist eine Schwachstelle, die vor wenigen Tagen gemeldet und behoben wurde. Jedoch haben noch nicht alle Ethereum-Nodes den Patch angewendet. Wir beobachten, dass diese Schwachstelle durch eine bösartige Transaktion ausgenutzt wurde.

Angriffstransaktion

https://tx.blocksecteam.com/tx/0x1cb6fb36633d270edefc04d048145b4298e67b8aa82a9e5ec4aa1435dd770ce4

Diese Transaktion enthält einen STATICCALL mit der Adresse 0x4. Dies ist ein vorkompilierter Smart Contract, dataCopy. Das Argument ist wie folgt.

inOffset = 0, inSize = 32, retOffset = 7 und retSize = 32.

Der 0x4 Smart Contract

Abbildung 1

Da das Ziel des STATICCALL der 0x4 vorkompilierte Vertrag ist, wird die Funktion RunPrecompiledContract in Abbildung 1 ausgeführt.

Abbildung 2

Abbildung 3

Gemäß Abbildung 2/3 gibt der 0x4 Smart Contract einfach die Referenz des in-Zeigers zurück.

Abbildung 4

Abbildung 5

Abbildung 4 zeigt den Code für den Opcode STATICCALL. In Zeile 751 zeigt args auf [inOffset ~ inOffset + inSize ] des EVM-Speichers, was Mem[0:32] ist.

Gemäß Abbildung 5 und der Analyse der Code-Logik von 0x04 (Abbildung 2/3) ist der Rückgabewert (ret) eine Referenz auf denselben Speicher wie args. Das bedeutet, er zeigt ebenfalls auf Mem[0:32].

Schwachstelle

Im verwundbaren Code (Version 1.10.7) kopiert Zeile 762 den Inhalt von ret nach Mem[retOffset : retOffset + retOffset], d.h. kopiert Mem[0:32] nach Mem [7:7+32]. Diese Operation verändert versehentlich den Inhalt von ret. Das bedeutet, der Rückgabewert des 0x4 vorkompilierten Vertrags wurde modifiziert.

In der behobenen Version (1.10.8) wird eine Kopie von ret erstellt (Zeile 766). Dies kann die Schwachstelle beheben, da die Kopie in Zeile 767 den Inhalt von ret nicht verändern kann.

Die Schwachstelle CVE-2021–39137 wurde aufgrund von Nodes, die ihre Patches nicht rechtzeitig aktualisierten, durch eine bösartige Transaktion ausgenutzt. Dieser Fehler betraf einen Defekt in den Speicheroperationen der Ethereum Virtual Machine, wurde aber in Version 1.10.8 behoben. Um die Systemsicherheit zu gewährleisten, wird allen Ethereum-Nodes dringend empfohlen, sofort auf die neueste Version zu aktualisieren.

Danksagungen

Der Angriff wird von Siwei Wu, Yufeng Hu, Lei Wu, Yajin Zhou@BlockSec analysiert.

Sign up for the latest updates
~$4.72M Lost: TAC, Transit Finance & More | BlockSec Weekly
Security Insights

~$4.72M Lost: TAC, Transit Finance & More | BlockSec Weekly

This BlockSec weekly security report covers 3 notable attack incidents identified between May 11 and May 17, 2026, across TRON, TON, and Ethereum, with total estimated losses of approximately $4.72M. Three incidents are analyzed in detail: the highlighted $1.88M Transit Finance exploit on TRON, where a deprecated swap bridge contract with lingering token approvals was exploited through arbitrary calldata forwarding; the $2.8M TAC TON-to-EVM bridge exploit caused by missing canonical wallet verification in the jetton deposit flow; and the $46.75K Boost Hook exploit on Ethereum, where spot price manipulation on a Uniswap V4 hook-based perpetual protocol forced the protocol to buy tokens at inflated prices using its own reserves.

~$15.9M Lost: Trusted Volumes, Wasabi & More | BlockSec Weekly
Security Insights

~$15.9M Lost: Trusted Volumes, Wasabi & More | BlockSec Weekly

This BlockSec bi-weekly security report covers 11 notable attack incidents identified between April 27 and May 10, 2026, across Sui, Ethereum, BNB Chain, Base, Blast, and Berachain, with total estimated losses of approximately $15.9M. Three incidents are analyzed in detail: the highlighted $1.14M Aftermath Finance exploit on Sui, where a signed/unsigned semantic mismatch in the builder-fee validation allowed an attacker to inject a negative fee that was converted into positive collateral during settlement; the $5.87M Trusted Volumes RFQ authorization mismatch on Ethereum; and the $5.7M Wasabi Protocol infrastructure-to-contract-control compromise across multiple EVM chains.

Newsletter - April 2026
Security Insights

Newsletter - April 2026

In April 2026, the DeFi ecosystem experienced three major security incidents. KelpDAO lost ~$290M due to an insecure 1-of-1 DVN bridge configuration exploited via RPC infrastructure compromise, Drift Protocol suffered ~$285M from a multisig governance takeover leveraging Solana's durable nonce mechanism, and Rhea Finance incurred ~$18.4M following a business logic flaw in its margin-trading module that allowed circular swap path manipulatio

Best Security Auditor for Web3

Validate design, code, and business logic before launch. Aligned with the highest industry security standards.

BlockSec Audit