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

bech32: check for invalid/unnecessary trailing bits.

Public commit record

What the developer wrote

Authored by Rusty Russell

91/100 · Strong
bech32: check for invalid/unnecessary trailing bits.

There's a new test for bolt12 in commit 7153bed9705d7493 ("BOLT 12:
add test vector for invalid bech32 padding (#1312)") which requires us
to b stricter in decoding.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit tightens how Core Lightning decodes bech32 strings—the format used for things like Bitcoin addresses and BOLT 12 offers. Previously, extra padding bits at the end of a bech32 string were silently thrown away, even if they were non-zero or unnecessarily long. Now the decoder rejects those cases. The change is driven by a new BOLT test vector that requires stricter decoding, and it could prevent subtle malleability or parsing-confusion issues where two different-looking bech32 strings decode to the same data.

Recommended action

Treat this as a correctness and likely low-grade security hardening fix. Review any other call sites of bech32_pull_bits() or similar decoders in the codebase to ensure they enforce the same rules, and consider adding regression tests for the new BOLT test vectors. Users processing untrusted bech32/BOLT 12 strings should upgrade to avoid accepting malformed encodings.

Security signals we found

01

Stricter input validation in a widely-used encoding decoder

02

Rejection of non-zero trailing padding bits that were previously silently discarded

03

Rejection of superfluous 5-bit groups that expand the encoded string without carrying data

04

Potential malleability reduction for BOLT 12 offers and other bech32 payloads

05

Change triggered by an updated BOLT specification test vector

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.