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

lnonion: make comparisons more constant time

Public commit record

What the developer wrote

Authored by f321x

68/100 · Adequate
lnonion: make comparisons more constant time

makes hmac comparisons and onion error decoding more constant time
according to bolt 4. However things might still not be perfectly
constant time, however this seems out of scope for timing over network.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit hardens Electrum's Lightning onion routing code against timing attacks. It replaces a normal HMAC comparison with a constant-time one, so an attacker can't learn secrets by measuring how quickly checks fail. It also changes how failed onion error messages are decoded so that the number of hops in a payment route is hidden, matching the Lightning network specification.

Recommended action

Review util.constant_time_compare for correctness and ensure it is truly constant-time across supported Python versions. Consider whether other HMAC or equality comparisons in the Lightning path handling should also be hardened. No immediate user action is required beyond applying the update.

Security signals we found

01

constant-time HMAC comparison added

02

onion error decoding loop fixed to 27 iterations to hide route length

03

dummy shared secret used for padding iterations

04

references BOLT 04 onion-routing specification

05

timing side-channel mitigation in Lightning onion processing

Risk score

Why this scored 49/100

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