Back to Blog

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

Code Auditing
August 28, 2021

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
Tracing $1.6B in TRON USDT: Inside the VerilyHK Ponzi Infrastructure
Case Studies

Tracing $1.6B in TRON USDT: Inside the VerilyHK Ponzi Infrastructure

An on-chain investigation into VerilyHK, a fraudulent platform that moved $1.6B in TRON USDT through a multi-layered fund-routing infrastructure of rotating wallets, paired payout channels, and exchange exit funnels, with traced connections to the FinCEN-sanctioned Huione Group.

Drift Protocol Incident: Multisig Governance Compromise via Durable Nonce Exploitation
Security Insights

Drift Protocol Incident: Multisig Governance Compromise via Durable Nonce Exploitation

On April 1, 2026 (UTC), Drift Protocol on Solana suffered a $285.3M loss after an attacker exploited Solana's durable nonce mechanism to delay the execution of phished multisig approvals, ultimately transferring administrative control of the protocol's 2-of-5 Squads governance with zero timelock. With full admin privileges, the attacker created a malicious collateral market (CVT), inflated its oracle price, relaxed withdrawal protections, and drained USDC, JLP, SOL, cbBTC, and other assets through 31 rapid withdrawals in approximately 12 minutes. This incident highlights how durable nonce-based delayed execution can decouple signer intent from on-chain execution, bypassing the temporal assumptions that multisig security implicitly relies on.

Weekly Web3 Security Incident Roundup | Mar 23 – Mar 29, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Mar 23 – Mar 29, 2026

This BlockSec weekly security report covers eight DeFi attack incidents detected between March 23 and March 29, 2026, across Ethereum and BNB Chain, with total estimated losses of approximately $1.53M. Incidents include a $679K flawed burn mechanism exploit on the BCE token, a $512K spot-price manipulation attack on Cyrus Finance's PancakeSwap V3 liquidity withdrawal, a $133.5K flash-loan-driven referral reward manipulation on a TUR staking contract, and multiple integer overflow, reentrancy, and accounting error vulnerabilities in DeFi protocols. 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