From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 17738C002B for ; Tue, 7 Feb 2023 02:49:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id E068A60DF4 for ; Tue, 7 Feb 2023 02:49:43 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org E068A60DF4 Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=woobling.org header.i=@woobling.org header.a=rsa-sha256 header.s=google header.b=Ynd/HIne X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -2.098 X-Spam-Level: X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001] autolearn=ham autolearn_force=no Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hIDMSvTDDu9X for ; Tue, 7 Feb 2023 02:49:43 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 13F6E60D56 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by smtp3.osuosl.org (Postfix) with ESMTPS id 13F6E60D56 for ; Tue, 7 Feb 2023 02:49:41 +0000 (UTC) Received: by mail-lf1-x12f.google.com with SMTP id x40so20458023lfu.12 for ; Mon, 06 Feb 2023 18:49:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=woobling.org; s=google; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=Sb9CzHxtsaNYRRNysMsKQFt5MwAx8bmUPDxPBB3xv1o=; b=Ynd/HInevHqJdR3W2O5XbWM/V8icz2/3lJfk7i4/hmSBjXOe0MovL4yhX7J8+Kc+Bj DiQC6fsXTD4go9HhxkfusfnWvQPuYIjW+sYdphRnd+k7RjRpRBbFJ6fgi27yiCj4XI+t C9k1WnPuVxOh1LV4dyI/Y3o6mCJYwltN8IFrk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Sb9CzHxtsaNYRRNysMsKQFt5MwAx8bmUPDxPBB3xv1o=; b=VBbZwrOJabQZQBFgwrZ7BwES+p1Az38h+CMuu8pMUzs9s9T+XUmOhU8wdBJbkGJYB7 Q7MtoxxpCa8jLAhKLwDB92QNQ/baR0fRPCsE0VNXATOIMEtjEccP4Xzrm7nW4DWluUBV sJ0wAoy6Rc89O0L+W/Gj547lrjd3Jh3gr7v8ynxYcAOofISfN48XsCbk8y0ogTnPisLl nLSrQxHeC4INqS7UGqER7QaxMi6KM/LdEgUoSvbzyF7/dP/tJEmJpj4U0ots5gs5tcQ9 tMzxXCqzr4oOJMlokByM7Qp4GoWkRbLK1/MeExOpqmiFbhsBQPooZk/uE3FrZk1skP3g Skfg== X-Gm-Message-State: AO0yUKUDmEkwXrEv7NjuWe227t1a+G6EqSAur+VTBQt5BmNtbMPkHxLQ Ht2F7zLLX04anjFKRYLbj4cyKb+cIGih2NFDNNz/OQWnz5zFYq/w X-Google-Smtp-Source: AK7set8t17pOInCYdKTMcjyei4iI873UsnFBdnmPq977fJpJFk8Rd286sYK/zfaa2yhwsxBv5qhjmvbmMdF1taLsRXQ= X-Received: by 2002:ac2:569b:0:b0:4af:ee74:aa5f with SMTP id 27-20020ac2569b000000b004afee74aa5fmr186416lfr.24.1675738179398; Mon, 06 Feb 2023 18:49:39 -0800 (PST) MIME-Version: 1.0 From: Yuval Kogman Date: Tue, 7 Feb 2023 04:49:28 +0200 Message-ID: To: Bitcoin Protocol Discussion Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Tue, 07 Feb 2023 02:59:29 +0000 Subject: [bitcoin-dev] Unenforceable fee obligations in multiparty protocols with Taproot inputs 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: Tue, 07 Feb 2023 02:49:44 -0000 ## Summary Since Taproot (more generally any kind of MAST) spends have variable size which depends on the path being used, the last such input to be signed in a multiparty transaction can always use a larger than estimated signature to unfairly extract a fee contribution from the other parties to the transaction (keeping the absolute fees the same and reducing the feerate for the transaction). ## Attack Scenario Alice et al wish to perform a multiparty transaction, such as a CoinJoin or lightning dual funding at a relatively high feerate. Mallory has a P2TR output with a large script spend path, e.g. an ordinal inscription commitment transaction output. Mallory registers this coin as an input into the multiparty transaction with a fee obligation calculated on the basis of a key spend. When all other participants have provided signatures, the script spend path can be used. Since the absolute fee amount is already committed to by the provided (`SIGHASH_ALL`) signatures but the total transaction weight is not, Mallory can broadcast any valid signatures up to the maximum standard weight and minimum relay fees, or in collusion with a miner, up to consensus limits. This effectively steals a fee from Alice et al, as their signatures do not commit to a feerate directly or indirectly. ## Mitigations ### RBF All parties could negotiate a (series of) transaction(s) ahead of time at a lower feerate, giving a lower bound minimum feerate that Mallory can force. ### Minimum Weight Before Signing Enforcing a minimal weight for all non-witness data in the transaction before the transaction is considered fully constructed can limit the effectiveness of this attack, since the difference between the predicted weight and the maximum weight decreases. ### Trusted Coordinator In the centralized setting if BIP-322 ownership proofs are required for participation and assuming the server can be trusted not to collude with Mallory, the server can reject signatures that do not exercise the same spend path as the ownership proof, which makes the ownership proof a commitment to the spend weight of the input. ### Reputation Multiparty protocols with publicly verifiable protocol transcripts can be provided as weak evidence of a history of honest participation in multiparty transactions. A ring signature from keys used in the transaction or its transcript committing to the new proposed transaction can provide weak evidence for the honesty of the peer. Such proofs are more compelling to an entity which has participated in (one of) the transcripts, or proximal transactions. Incentives are theoretically aligned if public coordinators publish these transcripts as a kind of server reputation. ### Increasing Costliness A minimum feerate for the previous transaction or a minimum confirmation age (coindays destroyed implies time value, analogous to fidelity bonds) can be required for inputs to be added, in order to make such attacks less lucrative (but there is still a positive payoff for the attacker). ### Signature Ordering Signatures from potentially exploitative inputs can be required ahead of legacy or SegWit v0 ones. The prescribed order can be determined based on reputation or costliness as described in the previous paragraphs.