Back to Blog

CVE-2021-39137の悪用に関する簡単な分析

Code Auditing
August 28, 2021

CVE-2021-39137 は、数日前に報告され修正された脆弱性です。しかし、すべてのEthereumノードがパッチを適用したわけではありません。この脆弱性が悪意のあるトランザクションによって悪用されていることを確認しました。

攻撃トランザクション

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

このトランザクションは、アドレス0x4に対するSTATICCALLを含んでいます。これはプリコンパイルされたスマートコントラクトdataCopyです。引数は以下の通りです。

inOffset = 0, inSize = 32, retOffset = 7 and 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の脆弱性は、ノードがパッチの更新をタイムリーに行わなかったために、悪意のあるトランザクションによって悪用されました。この欠陥は、Ethereum Virtual Machineのメモリ操作における欠陥を含んでいましたが、バージョン1.10.8で修正されました。システムのセキュリティを確保するため、すべてのEthereumノードは直ちに最新バージョンに更新することを推奨します。

謝辞

攻撃はSiwei Wu, Yufeng Hu, Lei Wu, Yajin Zhou@BlockSecによって分析されました。

Sign up for the latest updates
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.

Newsletter -  March 2026
Security Insights

Newsletter - March 2026

In March 2026, the DeFi ecosystem experienced three major security incidents. Resolv Protocol lost ~$80M due to compromised privileged infrastructure keys, BitcoinReserveOffering suffered ~$2.7M from a double-minting logic flaw, and Venus Protocol incurred ~$2.15M following a donation attack combined with market manipulation.

Best Security Auditor for Web3

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

BlockSec Audit