Skip to content

Commit bb445a3

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 0ca9faf commit bb445a3

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
@@ -10731,8 +10731,10 @@ where
1073110731

1073210732
let abandon_if_payment = |context| {
1073310733
match context {
10734-
Some(OffersContext::OutboundPayment { payment_id, .. }) => {
10735-
self.abandon_payment(payment_id)
10734+
Some(OffersContext::OutboundPayment { payment_id, nonce, hmac }) => {
10735+
if signer::verify_payment_id(payment_id, hmac, nonce, expanded_key) {
10736+
self.abandon_payment(payment_id);
10737+
}
1073610738
},
1073710739
_ => {},
1073810740
}

0 commit comments

Comments
 (0)