Log blinded route tails without payload bytes
What changed, and why it matters
This change fixes a logging issue where paying a BOLT 12 invoice could cause the software to write an unusually large log entry. The previous code printed every byte of encrypted data from the invoice's hidden payment path as a long list of numbers, which could waste disk space, slow down logging, and potentially disrupt log collection systems. The fix prints only a short summary and the length of each encrypted payload instead.
Apply the patch. Review other Debug-derived logging of attacker-influenced byte vectors in the codebase to ensure bounded output. Consider adding a lint or test that prevents logging raw encrypted payloads at INFO or higher levels.
Security signals we found
CWE-779: Logging of Excessive Data
Potential log amplification / log flooding via attacker-controlled input
INFO-level logging of unbounded recipient-provided ciphertext
BOLT 12 invoice blinded path cloned into route before logging
Evidence from the diff
The DebugRoute Display implementation in lightning/src/util/macro_logger.rs previously formatted Path::blinded_tail using the derived Debug trait, which recursively emitted every byte of BlindedHop::encrypted_payload as a decimal list. Because the default router logs routes at INFO level after cloning the recipient-provided blinded path from a BOLT 12 invoice, an attacker-issued invoice could cause log records to scale with attacker-controlled ciphertext size. The patch replaces the derived Debug output with bounded, human-readable lines: the tail’s blinding point, excess CLTV delta, final value, per-Trampoline hop details, and per-blinded hop node id plus encrypted payload length. This bounds each log line to roughly 150 bytes regardless of payload size.
Changed components
lightning/src/util/macro_logger.rsDebugRoute Display formatterDefault router INFO-level route loggingInspect captured patch +31 / −1
### lightning/src/util/macro_logger.rs
@@ -64,7 +64,37 @@ impl<'a> core::fmt::Display for DebugRoute<'a> {
h.cltv_expiry_delta
)?;
}
- writeln!(f, " blinded_tail: {:?}", p.blinded_tail)?;
+ // Blinded hops' encrypted payloads are recipient-provided and of unbounded size, so
+ // log only each hop's payload length rather than expanding the payload bytes.
+ match &p.blinded_tail {
+ Some(blinded_tail) => {
+ writeln!(
+ f,
+ " blinded_tail: blinding_point: {}, excess_final_cltv_expiry_delta: {}, final_value_msat: {}",
+ log_pubkey!(blinded_tail.blinding_point),
+ blinded_tail.excess_final_cltv_expiry_delta,
+ blinded_tail.final_value_msat
+ )?;
+ for h in blinded_tail.trampoline_hops.iter() {
+ writeln!(
+ f,
+ " trampoline node_id: {}, fee_msat: {}, cltv_expiry_delta: {}",
+ log_pubkey!(h.pubkey),
+ h.fee_msat,
+ h.cltv_expiry_delta
+ )?;
+ }
+ for h in blinded_tail.hops.iter() {
+ writeln!(
+ f,
+ " blinded node_id: {}, encrypted_payload_len: {}",
+ log_pubkey!(h.blinded_node_id),
+ h.encrypted_payload.len()
+ )?;
+ }
+ },
+ None => writeln!(f, " blinded_tail: None")?,
+ }
}
Ok(())
}Why this scored 58/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.