Skip to content

Commit 127016f

Browse files
committed
Authenticate payment_id from OffersContext
Before abandoning a payment when receiving an InvoiceError, verify that the PaymentId included in the OffersContext with the included HMAC. This prevents a malicious actor sending an InvoiceError with a known payment id from abandoning our payment.
1 parent 7d65f64 commit 127016f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10724,8 +10724,10 @@ where
1072410724

1072510725
let abandon_if_payment = |context| {
1072610726
match context {
10727-
Some(OffersContext::OutboundPayment { payment_id, .. }) => {
10728-
self.abandon_payment(payment_id)
10727+
Some(OffersContext::OutboundPayment { payment_id, nonce, hmac }) => {
10728+
if signer::verify_payment_id(payment_id, hmac, nonce, expanded_key) {
10729+
self.abandon_payment(payment_id);
10730+
}
1072910731
},
1073010732
_ => {},
1073110733
}

0 commit comments

Comments
 (0)