[Hardening] Reject non-object JSON notifications without panicking (F-008)
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- rust
- 領域
- networking, security
調査の方向性
raw_client.rs の764~773行付近で、通知経路がJSONレスポンスのフィールドを読み取る箇所から始めてください。オブジェクト以外のJSON値がどのように処理されるかを確認し、スカラー、配列、nullの通知に対する回帰テストを追加してください。無効な通知形式がpanicを起こさず通常のプロトコルエラーまたはパースエラーを返し、nullのネガティブコントロールでは引き続きpingが完了すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
In rust-electrum-client 0.25.2 (reported upstream commit 7c1d759e2789b5e46fcae1525ab06ff4012bc668), the reader notification path accesses resp["method"].take(). A server-pushed JSON scalar without an id is treated as a notification, but mutable indexing a scalar JSON value panics. A malicious or compromised Electrum server (or an attacker able to alter the Electrum connection) can therefore cause client/wallet availability loss in a release build.
Reproduction
- Build the client in release mode.
- Negotiate protocol version 1.4.
- While a request is in flight, send this line:
5
Observed:
serde_json panic: cannot access key "method" in JSON number
A null notification was tested as a negative control and the subsequent ping completed normally.
Source
Reported source location: raw_client.rs lines 764–773 (in the affected revision).
Suggested hardening
- Require a JSON object before reading notification fields, or use non-panicking accessors such as get("method").
- Return a normal protocol/parse error for invalid notification shapes.
- Add regression tests for scalar, array, and null notifications.
This is a hardening issue: the demonstrated impact is availability loss in release mode; no fund or privacy compromise was observed.
- 主要言語
- Rust
- スター
- 89
- フォーク
- 87
- 平均マージ
- 1時間 25分
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bitcoindevkit/rust-electrum-client のほかの issue
-
[Hardening] Validate legacy block_headers length before slicing (F-007)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
bitcoindevkit/rust-electrum-client#221 · コメント 1 件 ·
-
use-rustls-ring transitively enables rustls/default (aws-lc-rs), breaking ring-only builds対応中かも @EddieHouston が 130 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
discussion new feature
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
bitcoindevkit/rust-electrum-client#211 · コメント 2 件 ·
-
Rework CI to use `cargo-rbmt`再び着手できるかも @luisschwab が 205 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
bitcoindevkit/rust-electrum-client#202 · 担当者 1 名 ·
bitcoindevkit/rust-electrum-client の issue をすべて見る
似ている issue
-
Panic on live viewport resize when unstyled elements exist in display: none subtree対応中かも @GoCoder7 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DioxusLabs/blitz#1488 ·
メンテナーはふだん 1 日以内に返信
-
🏷️ good first issue enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
S-Needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
vectordotdev/vrl#2042 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信