From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 5B67B2C for ; Tue, 3 Jan 2017 03:54:37 +0000 (UTC) X-Greylist: delayed 00:15:04 by SQLgrey-1.7.6 Received: from sender-of-o52.zoho.com (sender-of-o52.zoho.com [135.84.80.217]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 713D0134 for ; Tue, 3 Jan 2017 03:54:35 +0000 (UTC) Received: from [192.168.1.111] (137.189.135.19 [137.189.135.19]) by mx.zohomail.com with SMTPS id 148341476514442.140201455812075; Mon, 2 Jan 2017 19:39:25 -0800 (PST) From: Johnson Lau Message-Id: <6A91D4E4-750D-42C0-B593-3D5014B8A3F7@xbt.hk> Content-Type: multipart/alternative; boundary="Apple-Mail=_4D9A32A2-08CF-4030-98EA-EE8CF86DD278" Mime-Version: 1.0 (Mac OS X Mail 10.0 \(3226\)) Date: Tue, 3 Jan 2017 11:39:19 +0800 In-Reply-To: To: Jeremy , bitcoin-dev References: <400152B9-1838-432A-829E-13E4FC54320C@gmail.com> X-Mailer: Apple Mail (2.3226) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Steve Davis Subject: Re: [bitcoin-dev] Script Abuse Potential? X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2017 03:54:37 -0000 --Apple-Mail=_4D9A32A2-08CF-4030-98EA-EE8CF86DD278 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 No, there could only have not more than 201 opcodes in a script. So you = may have 198 OP_2DUP at most, i.e. 198 * 520 * 2 =3D 206kB For OP_CAT, just check if the returned item is within the 520 bytes = limit. > On 3 Jan 2017, at 11:27, Jeremy via bitcoin-dev = wrote: >=20 > It is an unfortunate script, but can't actually =E2=80=8Bdo that = much=E2=80=8B it seems=E2=80=8B. The MAX_SCRIPT_ELEMENT_SIZE =3D 520 = Bytes.=E2=80=8B Thus, it would seem the worst you could do with this = would be to (10000-520*2)*520*2 bytes ~=3D~ 10 MB. >=20 > =E2=80=8BMuch more concerning would be the op_dup/op_cat style bug, = which under a similar script =E2=80=8Bwould certainly cause out of = memory errors :) >=20 >=20 >=20 > -- > @JeremyRubin = > On Mon, Jan 2, 2017 at 4:39 PM, Steve Davis via bitcoin-dev = > wrote: > Hi all, >=20 > Suppose someone were to use the following pk_script: >=20 > [op_2dup, op_2dup, op_2dup, op_2dup, op_2dup, ...(to limit)..., = op_2dup, op_hash160, , op_equalverify, op_checksig] >=20 > This still seems to be valid AFAICS, and may be a potential attack = vector? >=20 > Thanks. >=20 >=20 > _______________________________________________ > bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org = > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev = >=20 >=20 > _______________________________________________ > bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev --Apple-Mail=_4D9A32A2-08CF-4030-98EA-EE8CF86DD278 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
No, there could only have not more than 201 = opcodes in a script. So you may have 198 OP_2DUP at most, i.e. 198 * 520 = * 2 =3D 206kB

For OP_CAT, just check if the returned item is within the 520 = bytes limit.

On 3 Jan 2017, at 11:27, Jeremy via = bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> wrote:

It is an unfortunate script, but can't = actually 
=E2=80=8Bdo
 that much
=E2=80=8B it = seems=E2=80=8B
. The MAX_SCRIPT_ELEMENT_SIZE =3D 520 = Bytes.
=E2=80=8B Thus, it would seem the worst you could = do with this would be to (10000-520*2)*520*2 bytes  ~=3D~= 10 MB.

=E2=80=8BMuch more concerning would be = the op_dup/op_cat style bug, which under a similar script =E2=80=8Bwould = certainly cause out of memory errors :)



On Mon, Jan 2, 2017 at 4:39 = PM, Steve Davis via bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> = wrote:
Hi all,

Suppose someone were to use the following = pk_script:

[op_2dup, op_2dup, op_2dup, = op_2dup, op_2dup, ...(to limit)..., op_2dup, op_hash160, = <addr_hash>, op_equalverify, op_checksig]

This still seems to be = valid AFAICS, and may be a potential attack vector?

Thanks.


_______________________________________________
bitcoin-dev mailing list
bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev


_______________________________________________
bitcoin-dev = mailing list
bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev<= br class=3D"">

= --Apple-Mail=_4D9A32A2-08CF-4030-98EA-EE8CF86DD278--