Return-Path: Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id D9C6CC0032; Mon, 23 Oct 2023 08:50:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B56074033A; Mon, 23 Oct 2023 08:50:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org B56074033A X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -4.2 X-Spam-Level: X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S7vtV7L_oxbR; Mon, 23 Oct 2023 08:50:01 +0000 (UTC) X-Greylist: delayed 172282 seconds by postgrey-1.37 at util1.osuosl.org; Mon, 23 Oct 2023 08:50:01 UTC DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 56D274032C Received: from smtpauth.rollernet.us (smtpauth.rollernet.us [208.79.240.5]) by smtp4.osuosl.org (Postfix) with ESMTPS id 56D274032C; Mon, 23 Oct 2023 08:50:00 +0000 (UTC) Received: from smtpauth.rollernet.us (localhost [127.0.0.1]) by smtpauth.rollernet.us (Postfix) with ESMTP id 801172800067; Mon, 23 Oct 2023 01:49:55 -0700 (PDT) Received: from webmail.rollernet.us (webmail.rollernet.us [IPv6:2607:fe70:0:14::a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by smtpauth.rollernet.us (Postfix) with ESMTPSA; Mon, 23 Oct 2023 01:49:55 -0700 (PDT) MIME-Version: 1.0 Date: Sun, 22 Oct 2023 22:49:55 -1000 From: "David A. Harding" To: Nadav Ivgi , Bitcoin Protocol Discussion In-Reply-To: References: User-Agent: Roundcube Webmail/1.4.10 Message-ID: <0ae928c4209debc1fd4271fddfffde65@dtrt.org> X-Sender: dave@dtrt.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Rollernet-Abuse: Contact abuse@rollernet.us to report. Abuse policy: http://www.rollernet.us/policy X-Rollernet-Submit: Submit ID 7195.653633b3.287f9.0 Cc: security@ariard.me, "lightning-dev@lists.linuxfoundation.org" Subject: Re: [bitcoin-dev] Full Disclosure: CVE-2023-40231 / CVE-2023-40232 / CVE-2023-40233 / CVE-2023-40234 "All your mempool are belong to us" X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2023 08:50:03 -0000 On 2023-10-21 18:49, Nadav Ivgi via bitcoin-dev wrote: > Could this be addressed with an OP_CSV_ALLINPUTS, a covenant opcode > that requires _all_ inputs to have a matching nSequence, and using `1 > OP_CSV_ALLINPUTS` in the HTLC preimage branch? > > This would prevent using unconfirmed outputs in the > HTLC-preimage-spending transaction entirely, which IIUC should protect > it against the replacement cycling attack. I don't think that addresses the underlying problem. In Riard's description, a replacement cycle looks like this: - Bob broadcasts an HTLC-timeout (input A, input B for fees, output X) - Mallory replaces the HTLC-timeout with an HTLC-preimage (input A, input C for fees, output Y) - Mallory replaces the transaction that created input C, removing the HTLC-preimage from the mempool However, an alternative approach is: - (Same) Bob broadcasts an HTLC-timeout (input A, input B for fees, output X) - (Same) Mallory replaces the HTLC-timeout with an HTLC-preimage (input A, input C for fees, output Y) - (Different) Mallory uses input C to replace the HTLC-preimage with a transaction that does not include input A, removing the preimage from the mempool The original scenario requires input C to be from an unconfirmed transaction, so OP_CSV_ALLINPUTS works. The alternative scenario works even if input C comes from a confirmed transaction, so OP_CSV_ALLINPUTS is ineffective. -Dave