Return-Path: <SRS0=slBF=KU=petertodd.org=pete@redirect.mail.gandi.net>
Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])
	 by sloti50n04 (Cyrus 3.11.0-alpha0-287-gcf6d0d8ecf-fm-20240312.001-gcf6d0d8e) with LMTPA;
	 Thu, 14 Mar 2024 11:46:30 -0400
X-Cyrus-Session-Id: sloti50n04-1710431190-990672-2-7832397426369011483
X-Sieve: CMU Sieve 3.0
X-Spam-known-sender: yes ("Self sent message"); self-send
X-Spam-sender-reputation: 0 (email; noauth)
X-Spam-score: 0.0
X-Spam-hits: ALL_TRUSTED -1, HEADER_FROM_DIFFERENT_DOMAINS 0.249, ME_SC_NH -0.001,
  ME_SENDERREP_DENY 4, SPF_HELO_PASS -0.001, SPF_PASS -0.001,
  T_SCC_BODY_TEXT_LINE -0.01, LANGUAGES en, BAYES_USED none,
  SA_VERSION 3.4.6
X-Spam-source: IP='217.70.178.232', Host='unk', Country='FR', FromHeader='org',
  MailFrom='net'
X-Spam-charsets: plain='iso-8859-1'
X-Attached: signature.asc
X-Resolved-to: petertodd@fastmail.com
X-Delivered-to: pete@petertodd.org
X-Original-Delivered-to: security@bitcoincore.org
X-Mail-from: SRS0=slBF=KU=petertodd.org=pete@redirect.mail.gandi.net
Received: from mx3 ([10.202.2.202])
  by compute5.internal (LMTPProxy); Thu, 14 Mar 2024 11:46:30 -0400
Received: from mx3.messagingengine.com (localhost [127.0.0.1])
	by mailmx.nyi.internal (Postfix) with ESMTP id 062EE196008D
	for <pete@petertodd.org>; Thu, 14 Mar 2024 11:46:30 -0400 (EDT)
Received: from mailmx.nyi.internal (localhost [127.0.0.1])
    by mx3.messagingengine.com (Authentication Milter) with ESMTP
    id 28AE61D3445.26CDD19600D8;
    Thu, 14 Mar 2024 11:46:30 -0400
ARC-Seal: i=1; a=rsa-sha256; cv=none; d=messagingengine.com; s=fm1; t=
    1710431190; b=LpV3WeN9n49HJRvRhrYMswNmo3eTLd4QmypNQBfysw9buu5u5t
    zqee9lZDgAS6mggDVtJr865Y4AeL2J071+Z1GaRX9ueILfLEGWnyuIwuw9Ip79j9
    DroVpWFWrLClYykLcy/NM/zuM95Rwt9LdHa87gkhbTEM6IjeQHkeKeNpfkd06r6b
    kJGIsyJWIC2U/1slvcORy5or2L+PIkTCp8y1G5RKfY+3OcY6urT2K4plZhVy1cHz
    OXTRY9pSBGty/I1PGiX7xKnprmXMtWHAuF3/zwxQwgY/YWpqFOJAqqYDeUeD1bZ4
    2qBHLPNOoRoulRPADMHXilhfs7TfFA1cCI3w==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=
    messagingengine.com; h=date:from:to:subject:message-id
    :mime-version:content-type; s=fm1; t=1710431190; bh=ah8RG0pqZeDK
    Gf3xV5Tp7sP0nv5exFnGt1bntGz4hjE=; b=hLlk66HdqvB0WJXDoftdK4QXeuzd
    pdnHcEv1wQ1BdnOAe4o6k4GfaTaIId3RcazzEmEmtUy63kl6W0AGZBtc9Q6skEEl
    8hNlQbw4nG4GubD0ABAIghpUHWioPXpOlzvefRUJy0fCeuwnvxBsuJuJEssBGJKk
    Qm/xZIUsFUOo1hKluFdXvwNtEM8qPgX91t6lr+QsIMSBsxdkd/fs5i4ta4zcg/TW
    OeIlyNthTGMFrqB1vpknLROVmy8Zob0e1uDibF+C/77hUxurUU0oAP1Jw0oqSoZ3
    1GH4Yy+CKVxCHkEMildWcksge/GakH9W1srfKBzD7CGdVHfumPHekF6Z8g==
ARC-Authentication-Results: i=1; mx3.messagingengine.com;    x-csa=none;
    x-me-sender=pass    policy.xms=   
 1RvzZaP8aRrYr9Y1DNuRW1eUvXhiaImdhQvfunEkZzYSIvJQIVewl7xnXTmdYcSnTHgJ-OjKwKTn03ZAoN06X9OpFVTJ4ruc3o8ehBzIE1tiUxMsQ8EKnLoCb_iWs_W_qZXPoz_on4dx8Fm2Jg;
    x-ptr=fail smtp.helo=redirect.mail.gandi.net   
 policy.ptr=relay12.mail.gandi.net;    bimi=skipped (DMARC did not pass);
    arc=none (no signatures found);
    dkim=pass (2048-bit rsa key sha256) header.d=messagingengine.com   
 header.i=@messagingengine.com header.b=qTAzbImI header.a=rsa-sha256   
 header.s=fm1;    dmarc=none policy.published-domain-policy=none   
 policy.applied-disposition=none policy.evaluated-disposition=none   
 (p=none,d=none,d.eval=none) policy.policy-from=p   
 header.from=petertodd.org;
    iprev=pass smtp.remote-ip=217.70.178.232 (relay12.mail.gandi.net);
    spf=pass    smtp.mailfrom=   
 "SRS0=slBF=KU=petertodd.org=pete@redirect.mail.gandi.net"   
 smtp.helo=redirect.mail.gandi.net
X-ME-Authentication-Results: mx3.messagingengine.com;
    x-aligned-from=fail;
    x-return-mx=pass header.domain=petertodd.org policy.is_org=yes
      (MX Records found: in1-smtp.messagingengine.com,in2-smtp.messagingengine.com);
    x-return-mx=pass smtp.domain=redirect.mail.gandi.net
      policy.org_domain=gandi.net policy.is_org=no
      (MX Records found: redirect.mail.gandi.net);
    x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ADH-AES256-GCM-SHA384
      smtp.bits=256/256;
    x-vs=clean score=0 state=0
Authentication-Results: mx3.messagingengine.com;
    x-csa=none;
    x-me-sender=pass
      policy.xms=
      1RvzZaP8aRrYr9Y1DNuRW1eUvXhiaImdhQvfunEkZzYSIvJQIVewl7xnXTmdYcSnTHgJ-OjKwKTn03ZAoN06X9OpFVTJ4ruc3o8ehBzIE1tiUxMsQ8EKnLoCb_iWs_W_qZXPoz_on4dx8Fm2Jg;
    x-ptr=fail smtp.helo=redirect.mail.gandi.net
      policy.ptr=relay12.mail.gandi.net
Authentication-Results: mx3.messagingengine.com;
    bimi=skipped (DMARC did not pass)
Authentication-Results: mx3.messagingengine.com;
    arc=none (no signatures found)
Authentication-Results: mx3.messagingengine.com;
    dkim=pass (2048-bit rsa key sha256) header.d=messagingengine.com
      header.i=@messagingengine.com header.b=qTAzbImI header.a=rsa-sha256
      header.s=fm1;
    dmarc=none policy.published-domain-policy=none
      policy.applied-disposition=none policy.evaluated-disposition=none
      (p=none,d=none,d.eval=none) policy.policy-from=p
      header.from=petertodd.org;
    iprev=pass smtp.remote-ip=217.70.178.232 (relay12.mail.gandi.net);
    spf=pass
      smtp.mailfrom=
      "SRS0=slBF=KU=petertodd.org=pete@redirect.mail.gandi.net"
      smtp.helo=redirect.mail.gandi.net
X-ME-VSCause: gggruggvucftvghtrhhoucdtuddrgedvledrjeejgdejjecutefuodetggdotefrodftvf
    curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr
    tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukf
    ggtggusehgtderredttddunecuhfhrohhmpefrvghtvghrucfvohguugcuoehpvghtvges
    phgvthgvrhhtohguugdrohhrgheqnecuggftrfgrthhtvghrnhepkeehtdefhedvtdffue
    evheejgfehffdtgedvtdefuddvvedvvdfhkeehkeevieehnecuffhomhgrihhnpehpvght
    vghrthhouggurdhorhhgnecukfhppedvudejrdejtddrudejkedrvdefvddpuddtfedrud
    eikedrudejvddrudegheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhn
    vghtpedvudejrdejtddrudejkedrvdefvddphhgvlhhopehrvgguihhrvggtthdrmhgrih
    hlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepoefutffutdepshhluefhpefmfgep
    phgvthgvrhhtohguugdrohhrghepphgvthgvsehrvgguihhrvggtthdrmhgrihhlrdhgrg
    hnughirdhnvghtqedpnhgspghrtghpthhtohepuddprhgtphhtthhopeeophgvthgvsehp
    vghtvghrthhouggurdhorhhgqe
X-ME-VSScore: 0
X-ME-VSCategory: clean
X-ME-CSA: none
X-ME-Received: <xmx:1RvzZUpBvbM-xJC3otuP31kANTZUM-OszEUzhG06Y6wfUyVi-qArpg>
Received-SPF: pass
    (redirect.mail.gandi.net: Sender is authorized to use 'SRS0=slBF=KU=petertodd.org=pete@redirect.mail.gandi.net' in 'mfrom' identity (mechanism 'include:_nblcust.gandi.net' matched))
    receiver=mx3.messagingengine.com;
    identity=mailfrom;
    envelope-from="SRS0=slBF=KU=petertodd.org=pete@redirect.mail.gandi.net";
    helo=redirect.mail.gandi.net;
    client-ip=217.70.178.232
Received: from redirect.mail.gandi.net (relay12.mail.gandi.net [217.70.178.232])
	(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by mx3.messagingengine.com (Postfix) with ESMTPS id 26CDD19600D8
	for <pete@petertodd.org>; Thu, 14 Mar 2024 11:46:28 -0400 (EDT)
Received: from spool.mail.gandi.net (spool2.mail.gandi.net [217.70.178.211])
	by relay12.mail.gandi.net (Postfix) with ESMTPS id C9518200003;
	Thu, 14 Mar 2024 15:46:26 +0000 (UTC)
Received: from fout2-smtp.messagingengine.com (fout2-smtp.messagingengine.com [103.168.172.145])
	by spool.mail.gandi.net (Postfix) with ESMTPS id BEE6474004E
	for <security@bitcoincore.org>; Thu, 14 Mar 2024 15:46:24 +0000 (UTC)
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43])
	by mailfout.nyi.internal (Postfix) with ESMTP id ADEFA1380085
	for <security@bitcoincore.org>; Thu, 14 Mar 2024 11:46:23 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
  by compute3.internal (MEProxy); Thu, 14 Mar 2024 11:46:23 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
	messagingengine.com; h=cc:content-type:content-type:date:date
	:feedback-id:feedback-id:from:from:in-reply-to:message-id
	:mime-version:reply-to:subject:subject:to:to:x-me-proxy
	:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
	1710431183; x=1710517583; bh=ah8RG0pqZeDKGf3xV5Tp7sP0nv5exFnGt1b
	ntGz4hjE=; b=qTAzbImIYkZBafzBy/JThc54kKt4hOK+eTABhbGUfBZQZbyqwv/
	E+l9txXZwTXcqahkWlCnCJlqeR5amOgd8OeUWwR1kbMXHPWl15iOrb702d9O2gC0
	zp+hgWkKJLYmXpoXuKLm0cZWdQp4Bdss/4ifkEwGbC4fFqUGTPybBBaxkT9DqzAc
	SbfN0/XvylT+BDgXf5F8WswEw3AyNHZQooK012Me9jgzbmkna95By/A0MrC08MdI
	Zsnjg5uoVJglhL92kPAXBslVeycvp2KulcADd8MqMdlxWHVFje6esAMM/SUEOlHs
	LWXR3Ao2ctg9Xk3RlOE/mY031M6ihsTDZag==
X-ME-Sender: <xms:zxvzZSQh4Dyasjn1B9OeJCrL3Nx27bomePVQQqXNxhv0lL8J78gneQ>
    <xme:zxvzZXyQWlZFAqHxZUDW04ikRi2z8s3EHG6escByL-HUJ_HA5UF5WfxWeCuXY0JHM
    1g0yDIjBvGMwju2dEE>
X-ME-Received: <xmr:zxvzZf1ED9SC9XY94Rh1z3aSBJbKD8BcLuNRWBowUQ3TATuxq2KPCG3w0w>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrjeejgdejkecutefuodetggdotefrodftvf
    curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
    uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfggtggusehgtderredttd
    dunecuhfhrohhmpefrvghtvghrucfvohguugcuoehpvghtvgesphgvthgvrhhtohguugdr
    ohhrgheqnecuggftrfgrthhtvghrnhepkeehtdefhedvtdffueevheejgfehffdtgedvtd
    efuddvvedvvdfhkeehkeevieehnecuffhomhgrihhnpehpvghtvghrthhouggurdhorhhg
    necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvth
    gvsehpvghtvghrthhouggurdhorhhg
X-ME-Proxy: <xmx:zxvzZeAZm0bBYFQpl-0zAzMvfZ_fNhUpczfI5fZaQ2mk4wOzXHv4VQ>
    <xmx:zxvzZbgIDcCvuzjOlBNpUppyezHIdg3XjmmUbrAZC6jnhP1mvAUU6g>
    <xmx:zxvzZaqi6JU6l_wJZRVMO0lfs1_r4RDn6feWLogaZ1Uy4NSCaTPBzw>
    <xmx:zxvzZeiPh6lxU5489yjvm_UtM9chNq8J0Oibb1odpIALPPm5IkVvuw>
    <xmx:zxvzZRZlTStX73sNWfL9XqD5-nTJ1fCBgoUa1zoTVRaAoABb95hl1w>
Feedback-ID: i525146e8:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA for
 <security@bitcoincore.org>; Thu, 14 Mar 2024 11:46:22 -0400 (EDT)
Received: by localhost (Postfix, from userid 1000)
	id 953AA5F856; Thu, 14 Mar 2024 15:46:22 +0000 (UTC)
Date: Thu, 14 Mar 2024 15:46:22 +0000
From: Peter Todd <pete@petertodd.org>
To: security@bitcoincore.org
Subject: RBF Rule #6 DoS Attack
Message-ID: <ZfMbzhPUDKSaxf9x@petertodd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="LuptQxBpgf3rLObG"
Content-Disposition: inline
Authentication-Results: spool.mail.gandi.net;
	dkim=pass header.d=messagingengine.com header.s=fm1 header.b=qTAzbImI;
	dmarc=none;
	spf=pass (spool.mail.gandi.net: domain of pete@petertodd.org designates 103.168.172.145 as permitted sender) smtp.mailfrom=pete@petertodd.org
Content-Length: 5005


--LuptQxBpgf3rLObG
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

I do _not_ think the following issue is particularly serious due to the high
capital requirements necessary to use a significant amount of bandwidth, and
the existence of similar attacks=B9. But I wanted to run it by you guys bef=
ore
publishing it openly in case someone has a very good argument for it being
serious enough to keep quiet.


RBF Rule #6, implemented by Bitcoin Core on top of the BIP-125 rules, requi=
res
that a replacement transaction have a fee-rate higher than the fee-rate of =
all
directly conflicting transactions. This rule aligns economic incentives, as=
 in
most circumstances miners earn more money by mining a higher fee-rate
transaction than a lower fee-rate transaction, even if the absolute fee pai=
d by
the replacement is more.

However, the addition of this rule on top of BIP-125 introduces a new form =
of
DoS attack due to the path dependency of replacements. Basically, depending=
 on
what transaction a node sees first, for a given set of replacement transact=
ions
different nodes may end up with different transactions in their mempool.

Concretely, an attacker can do the following:

1. Create two transactions, A and B, where A is a large, low fee-rate, high
   absolute fee, transaction, and B is a small, high fee-rate, low absolute=
 fee
   transaction.

2. Broadcast A and B to different nodes simultaneously.

3. Nodes that receive A first will not replace A with B, because B pays a l=
ower
   fee, violating RBF Rule #3. Notes that receive B first, will not replace=
 B with
   A, because A has a lower fee-rate, violating RBF Rule #6.

4. Create A_1, a transaction with the same (large) size as A, but paying a
   slightly higher fee (and thus fee-rate). Nodes that received A first will
   replace A with A_1, consuming bandwidth. These nodes will also broadcast=
 A_1 to
   peers who have B, consuming their bandwidth even though they reject A_1.

5. Repeat until A_n has a fee-rate high enough to have a non-trivial risk of
   being mined. Or B is mined, invalidating all A_n.

The marginal cost to an attacker who was planning on broadcasting B anyway =
is
fairly small, as provided that sufficiently small fee-rates are chosen for =
A_n,
the probability of A_n being mined is low. The attack does of course require
capital, as the attacker needs to have UTXO's of sufficient size for A_n.

The attack is most effective in cases where fee-rates have a significant sl=
ope
to them, with the minimum relay fee being small compared to the competitive=
 fee
to get into the next block. The larger the mempool size limit, the more
effective the attack tends to be. Similarly, the attack is more effective w=
ith
a larger size difference between A and B. Finally, the attack is more effec=
tive
with a smaller minimum incremental relay fee, as more individual versions of
the transaction can be broadcast for a given fee-delta range.

Of course, this attack can be parallelized, with many non-conflicting A_n
chains at once.  Depending on P2P topology, maximum bandwidth may be consum=
able
by broadcasting multiple _conflicting_ A's to different nodes at once=B9, a
fairly obvious attack that I (and probably others) have already disclosed.

Replace-by-Fee-Rate mitigates the attack, by limiting the possible range of
fee-rate delta. For example, in Libre Relay, which does replace-by-fee-rate=
 at
a fee-rate ratio of >=3D 2x, if A starts at 3sat/VB, the attacker can only =
do 2
cycles of the attack as a B >=3D 6sat/VB will simply replace A.

Requiring the fee-rate to increase by at least some ratio in each replaceme=
nt
would also mitigate the attack at higher fee-rates. For example, at a fee-r=
ate
of 100sat/VB, a minimum fee-rate ratio of 10% would constitute a 10x reduct=
ion
in bandwidth usage vs the incremental fee-rate of 1sat/vB.

1) https://petertodd.org/2024/one-shot-replace-by-fee-rate#the-status-quo

--=20
https://petertodd.org 'peter'[:-1]@petertodd.org

--LuptQxBpgf3rLObG
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE0RcYcKRzsEwFZ3N5Lly11TVRLzcFAmXzG8cACgkQLly11TVR
Lzd7pQ/+OEoOokNZTjNB3rappZvDdrCIij8cenWff3RJrTsaiw4WqF9c9acqSOut
rtYPUvjIDn4s6oOzG6JGQV5Jy4KPqS40eoPZGgoiUxqeEkfzjN2+SIWxuUUeeffu
CjCM+yaxoKylGcYyuzJ97YdSi+ZdGgTYRs6ahOBtHotS6aioxES4wYuIFXhlC2QA
HBqEa1tXWE2vTUAt9hVPHn3kQYZAZgvjoA0i+tlBODgDjJCJWIbX9v8Ttov2g0Xq
nnoC5UafHkhnW1fKdWkHu1dLQ+hXx6hDM/NcsFCa2UMNKlC6iXpxz2maB2aPis2O
9cm/k6ipI0GDlUqb0lS17/Sn2A5BLexP27S3fnW49UmSsgZ5UpOr3KeIYKDrZ9/E
sxU/PHSkBMswMw7MzJV02uA0y3N7P8J8E26UCdRibooCnuoIH1a3uFCP2B4ffDBF
HPicLKKPEpYf/rcnjfq4pTQn4KfliH46ttzgP5eP8t0bzulWNiwCANcRGm54BHZQ
q8cEItou1QHeqT2WcWmw3qnESeXLg6EW3+6E2ww6ChtC7XzG343/eLErkyHX0yjh
lEaTV6JmFdW3DvCszsT8kfS1ePAgtRiwVGkS505ZOszZ3KwBVKLG7Z4bp2PH4d8a
SU7BS8eT/VPlHnj9bnulz3T8CmLDkqBtfUVSR2cQ1ikt99+r9bw=
=d4CI
-----END PGP SIGNATURE-----

--LuptQxBpgf3rLObG--
