← Back to All News & Security Advisories
'Node2Shell' and 'HTTP2Shell' (CVE-2026-111497): Brotli Decompression RCE in Node.js and HTTP
「Node2Shell / HTTP2Shell」(CVE-2026-111497):Node.js・HTTP基盤におけるBrotli解凍RCE脆弱性
| Critical Security Advisory
Comprehensive analysis of CVE-2026-111497 ('Node2Shell' / 'HTTP2Shell'), a critical out-of-bounds memory write vulnerability in the upstream C Brotli decoder (c/dec/decode.c) affecting Node.js, Python, Bun, Envoy, and HTTP reverse proxies processing Content-Encoding: br streams.
Google製C言語Brotliデコーダライブラリ(c/dec/decode.c)の境界外書き込みに起因し、Node.js、Python、Bun、Envoy、各種HTTPリバースプロキシに広範なリモートコード実行リスクをもたらす「Node2Shell / HTTP2Shell」(CVE-2026-111497)の技術詳細と対策を解説します。
1. Incident Overview: Why Both 'Node2Shell' and 'HTTP2Shell'?
CVE-2026-111497 is a critical memory corruption vulnerability (rated CVSS 9.2 by NVD and 9.8 by multiple downstream vendors) in Google's reference C implementation of the Brotli lossless data compression algorithm (libbrotli versions 1.0.3 through 1.2.0). The flaw was initially dubbed 'Node2Shell' after security researchers published weaponized Remote Code Execution (RCE) proof-of-concept exploits targeting stock Node.js HTTP servers and native fetch() clients.
As root-cause analysis progressed, the security community broadened the designation to 'HTTP2Shell' because the underlying defect resides in upstream c/dec/decode.c rather than JavaScript-specific glue code. Consequently, any HTTP server, API gateway, microservice runtime, or reverse proxy that automatically decompresses incoming HTTP payloads or responses bearing the Content-Encoding: br header using vulnerable libbrotli builds is exposed to pre-authentication memory corruption and potential RCE.
2. Technical Root Cause: Out-of-Bounds Write in Brotli c/dec/decode.c
The vulnerability is located in the Brotli decompression state machine inside c/dec/decode.c (introduced in Brotli v1.0.3 and present through v1.2.0). During the decoding of compressed meta-blocks that combine custom Huffman prefix trees with specific backward-reference distance codes and ring-buffer wrap-around transitions, the decoder miscalculates the remaining output window capacity when handling a specially crafted sequence of uncommitted literal and copy commands.
Specifically, when a malformed Brotli stream forces a ring-buffer reallocation boundary check to wrap around during partial chunk streaming, the decoder pointer advances past the allocated heap buffer boundary without triggering BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS. This produces a deterministic Out-of-Bounds (OOB) Heap Write with attacker-controlled decompressed bytes.
In Node.js processes, node:zlib binds directly to the C Brotli decoder on the V8/libuv native heap. By shaping heap allocations via concurrent HTTP requests and sending a crafted Content-Encoding: br payload (~4 KB), an attacker can overwrite adjacent C++ vtable pointers or libuv uv_stream_t callbacks, hijacking control flow to execute arbitrary shellcode or system() calls before the HTTP request ever reaches application route handlers.
3. Affected Runtimes, Libraries & HTTP Infrastructure
- Upstream C Library: Google Brotli (libbrotli / brotli-dec) versions 1.0.3 through 1.2.0 (Patched in Brotli 1.2.1).
- Node.js Runtime: Node.js 22.x prior to v22.23.4, Node.js 24.x prior to v24.22.1, and Node.js 26.x prior to v26.12.1. Exposed via node:zlib (brotliDecompress / createBrotliDecompress), built-in undici / global fetch() automatic response decompression, and middleware such as Express body-parser or Fastify when Brotli request decompression is enabled.
- End-of-Life (EOL) Node.js Releases: Node.js 18.x and Node.js 20.x ship with vulnerable statically compiled Brotli decoders and do not receive standard upstream releases.
- Python Ecosystem: brotli and brotlicffi PyPI packages prior to v1.2.1 (affecting aiohttp, urllib3, httpx, and Scrapy clients/servers when Brotli support is installed).
- Other Runtimes & Proxies: Bun (< v1.4.4), Envoy Proxy, Istio Service Mesh, NGINX dynamic ngx_brotli modules linked against libbrotli <= 1.2.0, .NET System.IO.Compression.BrotliDecoder, and libcurl compiled with --with-brotli.
4. Attack Vectors in Production Environments
- Inbound Server Vector (HTTP POST / PUT): An unauthenticated attacker sends an HTTP request with Header 'Content-Encoding: br' containing the malicious Brotli stream to any API endpoint that automatically decompresses request bodies.
- Outbound Client / SSRF / Webhook Vector: A backend service using Node.js fetch(), axios, Python httpx, or libcurl fetches an attacker-controlled URL (via webhook validation, OpenID metadata discovery, RSS/scraper ingestion, or AI agent web-fetching) which responds with 'Content-Encoding: br' and triggers RCE inside the client process.
- Edge Proxy & WAF Inspection Vector: Reverse proxies or security appliances that decompress Brotli traffic in-memory for Deep Packet Inspection (DPI) using unpatched system libbrotli packages.
5. Remediation & Immediate Edge Mitigations
- Upgrade Runtimes & System Libraries: Update Node.js to v22.23.4+, v24.22.1+, or v26.12.1+; upgrade system libbrotli1 packages on RHEL, Debian, and Ubuntu to 1.2.1+ (and restart all dependent daemons including nginx, envoy, php-fpm, and python workers); update Python brotli/brotlicffi to >= 1.2.1.
- Reverse Proxy / WAF Header Stripping (Zero-Downtime Mitigation): For legacy or EOL Node.js (v18/v20) and unpatched backend services, configure your front-end Nginx, HAProxy, Envoy, or cloud WAF to reject incoming requests containing 'Content-Encoding: br' (returning HTTP 415 Unsupported Media Type) and strip 'br' from outbound 'Accept-Encoding' headers.
- Nginx Example Rule: Add 'if ($http_content_encoding ~* "br") { return 415; }' and 'proxy_set_header Accept-Encoding "gzip, deflate";' in the server/location block protecting legacy upstream pools.
- Disable Automatic Brotli Decompression in Application Middleware: Set inflate/brotli options to false or restrict allowed encodings to ['gzip', 'deflate'] in Express body-parser, Fastify, and outbound HTTP client instances until binary patching is complete.
1. インシデント概要:なぜ「Node2Shell」および「HTTP2Shell」と呼ばれるのか?
CVE-2026-111497は、Googleが開発するBrotli可逆データ圧縮アルゴリズムのC言語リファレンス実装(libbrotli バージョン1.0.3〜1.2.0)に存在する極めて重大なメモリ破壊脆弱性(CVSSスコア 9.2〜9.8)です。当初、セキュリティ研究者がNode.jsの標準HTTPサーバーやネイティブfetch()クライアントを標的としたリモートコード実行(RCE)の実証コード(PoC)を公開したことから「Node2Shell」と命名されました。
しかしその後の根本原因解析により、欠陥はJavaScript固有のバインディングではなく上流のCライブラリ「c/dec/decode.c」自体に存在することが判明したため、現在ではより広範な影響を示す「HTTP2Shell」とも呼ばれています。すなわち、「Content-Encoding: br」ヘッダを持つHTTPリクエストやレスポンスを脆弱なlibbrotliで自動解凍するすべてのHTTPサーバー、APIゲートウェイ、マイクロサービス、リバースプロキシにおいて、認証前のメモリ破壊およびRCEのリスクが生じます。
2. 技術的根本原因:Brotliデコーダ(c/dec/decode.c)における境界外ヒープ書き込み
本脆弱性は、Brotli v1.0.3からv1.2.0までの「c/dec/decode.c」内の解凍ステートマシンに存在します。カスタムハフマン符号木と特定の後方参照距離コード、およびリングバッファの折り返し(ラップアラウンド)遷移を組み合わせた圧縮メタブロックをデコードする際、特殊なリテラルおよびコピー命令シーケンスが入力されると、デコーダが出力ウィンドウの残余容量計算を誤ります。
具体的には、細工されたBrotliストリームによってチャンクのストリーム解凍中にリングバッファ再確保の境界チェックがラップアラウンドを起こすと、エラー(BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS)を発生させることなく出力ポインタが確保済みヒープバッファの末尾を超えて前進します。その結果、攻撃者が制御可能な解凍データによる決定論的な境界外ヒープ書き込み(Out-of-Bounds Heap Write)が発生します。
Node.js環境では、「node:zlib」モジュールがV8/libuvのネイティブヒープ上でC言語のBrotliデコーダを直接呼び出しています。攻撃者は並行するHTTPリクエストでヒープ配置を整えた上で約4KBの細工された「Content-Encoding: br」ペイロードを送信することで、隣接するC++の仮想関数テーブル(vtable)ポインタやlibuvのuv_stream_tコールバックを上書きし、アプリケーションのルーティング処理に到達する前の段階で任意のシェルコードやOSコマンドを実行できます。
3. 影響を受けるランタイム・ライブラリ・HTTPインフラ基盤
- 上流Cライブラリ:Google Brotli(libbrotli / brotli-dec)バージョン 1.0.3 〜 1.2.0(Brotli 1.2.1にて修正済み)。
- Node.jsランタイム:Node.js 22.x(v22.23.4未満)、Node.js 24.x(v24.22.1未満)、Node.js 26.x(v26.12.1未満)。node:zlib、組み込みのundici / グローバルfetch()によるレスポンス自動解凍、およびBrotli解凍を有効化したExpress(body-parser)やFastifyなどのミドルウェアが影響を受けます。
- サポート終了(EOL)のNode.jsバージョン:Node.js 18.xおよび20.xは脆弱なBrotliデコーダを静的リンクしてビルドされており、上流からの標準パッチは提供されません。
- Pythonエコシステム:PyPIの「brotli」および「brotlicffi」パッケージ(v1.2.1未満)。Brotli解凍が有効なaiohttp、urllib3、httpx、Scrapy等のサーバー・クライアントに影響します。
- その他のランタイム・プロキシ:Bun(v1.4.4未満)、Envoy Proxy、Istio、脆弱なlibbrotliにリンクされたNGINX ngx_brotliモジュール、.NET(BrotliDecoder)、およびBrotli有効化ビルドのlibcurl。
4. 本番環境における主な攻撃ベクター
- インバウンドHTTPサーバー攻撃(POST / PUT):リクエストボディの自動解凍を行うAPIエンドポイントに対し、攻撃者が認証なしで「Content-Encoding: br」ヘッダ付きの悪性ペイロードを送信する手法。
- アウトバウンドHTTPクライアント攻撃(Webhook / クローラ / SSRF):Node.jsのfetch()、Pythonのhttpx、libcurl等を使用するバックエンドシステムが外部URLを取得する際、攻撃者サーバーから「Content-Encoding: br」レスポンスを返却してクライアント側プロセス内でRCEを引き起こす手法。
- エッジプロキシ・DPI機器でのインライン解凍:WAFやリバースプロキシが検査(DPI)のためにインメモリでBrotliストリームを解凍する構成。
5. 推奨される改修およびエッジプロキシでの即時緩和策
- ランタイムおよび共有ライブラリのアップデート:Node.jsをv22.23.4以上 / v24.22.1以上 / v26.12.1以上へ更新し、RHEL・Debian・Ubuntu等のシステムパッケージ「libbrotli1」を1.2.1相当の修正版へ更新(更新後はnginx、envoy、python等の常駐プロセスを再起動)してください。
- リバースプロキシ / WAFでのヘッダ遮断(ゼロダウンタイム緩和策):EOLとなったNode.js(v18/v20)や即座に再ビルドできないレガシー環境では、前段のNginx、HAProxy、Envoy、またはクラウドWAFにて「Content-Encoding: br」を含む受信リクエストを拒否(HTTP 415を返却)し、バックエンドや外部への「Accept-Encoding」ヘッダから「br」を除去してください。
- Nginx設定例:保護対象のlocationブロック等に『if ($http_content_encoding ~* "br") { return 415; }』および『proxy_set_header Accept-Encoding "gzip, deflate";』を追加することで、Brotliデコーダの呼び出し自体を完全に遮断できます。
- アプリケーション層でのBrotli自動解凍の無効化:バイナリ更新が完了するまでの間、Expressのbody-parserやFastify、外部通信用HTTPクライアントの許容エンコーディング設定を「gzip, deflate」のみに制限してください。