Back to Blog

Solana rBPFにおける新たな整数オーバーフローバグが発見される

Code Auditing
December 30, 2021

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

eBPF と rBPF

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

Solana の dApp をホストするには、eBPF 用の正確な仮想マシンが必要です。この場合、Solana は rBPF、つまり Rust で書かれた eBPF 用の仮想マシンを使用します。しかし、提案された仮想マシン(つまり 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
Tether Freezes $6.76M USDT Linked to Iran's IRGC & Houthi Forces: Why On-Chain Compliance is Now a Geopolitical Battlefield
Security Insights

Tether Freezes $6.76M USDT Linked to Iran's IRGC & Houthi Forces: Why On-Chain Compliance is Now a Geopolitical Battlefield

Looking ahead, targeted freezing events like this $6.76M USDT action will only become more common. On-chain data analysis is improving. Stablecoin issuers are also working closely with regulators. As a result, hidden illicit financial networks will be exposed.

Weekly Web3 Security Incident Roundup | Mar 2 – Mar 8, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Mar 2 – Mar 8, 2026

During the week of March 2 to March 8, 2026, seven blockchain security incidents were reported with total losses of ~$3.25M. The incidents occurred across Base, BNB Chain, and Ethereum, exposing critical vulnerabilities in smart contract business logic, token deflationary mechanics, and asset price manipulation. The primary causes included a double-minting logic flaw during full token deposits that allowed an attacker to exponentially inflate their balances through repeated burn-and-mint cycles, a price manipulation vulnerability in an AMM-based lending market where artificially inflated vault shares created divergent price anchors to incorrectly force healthy positions into liquidation, and a flawed access control implementation relying on trivially spoofed contract interfaces that enabled attackers to bypass authorization to batch-mint and dump arbitrary tokens.

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

Weekly Web3 Security Incident Roundup | Feb 23 – Mar 1, 2026

During the week of February 23 to March 1, 2026, seven blockchain security incidents were reported with total losses of ~$13M. The incidents affected multiple protocols, exposing critical weaknesses in oracle design/configuration, cryptographic verification, and core business logic. The primary drivers included oracle manipulation/misconfiguration that led to the largest loss at YieldBloxDAO (~$10M), a crypto-proof verification flaw that enabled the FOOMCASH (~$2.26M) exploit, and additional token design and logic errors impacting Ploutos, LAXO, STO, HedgePay, and an unknown contract, underscoring the need for rigorous audits and continuous monitoring across all protocol layers.