<oembed><type>rich</type><version>1.0</version><author_name>npub1q86n5vtxkwerzwfqza3hwls8pl8764244464talfqy2vpj0qaz6q38qwta</author_name><author_url>https://nostr.ae/npub1q86n5vtxkwerzwfqza3hwls8pl8764244464talfqy2vpj0qaz6q38qwta</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2020-06-21&#xA;📝 Original message:&#xA;Hi ZmnSCPxj,&#xA;&#xA;My understanding is that you can use the CTV deferral to also get&#xA;independent HTLC relative timelocks start points per output. This would&#xA;help with this sort of issue right?&#xA;&#xA;And you&#39;re correct that there&#39;s overhead of indirection, but it&#39;s not super&#xA;large (minimally complicated something like an extra 100 bytes per output,&#xA;if you were to have a flat array where each entry is a CTV output so that&#xA;each out gets its own clock).&#xA;&#xA;Essentially something like this:&#xA;&#xA;Chan&#xA;     |&#xA;     ---------------------------------------------&#xA;     |           |             |             |            |&#xA;CTV(A) CTV(B) CTV(C) CTV(D)      (Optional CPFP Anchor?)&#xA;     |           |             |             |&#xA;1 block    1 block   1 block   1 block&#xA;     |           |             |             |&#xA;    A          B           C            D&#xA;&#xA;Where A B C and D are all HTLCs.&#xA;&#xA;Now because of the one-hop indirection, A B C and D can all expand&#xA;independently. It&#39;s also possible for the Channel Operator to do something&#xA;like:&#xA;&#xA;Chan&#xA;     |&#xA;     ---------------------------------------------&#xA;     |           |             |             |            |&#xA;CTV(A) CTV(B) CTV(C) CTV(D)      (Optional CPFP Anchor?)&#xA;     |           |             |             |&#xA;1 block    1 block   1 block   10 blocks&#xA;     |           |             |             |&#xA;    A          B           C            D&#xA;&#xA;To make D have a further out resolution time to prevent the&#xA;simultaneous-ness issue (trees or a linear-chain rather than total fan-out&#xA;can also be used but I think it&#39;s a bit more confusing for a basic&#xA;example). The benefit of trees is that I can do something like:&#xA;&#xA;&#xA;Chan&#xA;     |&#xA;     --------------------------------------------------------&#xA;     |           |             |             |                          |&#xA;CTV(A) CTV(B) CTV(C) CTV(400 HTLC)      (Optional CPFP Anchor?)&#xA;     |           |             |             |                |&#xA;1 block    1 block   1 block   10 blocks  (Optional CPFP Anchor?)&#xA;     |           |             |              |&#xA;     |           |             |             / ....\&#xA;    A          B           C            | ..... |&#xA;&#xA;Which makes it so that the low-value new HTLCs can be deprioritized fee&#xA;wise. So that the attack, which occurs during a fee spike, doesn&#39;t end up&#xA;*requiring* substantial fees to be added to the channel to support a burst&#xA;of HTLCS.&#xA;&#xA;--&#xA;@JeremyRubin &lt;https://twitter.com/JeremyRubin&gt;&#xA;&lt;https://twitter.com/JeremyRubin&gt;&#xA;&#xA;&#xA;On Sat, Jun 20, 2020 at 8:34 PM ZmnSCPxj &lt;ZmnSCPxj at protonmail.com&gt; wrote:&#xA;&#xA;&gt; Good morning Jeremy,&#xA;&gt;&#xA;&gt; &gt; I am not steeped enough in Lightning Protocol issues to get the full&#xA;&gt; design space, but I&#39;m fairly certain BIP-119 Congestion Control trees would&#xA;&gt; help with this issue.&#xA;&gt; &gt;&#xA;&gt; &gt; You can bucket a tree by doing a histogram of HTLC size, so that all&#xA;&gt; small HTLCs live in a common CTV subtree and don&#39;t interfere with higher&#xA;&gt; value HTLCs. You can also play with sequencing to prevent those HTLCs from&#xA;&gt; getting longchains in the mempool until they&#39;re above a certain value.&#xA;&gt;&#xA;&gt; If the attacker stops responding, then all HTLC rules need to be published&#xA;&gt; onchain for enforcement of the HTLC rules.&#xA;&gt; And that publication onchain is the problem: every HTLC published requires&#xA;&gt; onchain space, which must be paid for.&#xA;&gt;&#xA;&gt; The most compact way to expose the HTLCs is as a flat array, i.e. outputs&#xA;&gt; of a single transaction.&#xA;&gt; Every tree structure is going to take up more space than a flat array.&#xA;&gt;&#xA;&gt; What CTV buys is to be able to defer *when* you reveal scripts, possibly&#xA;&gt; to a later time when blockchain space is cheaper.&#xA;&gt; But in case the victim owns the timelock branch of an outgoing HTLC, it is&#xA;&gt; unsafe for the victim to defer: it has to enforce the locktime soon or it&#xA;&gt; could end up losing both incoming and outgoing HTLC amounts.&#xA;&gt; And to enforce the locktime it has to publish the HTLC.&#xA;&gt;&#xA;&gt; Now of course with CTV you could publish only the HTLC you have to enforce&#xA;&gt; *now*, and keep the rest in an CTV output.&#xA;&gt; The attacker can counter this by pushing 483 HTLCs with the same timelock&#xA;&gt; at the victim, so that the victim has to publish all HTLCs simultaneously.&#xA;&gt; And a flat array of outputs is cheaper than a tree.&#xA;&gt;&#xA;&gt; What *can* be done would be to bin by timelock rather than amount; tree&#xA;&gt; leaves are a transaction that exposes all HTLCs with a particular timelock&#xA;&gt; as a flat array of outputs, but different timelocks go to different tree&#xA;&gt; branches.&#xA;&gt; But the attacker can still do the same-timelock trick, and the tree&#xA;&gt; structure is likely to take up more space in the end than just a non-treed&#xA;&gt; flat array of outputs.&#xA;&gt;&#xA;&gt; Regards,&#xA;&gt; ZmnSCPxj&#xA;&gt;&#xA;&gt;&#xA;&gt; &gt; --&#xA;&gt; &gt; @JeremyRubin&#xA;&gt; &gt;&#xA;&gt; &gt; On Thu, Jun 18, 2020 at 1:41 AM Antoine Riard &lt;antoine.riard at gmail.com&gt;&#xA;&gt; wrote:&#xA;&gt; &gt;&#xA;&gt; &gt; &gt; Hi Rene,&#xA;&gt; &gt; &gt; Thanks for disclosing this vulnerability,&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; I think this blackmail scenario holds but sadly there is a lower&#xA;&gt; scenario.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; Both &#34;Flood &amp; Loot&#34; and your blackmail attack rely on `update_fee`&#xA;&gt; mechanism and unbounded commitment transaction size inflation. Though the&#xA;&gt; first to provoke block congestion and yours to lockdown in-flight fees as&#xA;&gt; funds hostage situation.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; 1. The current solution is to just not use up the max value of&#xA;&gt; htlc&#39;s. Eclaire and c-lightning by default only use up to 30 htlcs.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; As of today, yes I would recommend capping commitment size both for&#xA;&gt; ensuring competitive propagation/block selection and limiting HTLC exposure.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; 2. Probably the best fix (not sure if I understand the consequences&#xA;&gt; correctly) is coming from this PR to bitcoin core (c.f.&#xA;&gt; https://github.com/bitcoin/bitcoin/pull/15681 by @TheBlueMatt . If I get&#xA;&gt; it correctly with that we could always have low fees and ask the person who&#xA;&gt; want to claim their outputs to pay fees. This excludes overpayment and&#xA;&gt; could happen at a later stage when fees are not spiked. Still the victim&#xA;&gt; who offered the htlcs would have to spend those outputs at some time.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; It&#39;s a bit more complex, carve-out output, even combined with anchor&#xA;&gt; output support on the LN-side won&#39;t protect against different flavors of&#xA;&gt; pinning. I invite you to go through logs of past 2 LN dev meetings.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; 3. Don&#39;t overpay fees in commitment transactions. We can&#39;t foresee&#xA;&gt; the future anyway&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; Once 2. is well-addressed we may deprecate `update_fee`.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; 4. Don&#39;t add htlcs for which the on chain fee is higher than the&#xA;&gt; HTLCs value (like we do with sub dust amounts and sub satoshi amounts. This&#xA;&gt; would at least make the attack expensive as the attacker would have to bind&#xA;&gt; a lot of liquidity.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; Ideally we want dust_limit to be dynamic, dust cap should be based on&#xA;&gt; HTLC economic value, feerate of its output, feerate of HTLC-transaction,&#xA;&gt; feerate estimation of any CPFP to bump it. I think that&#39;s kind of worthy to&#xA;&gt; do once we solved 3. and 4&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; 5. Somehow be able to aggregate htlc&#39;s. In a world where we use&#xA;&gt; payment points instead of preimages we might be able to do so. It would be&#xA;&gt; really cool if separate HTLC&#39;s could be combined to 1 single output. I&#xA;&gt; played around a little bit but I have not come up with a scheme that is&#xA;&gt; more compact in all cases. Thus I just threw in the idea.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; Yes we may encode all HTLC in some Taproot tree in the future. There&#xA;&gt; are some wrinkles but for a high-level theoretical construction see my post&#xA;&gt; on CoinPool.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; 6. Split onchain fees differently (now the attacker would also lose&#xA;&gt; fees by conducting this attack) - No I don&#39;t want to start yet another fee&#xA;&gt; bikeshadding debate. (In particular I believe that a different split of&#xA;&gt; fees might make the Flood &amp; Loot attack economically more viable which&#xA;&gt; relies on the same principle)&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; Likely a bit more of fee bikeshedding is something we have to do to&#xA;&gt; make LN secure... Switching fee from pre-committed ones to a single-party,&#xA;&gt; dynamic one.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; Independently I think we should have a hint in our readme file about&#xA;&gt; where and how people can disclose attacks and vulnerabilities.&#xA;&gt; Implementations have this but the BOLTs do not.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; I 100% agree, that&#39;s exactly&#xA;&gt; https://github.com/lightningnetwork/lightning-rfc/pull/772, waiting for&#xA;&gt; your feedback :)&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; Cheers,&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; Antoine&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; Le mer. 17 juin 2020 à 09:41, ZmnSCPxj via Lightning-dev &lt;&#xA;&gt; lightning-dev at lists.linuxfoundation.org&gt; a écrit :&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; Good morning all,&#xA;&gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; &gt; Fee futures could help against this.&#xA;&gt; &gt; &gt; &gt; &gt; I remember writing about this some time ago but cannot find where&#xA;&gt; (not sure if it was in lightning-dev or bitcoin-dev).&#xA;&gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; `harding` found it:&#xA;&gt; https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-January/017601.html&#xA;&gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; Regards,&#xA;&gt; &gt; &gt; &gt; ZmnSCPxj&#xA;&gt; &gt; &gt; &gt; _______________________________________________&#xA;&gt; &gt; &gt; &gt; Lightning-dev mailing list&#xA;&gt; &gt; &gt; &gt; Lightning-dev at lists.linuxfoundation.org&#xA;&gt; &gt; &gt; &gt; https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; _______________________________________________&#xA;&gt; &gt; &gt; Lightning-dev mailing list&#xA;&gt; &gt; &gt; Lightning-dev at lists.linuxfoundation.org&#xA;&gt; &gt; &gt; https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev&#xA;&gt;&#xA;&gt;&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20200621/8e0db1ae/attachment-0001.html&gt;</html></oembed>