AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 51 Bitcoin

common: correctly refuse to accept wireaddr with port == 0.

Public commit record

What the developer wrote

Authored by Rusty Russell

81/100 · Strong
common: correctly refuse to accept wireaddr with port == 0.

BOLT 7 says this, but we don't do it. (Actually, it only says that for certain types,
but I've fixed that in https://github.com/lightning/bolts/pull/1331).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This change tightens how Core Lightning handles network addresses it receives from other nodes. Previously, the code would accept an address even if its port number was 0. The patch now treats port 0 as a signal to ignore the address, matching the Lightning protocol specification (BOLT 7). It also improves error reporting so callers can tell the difference between a malformed address, an unknown address type, and an address that should simply be skipped. The main risk is that a peer could announce a useless port-0 address and, before this fix, the node might have tried to use it in ways that caused confusion or minor failures.

Recommended action

Treat as a low-to-moderate hardening patch. Review whether any other callers outside the changed files still use fromwire_wireaddr() with a boolean check, and update them. Consider adding explicit tests for port-0 wireaddr handling and for malformed/unknown/ignore return-code paths. No urgent security response appears required based solely on this diff.

Security signals we found

01

Protocol conformance fix: rejects/ignores wireaddr with port == 0 per BOLT 7

02

API change from boolean to explicit return codes improves failure distinguishability

03

Potential DoS/harmless peer behavior: accepting port-0 addresses could lead to storing or attempting to connect to invalid endpoints

04

No explicit memory safety, cryptographic, or remote-code-execution signals in the diff

Risk score

Why this scored 51/100

Our methodology →
Potential impact 12/30
Exploitability 10/25
Stealth signal 8/15
Affected reach 10/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.