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

Merge PR 'Use the full 96-bit ChaCha20-Poly1305 nonce width for peer storage' (#5247)

Public commit record

What the developer wrote

Authored by Matt Corallo

81/100 · Strong
Merge PR 'Use the full 96-bit ChaCha20-Poly1305 nonce width for peer storage' (#5247)

from bot/5150-use-the-full-chacha20-poly1305-n-93a54f into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5247
Reviewed-by: Matt Corallo <matt@noreply.git.rust-bitcoin.org>
✓ 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 updates how an encryption nonce is generated for stored peer data. Previously only 8 bytes of randomness were used inside a 12-byte nonce, with the first 4 bytes forced to zero. Now all 12 bytes are filled with randomness, making the nonce the full size intended by the ChaCha20-Poly1305 algorithm. Using a too-small random space can, in some designs, raise the risk of nonce reuse, which is dangerous for this cipher. The patch is a hardening improvement rather than a clear-cut fix for an active vulnerability, because the surrounding code also appears to use random peer-storage keys that limit exposure.

Recommended action

Treat as a low-to-moderate cryptographic hardening fix. Review whether any persisted peer-storage blobs generated with the old 8-byte nonce format need migration or re-encryption, and confirm that the peer-storage key derivation remains random per peer and per restart so that the prior reduced nonce space did not create a practical collision window.

Security signals we found

01

Cryptographic nonce construction changed from 8-byte random to 12-byte random

02

ChaCha20-Poly1305 nonce field now uses full 96-bit width as specified by the algorithm

03

Hard-coded zero prefix removed from nonce derivation

04

Hardening of encrypted peer-storage format

Risk score

Why this scored 46/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 6/15
Affected reach 10/15
Confidence 7/10
Evidence quality 3/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.