<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <updated>2023-07-14T13:01:50Z</updated>
  <generator>https://nostr.ae</generator>

  <title>Nostr notes by callebtc [ARCHIVE]</title>
  <author>
    <name>callebtc [ARCHIVE]</name>
  </author>
  <link rel="self" type="application/atom+xml" href="https://nostr.ae/npub1wlhtt0d2g4yu7plwqq4rnwfrda8du7xlvs8v57c32u0wear0v8tq6h90xk.rss" />
  <link href="https://nostr.ae/npub1wlhtt0d2g4yu7plwqq4rnwfrda8du7xlvs8v57c32u0wear0v8tq6h90xk" />
  <id>https://nostr.ae/npub1wlhtt0d2g4yu7plwqq4rnwfrda8du7xlvs8v57c32u0wear0v8tq6h90xk</id>
  <icon></icon>
  <logo></logo>




  <entry>
    <id>https://nostr.ae/nevent1qqsqlstffvlv6w9hdpmk4kv5zh7g87alqgagjjwmlur53x7rrvwm2vqzypm7adda4fz5nnc8acqz5wdeydh5ahncmajqajnmz9t3am85dasavtfktp3</id>
    
      <title type="html">📅 Original date posted:2023-07-06 🗒️ Summary of this ...</title>
    
    <link rel="alternate" href="https://nostr.ae/nevent1qqsqlstffvlv6w9hdpmk4kv5zh7g87alqgagjjwmlur53x7rrvwm2vqzypm7adda4fz5nnc8acqz5wdeydh5ahncmajqajnmz9t3am85dasavtfktp3" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsfzuykzl9zcek4f84xm4xqjk7pc9t8nffjllrauhhwzr6ape8jfms0c8rga&#39;&gt;nevent1q…8rga&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2023-07-06&lt;br/&gt;🗒️ Summary of this message: LNbits discovered an exploit in their system that allowed attackers to create fake balances by manipulating invoices. They have patched the issue and urge users to update their software.&lt;br/&gt;📝 Original message:&lt;br/&gt;Hi Rusty, &lt;br/&gt;&lt;br/&gt;I actually think I answered most of these questions in my previous post.&lt;br/&gt;&lt;br/&gt;- We do remember everything about the invoice in the db. &lt;br/&gt;- We check where it is going (internal or external).&lt;br/&gt;- We can&amp;#39;t meaningfully check the signature (we don&amp;#39;t know &amp;#34;our&amp;#34; pubkey, LNbits supports many different LN backends, some without that info).&lt;br/&gt;- The problem is we index invoices by preimage_hash and assume it commits to payment details.&lt;br/&gt;&lt;br/&gt;This is not a super-weird setup, I&amp;#39;ve contacted multiple service providers before posting and most do the same thing. Those that were safe were using the mitigation steps I outlined in my OP.&lt;br/&gt;&lt;br/&gt;Happy to expand on this in more detail if needed.&lt;br/&gt;&lt;br/&gt;Best&lt;br/&gt;Calle&lt;br/&gt;&lt;br/&gt;------- Original Message -------&lt;br/&gt;On Thursday, July 6th, 2023 at 09:10, Rusty Russell &amp;lt;rusty at rustcorp.com.au&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&amp;gt; Um, this is a super-weird setup AFAICT.&lt;br/&gt;&amp;gt; &lt;br/&gt;&amp;gt; You generate an invoice, but you don&amp;#39;t remember anything about it? Um,&lt;br/&gt;&amp;gt; OK, stateless invoices are a thing, but there&amp;#39;s a metadata field for&lt;br/&gt;&amp;gt; that?&lt;br/&gt;&amp;gt; &lt;br/&gt;&amp;gt; Someone pays an invoice, you don&amp;#39;t check the place it&amp;#39;s going (which,&lt;br/&gt;&amp;gt; y&amp;#39;know, signed it), you check some other field?&lt;br/&gt;&amp;gt; &lt;br/&gt;&amp;gt; I&amp;#39;ve never used lnbits and I&amp;#39;m clearly missing something...&lt;br/&gt;&amp;gt; &lt;br/&gt;&amp;gt; Thanks!&lt;br/&gt;&amp;gt; Rusty.&lt;br/&gt;&amp;gt; &lt;br/&gt;&amp;gt; callebtc via Lightning-dev lightning-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt; &lt;br/&gt;&amp;gt; writes:&lt;br/&gt;&amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; Dear list,&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; earlier last month, our team at LNbits discovered a rather interesting exploit which wich would enable an attacker to create balances out of thin air by abusing a quirk in how invoices are handled internally. We&amp;#39;ve patched this in LNbits version 0.10.5 and urge anyone to update ASAP if you haven&amp;#39;t done so already. I want to describe the attack here, since my gut feeling is that carrying out the same exploit is possible in other Lightning applications. If you&amp;#39;re working on custodial wallets, payment processors, account management software, etc. you probably want to read this.&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; In short, the attacker was able to insert a bolt-11 payment hash of payment A into a different payment, creating a malicious invoice B that can trick the backend into believing that B == A.&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; Here is how it goes:&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; - Attacker creates invoice A of amount 1000 sat in LNbits&lt;br/&gt;&amp;gt; &amp;gt; - Attacker creates invoice B&amp;#39; of amount 1 sat on her own node&lt;br/&gt;&amp;gt; &amp;gt; - Attacker deserializes B&amp;#39;, inserts payment_hash(A) into payment_hash(B), re-signs the invoice, and serializes it again, producing malicious invoice B&lt;br/&gt;&amp;gt; &amp;gt; - Attacker creates a new account in LNbits and pays B&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; - LNbits backend uses payment_hash(B) to check whether this is an internal payment or a payment via LN&lt;br/&gt;&amp;gt; &amp;gt; - Backend finds A in its database since we implicitly assume that payment_hash(A) commits to A&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; ** This is the critical part! Payment hashes do NOT commit to any payment details (like amount) but only to the preimage! **&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; - Backend settles payment internally by crediting A debiting B&lt;br/&gt;&amp;gt; &amp;gt; - Attacker has &amp;#34;created&amp;#34; 999 sats&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; Mitigation:&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; The mitigation is quite simple. Backends should either use self-generated unique &amp;#34;checking id&amp;#39;s&amp;#34; for looking up internal payments or use additional checks to make sure that the invoice details have not been messed around with (e.g., asserting amount(A) == amount(B)).&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; Lessons:&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; I think there are two lessons here. First, it&amp;#39;s good to realize the level of sophistication of LN-savvy attackers. This attack clearly involves a fundamental understanding of bolt-11 and requires custom tooling to produce the malicious invoice.&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; The second lesson is more valuable: The &amp;#34;payment hash&amp;#34; of an invoice is not a &amp;#34;payment&amp;#34; hash but merely a &amp;#34;preimage&amp;#34; hash – and nothing else. Naming this field as such increases the chance of developers implicitly assuming that the hash commits to payment details like amount, pubkey, etc. I will from now on call this simply the &amp;#34;preimage hash&amp;#34; and invite you to do so too.&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; Best&lt;br/&gt;&amp;gt; &amp;gt; &lt;br/&gt;&amp;gt; &amp;gt; Calle&lt;br/&gt;&amp;gt; &amp;gt; _______________________________________________&lt;br/&gt;&amp;gt; &amp;gt; Lightning-dev mailing list&lt;br/&gt;&amp;gt; &amp;gt; Lightning-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt; &amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev&lt;/a&gt;
    </content>
    <updated>2023-07-10T19:01:45Z</updated>
  </entry>

  <entry>
    <id>https://nostr.ae/nevent1qqsgl4dn7fxa3n4udeg965dus9zr5gay80xhrwtvw698nkxdaymnzfgzypm7adda4fz5nnc8acqz5wdeydh5ahncmajqajnmz9t3am85dasavu6yxgj</id>
    
      <title type="html">📅 Original date posted:2023-06-19 🗒️ Summary of this ...</title>
    
    <link rel="alternate" href="https://nostr.ae/nevent1qqsgl4dn7fxa3n4udeg965dus9zr5gay80xhrwtvw698nkxdaymnzfgzypm7adda4fz5nnc8acqz5wdeydh5ahncmajqajnmz9t3am85dasavu6yxgj" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsvgyhv42w0996ezuz4hmreugkz2v2vawu4z7l07m0du625e24kn0cwhqnh6&#39;&gt;nevent1q…qnh6&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2023-06-19&lt;br/&gt;🗒️ Summary of this message: LNbits discovered an exploit that allows attackers to create balances out of thin air by abusing a quirk in how invoices are handled internally. The attacker can insert a bolt-11 payment hash of payment A into a different payment, creating a malicious invoice B that can trick the backend into believing that B == A. The mitigation is simple, and developers should use additional checks to ensure that the invoice details have not been messed around with. The attack requires a fundamental understanding of bolt-11 and custom tooling to produce the malicious invoice.&lt;br/&gt;📝 Original message:&lt;br/&gt;Dear list,&lt;br/&gt;&lt;br/&gt;earlier last month, our team at LNbits discovered a rather interesting exploit which wich would enable an attacker to create balances out of thin air by abusing a quirk in how invoices are handled internally. We&amp;#39;ve patched this in LNbits version 0.10.5 and urge anyone to update ASAP if you haven&amp;#39;t done so already. I want to describe the attack here, since my gut feeling is that carrying out the same exploit is possible in other Lightning applications. If you&amp;#39;re working on custodial wallets, payment processors, account management software, etc. you probably want to read this.&lt;br/&gt;&lt;br/&gt;In short, the attacker was able to insert a bolt-11 payment hash of payment A into a different payment, creating a malicious invoice B that can trick the backend into believing that B == A.&lt;br/&gt;&lt;br/&gt;Here is how it goes:&lt;br/&gt;&lt;br/&gt;- Attacker creates invoice A of amount 1000 sat in LNbits&lt;br/&gt;- Attacker creates invoice B&amp;#39; of amount 1 sat on her own node&lt;br/&gt;- Attacker deserializes B&amp;#39;, inserts payment_hash(A) into payment_hash(B), re-signs the invoice, and serializes it again, producing malicious invoice B&lt;br/&gt;- Attacker creates a new account in LNbits and pays B&lt;br/&gt;&lt;br/&gt;- LNbits backend uses payment_hash(B) to check whether this is an internal payment or a payment via LN&lt;br/&gt;- Backend finds A in its database since we implicitly assume that payment_hash(A) commits to A&lt;br/&gt;&lt;br/&gt;** This is the critical part! Payment hashes do *NOT* commit to any payment details (like amount) but only to the preimage! ** &lt;br/&gt;&lt;br/&gt;- Backend settles payment internally by crediting A debiting B&lt;br/&gt;- Attacker has &amp;#34;created&amp;#34; 999 sats&lt;br/&gt;&lt;br/&gt;Mitigation:&lt;br/&gt;&lt;br/&gt;The mitigation is quite simple. Backends should either use self-generated unique &amp;#34;checking id&amp;#39;s&amp;#34; for looking up internal payments or use additional checks to make sure that the invoice details have not been messed around with (e.g., asserting amount(A) == amount(B)).&lt;br/&gt;&lt;br/&gt;Lessons:&lt;br/&gt;&lt;br/&gt;I think there are two lessons here. First, it&amp;#39;s good to realize the level of sophistication of LN-savvy attackers. This attack clearly involves a fundamental understanding of bolt-11 and requires custom tooling to produce the malicious invoice. &lt;br/&gt;&lt;br/&gt;The second lesson is more valuable: The &amp;#34;payment hash&amp;#34; of an invoice is not a &amp;#34;payment&amp;#34; hash but merely a &amp;#34;preimage&amp;#34; hash – and nothing else. Naming this field as such increases the chance of developers implicitly assuming that the hash commits to payment details like amount, pubkey, etc. I will from now on call this simply the &amp;#34;preimage hash&amp;#34; and invite you to do so too.&lt;br/&gt;&lt;br/&gt;Best &lt;br/&gt;&lt;br/&gt;Calle
    </content>
    <updated>2023-06-19T17:42:41Z</updated>
  </entry>

</feed>