Back to Blog

CVE-2021–39137 漏洞被野蛮利用的简要分析

Code Auditing
August 28, 2021
2 min read

CVE-2021-39137 是一个在几天前被报告并修复的漏洞。然而,并非所有以太坊节点都应用了此补丁。我们观察到此漏洞已被恶意交易利用。

攻击交易

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

该交易有一个指向 0x4 地址的 STATICCALL。这是一个预编译的智能合约 dataCopy。参数如下:

inOffset = 0, inSize = 32, retOffset = 7, retSize = 32。

0x4 智能合约

图 1

由于 STATICCALL 的目标是 0x4 预编译合约,它将执行图 1 中的 RunPrecompiledContract 函数。

图 2

图 3

根据图 2/3,0x4 智能合约只是返回 in 指针的引用。

图 4

图 5

图 4 是 STATICCALL 操作码的代码。在第 751 行,args 指向 EVM 内存的 [inOffset ~ inOffset + inSize] 部分,即 Mem[0:32]。

根据图 5 以及对 0x04 代码逻辑(图 2/3)的分析,返回值 (ret) 是指向与 args 相同内存的引用。也就是说,它也指向 Mem[0:32]。

漏洞

在有漏洞的代码(版本 1.10.7)中,第 762 行将 ret 的内容复制到 Mem[retOffset : retOffset + retOffset],即从 Mem[0:32] 复制到 Mem[7:7+32]。此操作意外地改变了 ret 的内容。这意味着 0x4 预编译合约的返回值已被修改。

在已修复的版本(1.10.8)中,它复制了 ret(第 766 行)。由于第 767 行的复制操作不会修改 ret 的内容,因此可以修复此漏洞。

由于节点未及时更新补丁,CVE-2021–39137 漏洞被恶意交易利用。此缺陷涉及以太坊虚拟机内存操作中的一个缺陷,但已在 1.10.8 版本中修复。为确保系统安全,建议所有以太坊节点立即更新到最新版本。

致谢

本次攻击由 BlockSec 的 Siwei Wu, Yufeng Hu, Lei Wu, Yajin Zhou 分析。

Sign up for the latest updates
Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026

This BlockSec weekly security report covers four attack incidents detected between April 13 and April 19, 2026, across multiple chains such as Ethereum, Unichain, Arbitrum, and NEAR, with total estimated losses of approximately $310M. The highlighted incident is the $290M KelpDAO rsETH bridge exploit, where an attacker poisoned the RPC infrastructure of the sole LayerZero DVN to fabricate a cross-chain message, triggering a cascading WETH freeze across five chains and an Arbitrum Security Council forced state transition that raises questions about the actual trust boundaries of decentralized systems. Other incidents include a $242K MMR proof forgery on Hyperbridge, a $1.5M signed integer abuse on Dango, and an $18.4M circular swap path exploit on Rhea Finance's Burrowland protocol.

The Decentralization Dilemma: Cascading Risk and Emergency Power in the KelpDAO Crisis
Security Insights

The Decentralization Dilemma: Cascading Risk and Emergency Power in the KelpDAO Crisis

This BlockSec deep-dive analyzes the KelpDAO $290M rsETH cross-chain bridge exploit (April 18, 2026), attributed to the Lazarus Group, tracing a causal chain across three layers: how a single-point DVN dependency enabled the attack, how DeFi composability cascaded the damage through Aave V3 lending markets to freeze WETH liquidity exceeding $6.7B across Ethereum, Arbitrum, Base, Mantle, and Linea, and how the crisis forced decentralized governance to exercise centralized emergency powers. The article examines three parameters that shaped the cascade's severity (LTV, pool depth, and cross-chain deployment count) and provides an exclusive technical breakdown of Arbitrum Security Council's forced state transition, an atomic contract upgrade that moved 30,766 ETH without the holder's signature.

Weekly Web3 Security Incident Roundup | Apr 6 – Apr 12, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 6 – Apr 12, 2026

This BlockSec weekly security report covers four DeFi attack incidents detected between April 6 and April 12, 2026, across Linea, BNB Chain, Arbitrum, Optimism, Avalanche, and Base, with total estimated losses of approximately $928.6K. Notable incidents include a $517K approval-related exploit where a user mistakenly approved a permissionless SquidMulticall contract enabling arbitrary external calls, a $193K business logic flaw in the HB token's reward-settlement logic that allowed direct AMM reserve manipulation, a $165.6K exploit in Denaria's perpetual DEX caused by a rounding asymmetry compounded with an unsafe cast, and a $53K access control issue in XBITVault caused by an initialization-dependent check that failed open. The report provides detailed vulnerability analysis and attack transaction breakdowns for each incident.

Best Security Auditor for Web3

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

BlockSec Audit