What was the specific exploit in the Tx script evaluation process?

Explanation by Mike Hearn:

When Bitcoin was first released, it contained two completely fatal bugs that made the entire system worthless. Fortunately, they were found and fixed before Bitcoin actually had any serious value.

The first bug was that scripts were concatenated before being run instead of just using a shared stack. This meant that anyone could write a scriptSig that always evaluated to true and claim anyone elses coins. Fixed here in v0.3.2:


Needless to say, if somebody when this version was first released actually wrote such a scriptSig and stole some coins, that would have caused a chain split between old and new versions. Nobody did because, why bother? I'm not even sure Mt Gox existed back then, iirc that came some months later. Many script opcodes were disabled around this time (which is also a hard-forking change).

  • 1
    So like the scriptsig "1 1 OP_EQUALVERIFY" could sign and obtain a Tx output? – pinhead May 10 '14 at 0:39
  • I'm a little unclear on how this could lead to someone stealing coins. Could you give an example scriptSig? – Nick ODell May 14 '15 at 19:22
  • @NickODell you could do things like push 0x{size of scriptPubKey} and then the execution would basically just involve pushing the serialized scriptPubKey on the stack, which would evaluate to true. Alternatively, a scriptSig of OP_TRUE OP_RETURN used to be able to spend any coins, before op return was changed to mean automatic failure. – StephenM347 Jun 14 '15 at 3:48

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.