public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: "Russell O'Connor" <roconnor@blockstream.io>
To: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] Script Abuse Potential?
Date: Tue, 3 Jan 2017 00:04:50 -0500	[thread overview]
Message-ID: <CAMZUoKmOSj9+q-QHL==7ATRpP8b-jyjJpdEZbzXk2eFXcY6S4w@mail.gmail.com> (raw)
In-Reply-To: <6A91D4E4-750D-42C0-B593-3D5014B8A3F7@xbt.hk>

[-- Attachment #1: Type: text/plain, Size: 1994 bytes --]

OP_2DUP?  Why not OP_3DUP?

On Mon, Jan 2, 2017 at 10:39 PM, Johnson Lau via bitcoin-dev <
bitcoin-dev@lists.linuxfoundation.org> wrote:

> 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 = 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
> ​do
>  that much
> ​ it seems​
> . The MAX_SCRIPT_ELEMENT_SIZE = 520 Bytes.
> ​ Thus, it would seem the worst you could do with this would be to (10000-520*2)*520*2
> bytes  ~=~ 10 MB.
>
> ​Much more concerning would be the op_dup/op_cat style bug, which under a
> similar script ​would certainly cause out of memory errors :)
>
>
>
> --
> @JeremyRubin <https://twitter.com/JeremyRubin>
> <https://twitter.com/JeremyRubin>
>
> 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
>
>
>
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>
>

[-- Attachment #2: Type: text/html, Size: 5289 bytes --]

  reply	other threads:[~2017-01-03  5:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.11263.1483391161.31141.bitcoin-dev@lists.linuxfoundation.org>
2017-01-02 21:39 ` [bitcoin-dev] Script Abuse Potential? Steve Davis
2017-01-03  3:27   ` Jeremy
2017-01-03  3:39     ` Johnson Lau
2017-01-03  5:04       ` Russell O'Connor [this message]
2017-01-04  0:13       ` Jeremy
2017-01-04  3:13         ` Russell O'Connor
2017-01-04 14:45           ` Jorge Timón
2017-01-05 16:22             ` Jeremy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMZUoKmOSj9+q-QHL==7ATRpP8b-jyjJpdEZbzXk2eFXcY6S4w@mail.gmail.com' \
    --to=roconnor@blockstream.io \
    --cc=bitcoin-dev@lists.linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox