Back to Blog

Eine kurze Analyse der wilden Ausbeutung von CVE-2021-39137

Code Auditing
August 28, 2021

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

Angriffstransaktion

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

Diese Transaktion hat einen STATICCALL mit der Adresse 0x4. Dies ist ein vorkompilierter Smart Contract dataCopy. Das Argument lautet wie folgt.

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

Der 0x4 Smart Contract

Abbildung 1

Da das Ziel des STATICCALL der vorkompilierte Vertrag 0x4 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, der Mem[0:32] ist.

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

Schwachstelle

Im anfälligen 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 ändert versehentlich den Inhalt von ret. Das bedeutet, dass der Rückgabewert des vorkompilierten Vertrags 0x4 modifiziert wurde.

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 ändern kann.

Die Schwachstelle CVE-2021–39137 wurde durch eine bösartige Transaktion ausgenutzt, da die Knoten ihre Patches nicht rechtzeitig aktualisiert haben. Dieser Fehler beinhaltete 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-Knoten 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
Building a Secure Stablecoin Payment Network: BlockSec Partners with Morph
Partnership

Building a Secure Stablecoin Payment Network: BlockSec Partners with Morph

BlockSec has partnered with Morph as an official audit partner for the $150M Morph Payment Accelerator. By offering exclusive discounts on smart contract audits and penetration testing, BlockSec provides institutional-grade security to payment builders, ensuring a safe and resilient foundation for the future of global stablecoin payments.

Weekly Web3 Security Incident Roundup | Mar 9 – Mar 15, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Mar 9 – Mar 15, 2026

This BlockSec weekly security report covers eight DeFi attack incidents detected between March 9 and March 15, 2026, across Ethereum and BNB Chain, with total estimated losses of approximately $1.66M. Incidents include a $1.01M AAVE incorrect liquidation caused by oracle misconfiguration, a $242K exploit on the deflationary token MT due to flawed trading restrictions, a $149K exploit on the burn-to-earn protocol DBXen from `_msgSender()` and `msg.sender` inconsistency, and a $131K attack on AM Token exploiting a flawed delayed-burn mechanism. The report provides detailed vulnerability analysis and attack transaction breakdowns for each incident.

Venus Thena (THE) Incident: What Broke and What Was Missed

Venus Thena (THE) Incident: What Broke and What Was Missed

On March 15, 2026, an attacker bypassed the THE (Thena) supply cap on Venus Protocol (BNB Chain) through a donation attack, inflating a collateral position to 3.67x the intended limit and borrowing ~$14.9M in assets. Both sides lost money on-chain: Venus was left with ~$2.15M in bad debt after 254 liquidation bots competed across 8,048 transactions, while the attacker retained only ~$5.2M against a $9.92M investment. This deep dive examines what broke across three lines of defense (exposure limits, collateral valuation, and liquidation) and the monitoring gaps that left months of on-chain warning signals unacted upon.

Best Security Auditor for Web3

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

BlockSec Audit