Back to Blog

Solana rBPFでの新たな整数オーバーフローバグ発見

Code Auditing
December 30, 2021
3 min read

最近、当社の脆弱性検出システムは、Solana の rBPF(Solana の dApps がすべて実行される仮想マシンです:https://github.com/solana-labs/rbpf)において、重大な問題を発見しました。慎重な調査の結果、これは整数オーバーフローのバグであり、Solana ネットワーク全体をクラッシュさせるために悪用される可能性があることが判明しました。このバグを Solana セキュリティチームに報告したところ、チームは直ちに確認と修正に着手しました。本稿執筆時点では、ほぼすべてのバリデーターノードがパッチを受け取り最新バージョンにアップグレードしているため、公開開示しても安全であると言えます。

eBPFとrBPF

eBPF(Extended Berkeley Packet Filter)[1] は、当初カーネル内でのパケットフィルタリングのために開発されました。eBPF のセキュリティ、効率性、スケーラビリティから、現在ではネットワーキング、トレーシング、プロファイリングなど、さまざまな分野で使用されています[2]。eBPF の豊富な機能性を考慮し、Solana はスマートコントラクトの実行エンジンとしても採用しました。Solana 上で dApps を開発するためには、開発者は Rust でスマートコントラクトを開発し、それが eBPF バイトコードにコンパイルされます。

Solana の dApps をホストするには、eBPF 用の正確な仮想マシンが必要です。この場合、Solana は Rust で書かれた eBPF 用の仮想マシンである rBPF を使用します。しかし、提案されている仮想マシン(つまり rBPF)が堅牢で安全で正確であるかどうかは不明です。rBPF の内部にセキュリティ上の問題が存在すると、rBPF を含むすべてのバリデーターに影響が及ぶ可能性があり、Solana ネットワーク全体に甚大な損害(例:DDoS 攻撃)をもたらす可能性があります。

バグの根本原因

rBPF のバグを特定するためのツールを開発しました。このツールは現在も開発中です。このプロセス中に、rBPF(バージョン 0.2.16)で、ネットワーク全体をダウンさせる可能性のある深刻な問題が特定されました。

具体的には、「elf.rs」ファイル内の「load」関数は、ELF ファイル(スマートコントラクト)を解析および検証するために使用されます。「load」関数はまず ELF 構造を読み込み、「relocate」関数を呼び出して呼び出し元オフセットを設定します。しかし、「relocate」関数では、「sym.st_value」属性がELF ファイルから直接取得されます。「st_value」が十分に大きい場合、「sym.st_value」と「refd_pa」の合計である「addr」を計算する際に整数オーバーフローが発生する可能性があります。

この場合、攻撃者は悪意のある ELF ファイルをスマートコントラクトとして作成し、整数オーバーフローをトリガーすることができます。その後、すべてのバリデーターがターゲットの ELF ファイルを実行し、rBPF は「add with overflow」というエラーでパニックを起こします。

この時点で、rBPF はハングアップし、後続のトランザクションは実行されなくなるため、DoS 攻撃につながります。以下に示すように、ELF ファイルのロード中に整数オーバーフローが発生したため、ノードが「Finalizing transaction」でハングアップしていることがわかります。

この問題は https://github.com/solana-labs/rbpf/pull/200 で導入されたため、rBPF はバージョン 0.2.14 から脆弱でした。この問題を特定し、2021年12月6日に Solana セキュリティチームに報告しました。Solana は、報告後数時間で safemath 機構を使用して問題を修正しました。修正は https://github.com/solana-labs/rbpf/pull/236 にあります。本稿執筆時点(2021/12/30)で、バリデーターの 86% 以上が最新バージョンにアップグレードしています。

[1] https://en.wikipedia.org/wiki/Berkeley_Packet_Filter [2] https://ebpf.io/

タイムライン

  • 2021/12/06: Solana セキュリティチームに問題が報告されました。
  • 2021/12/06: 脆弱性が修正されました。
  • 2021/12/30: この脆弱性の情報が公開されました。
  • 2022/01/28: CVE-2021–46102 が割り当てられました。
Sign up for the latest updates
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 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.

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