[Hardening] Reject non-object JSON notifications without panicking (F-008)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust
- Domain
- networking, security
Research direction
Start in raw_client.rs around lines 764–773, where the notification path reads the JSON response fields. Check how non-object JSON values are handled, then add regression coverage for scalar, array, and null notifications. Done means invalid notification shapes return a normal protocol or parse error without panicking, while the null negative control still allows the ping to complete.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Rust
- Stars
- 89
- Forks
- 87
- Avg merge
- 1h 25m
- Merged PRs (30d)
- 4
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bitcoindevkit/rust-electrum-client
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
bitcoindevkit/rust-electrum-client#221 · 1 comment ·
-
use-rustls-ring transitively enables rustls/default (aws-lc-rs), breaking ring-only buildsPossibly taken @EddieHouston claimed this 130 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
discussion new feature
Difficulty 4/5 3-5 days Newbie friendliness 48/100
bitcoindevkit/rust-electrum-client#211 · 2 comments ·
-
Rework CI to use `cargo-rbmt`May be free again @luisschwab claimed this 205 days ago, and no pull request is open. Open
bitcoindevkit/rust-electrum-client#202 · 1 assignee ·
All issues in bitcoindevkit/rust-electrum-client
Similar issues
-
area:frontend kind:bug priority:p3 ready
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
bug priority: medium ui
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
storytold/vectorcraft#6333 · 1 comment ·
Maintainers usually reply within 1 day
-
bug lexer
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
yara-x fails to build with rsa 0.10.0: unresolved import rsa::Pkcs1v15SignPossibly taken @CfirTsabari claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 87/100
VirusTotal/yara-x#865 ·
Maintainers usually reply within 1 day
-
good first issue help wanted program
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
hffgzktbcc-blip/ounce-core#297 ·
Maintainers usually reply within 1 day