summaryrefslogtreecommitdiff
path: root/ee/41df60d87e78aefa2987015668bfe12c761ac8
blob: e09d41d3a8e3cfc1d177d668eb06134f047eced4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Return-Path: <sergio.d.lerner@gmail.com>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
	[172.17.192.35])
	by mail.linuxfoundation.org (Postfix) with ESMTPS id D973E308
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Fri, 26 Aug 2016 13:17:36 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.7.6
Received: from mail-qt0-f173.google.com (mail-qt0-f173.google.com
	[209.85.216.173])
	by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 12C312F
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Fri, 26 Aug 2016 13:17:36 +0000 (UTC)
Received: by mail-qt0-f173.google.com with SMTP id u25so37495467qtb.1
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Fri, 26 Aug 2016 06:17:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc; bh=oJSy+3HrFRACq8B1IXC/+4RjlWr9sCtjzJrR4odutR4=;
	b=zfCvV33PR1NLhbcZyjw01D+rKYSVKGtc6KD+/ejxLmc89UpV/85FvF4NDOXPzEdJCP
	O6VJB8f6/JuM7eXPoUTQtNDm9hiPggZEQBVOcLtNZ1PhMOIEzG4ZCWa355/lQFGrprzR
	8NIrp32T091/96Aie6lBvRf8KnbCK7x0HUQbD+0bC1QkLcoGx089byWR+Os6oLp0DmAS
	4hzYgRu0WvYSgWbYDFXq4T7kASJuxTkvprypSqXgqQBe0HtSidOvdsL1HkeK5M/G0cs9
	sxi5JjjUX1u2CoLM1Xw+zkap5/gOYPgZxy/N2kec9MI0fSsmlzivM2AYbB8tRLW3Mu4N
	DRAw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=oJSy+3HrFRACq8B1IXC/+4RjlWr9sCtjzJrR4odutR4=;
	b=CE+3gY/nsEfkp2ADmxuN+HiY+IvllZ9XIBCRrLmHQb0ll9ZreH9qZdKLeQF/3D82dM
	lbJFOTHw7YUJyGgllMynC/W7FytG/Tg8mNbLMwKjAy3rhsnr0FEVIh5fY6pWdJLzpUC+
	M+YdYcCCj96q6cBHxVe7kN1WQTNXNHEmdW/ggtr+SPiHjv2a20a0GIA1ShEfc8zqBcOR
	KTZzP+tQ5Fyxhs9YlV4/fTlzS66bTtDwAg62903fTw03kN0o+JucKPY3tZ0slpPp7PPA
	KecPkoxuSv0OZ6ibcZ1Hi7WWk1fmwpb9hlylZ06ax4ej+CFlZdSdStDFisAi6e5+un+X
	UwWg==
X-Gm-Message-State: AE9vXwMcFCN1Z8z0u7MT0JfxFmuR0KdMiwTFDcWwa3izPlW5vuSJakJW5QluMrm8/sDOJCpOxto0/aahh2J6vA==
X-Received: by 10.200.50.82 with SMTP id y18mr3161972qta.29.1472217436685;
	Fri, 26 Aug 2016 06:17:16 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.200.46.221 with HTTP; Fri, 26 Aug 2016 06:16:36 -0700 (PDT)
In-Reply-To: <339348690.148734.1472089774841@privateemail.com>
References: <CAKzdR-q4hagujzWxJxmwpxJUQFLe7SKukbDNs=_S_VKgJ9N_TA@mail.gmail.com>
	<339348690.148734.1472089774841@privateemail.com>
From: Sergio Demian Lerner <sergio.d.lerner@gmail.com>
Date: Fri, 26 Aug 2016 10:16:36 -0300
Message-ID: <CAKzdR-oMEe6rcusn5kajZHvWXEkneywsNEJpooss76o9WuhDxg@mail.gmail.com>
To: Johnson Lau <jl2012@xbt.hk>
Content-Type: multipart/alternative; boundary=001a113ff53c58e2f9053af9558c
X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW
	autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
	smtp1.linux-foundation.org
Cc: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] Attack by modifying non-segwit transactions after
 segwit is accepted ?
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>,
	<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>,
	<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Aug 2016 13:17:37 -0000

--001a113ff53c58e2f9053af9558c
Content-Type: text/plain; charset=UTF-8

Because there was a discussion on reddit about this topic, I want to
clarify that Johnson Lau explained how a check in the code prevents this
attack.
So there is no real attack.

Also note that the subject of this thread has a question mark, which means
that I'm asking the community for clarification, not asserting the
existence of a vulnerability.

The segwit code is complex, and some key parts of the consensus code are
spread over the source files (such as state.CorruptionPossible() relation
to DoS banning, IsNull() check in witness program serialization, etc.).

Thanks again Johnson for your clarifications.


On Wed, Aug 24, 2016 at 10:49 PM, Johnson Lau <jl2012@xbt.hk> wrote:

> Adding witness data to a non-segwit script is invalid by consensus:
>
> https://github.com/bitcoin/bitcoin/blob/d612837814020ae832499d18e6ee5e
> b919a87907/src/script/interpreter.cpp#L1467
>
>
> This PR will detect such violation early and ban the peer:
>
> https://github.com/bitcoin/bitcoin/pull/8499
>
>
> Another approach is to run the scripts of all incoming transactions.
> That's not too bad as you have already fetched the utxos which is a major
> part of validation.
>

--001a113ff53c58e2f9053af9558c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Because there was a discussion on reddit about this t=
opic, I want to clarify that Johnson Lau explained how a check in the code =
prevents this attack.<br></div><div>So there is no real attack.<br></div><d=
iv><br></div><div>Also note that the subject of this thread has a question =
mark, which means that I&#39;m asking the community for clarification, not =
asserting the existence of a vulnerability.<br><br></div><div>The segwit co=
de is complex, and some key parts of the consensus code are spread over the=
 source files (such as state.CorruptionPossible() relation to DoS banning, =
IsNull() check in witness program serialization, etc.). <br><br></div><div>=
Thanks again Johnson for your clarifications.<br></div><div><br></div></div=
><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Wed, Aug 24, =
2016 at 10:49 PM, Johnson Lau <span dir=3D"ltr">&lt;<a href=3D"mailto:jl201=
2@xbt.hk" target=3D"_blank">jl2012@xbt.hk</a>&gt;</span> wrote:<br><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc s=
olid;padding-left:1ex"><u></u>

   =20
<div><p>Adding witness data to a non-segwit script is invalid by consensus:=
</p><p><a href=3D"https://github.com/bitcoin/bitcoin/blob/d612837814020ae83=
2499d18e6ee5eb919a87907/src/script/interpreter.cpp#L1467" target=3D"_blank"=
>https://github.com/bitcoin/<wbr>bitcoin/blob/<wbr>d612837814020ae832499d18=
e6ee5e<wbr>b919a87907/src/script/<wbr>interpreter.cpp#L1467</a></p><p><br><=
/p><p>This PR will detect such violation early and ban the peer:</p><p><a h=
ref=3D"https://github.com/bitcoin/bitcoin/pull/8499" target=3D"_blank">http=
s://github.com/bitcoin/<wbr>bitcoin/pull/8499</a></p><p></p><p><br></p><p>A=
nother approach is to run the scripts of all incoming transactions. That&#3=
9;s not too bad as you have already=C2=A0fetched the utxos which is a major=
 part of validation.</p></div>
 </blockquote></div><br></div>

--001a113ff53c58e2f9053af9558c--