<p>Have a look at the early sources here: <a href="http://www.bitcointrading.com/forum/bitcoin-clients/original-bitcoin-source-code-archives/" rel="noreferrer">http://www.bitcointrading.com/forum/bitcoin-clients/original-bitcoin-source-code-archives/</a></p>

<p>there is a small piece of code in script.cpp:</p>

<pre><code>    case OP_RETURN:
    {
        pc = pend;
    }
    break;
</code></pre>

<p>which allows to spend ANY UTXO with just a very simple scriptSig <code>OP_1 OP_RETURN</code></p>

CC BY-SA 3.0
2015-06-17T16:49:42.937Z
Wow, what a monumental oversight. I'm not versed in C++, so can you clarify what's happening? It looks like if it's a `6a` (op_return) push code is encountered, the code breaks, leaving `op_true` on the stack, making the Tx valid?
Wizard Of Ozzie
CC BY-SA 3.0
2015-06-17T17:08:41.203Z
Yes, in the early bitcoin versions `OP_RETURN` just finished the script evaluation without changing the stack value. So, the stack had 1 on the top. The other flaw in that version was concatenating scriptSig and scriptPubkey to one byte array and executing them as one script, not as two consecutive scripts. `return EvalScript(txin.scriptSig + CScript(OP_CODESEPARATOR) + txout.scriptPubKey, txTo, nIn, nHashType);` The bug was fixed by changing `OP_RETURN` opcode: now it finishes script execution as 'failed'
amaclin
CC BY-SA 4.0
2022-11-03T14:50:58.747Z
Wow, possibly the world's best example of Linus's Law https://en.wikipedia.org/wiki/Linus%27s_law
Michael Altfield
CC BY-SA 3.0
2015-06-17T10:15:24.463Z
2015-06-17T10:15:24.463Z
amaclin
<p>From Nathaniel Popper's <em>“Digital Gold : Bitcoin and the Inside Story of the Misfits and Millionaires Trying to Reinvent Money"</em>, this heavily edited (by me, for clarity) excerpt:</p>

<blockquote>
  <p>“In late July Gavin and Satoshi got an e-mail from ...a programmer
  from Germany going by the screen name ArtForz, ... had found a
  previously undiscovered weakness in the code that ...made it possible
  to spend Bitcoins in someone else’s wallet.”</p>
  
  <p>“For now, don’t call it the ‘1 RETURN’ bug to anyone who doesn’t
  already know about it,” Satoshi wrote to Gavin.”</p>
</blockquote>

<p>What is this <code>1 RETURN</code> bug? It's obviously been patched, but I'm interested because the book doesn't delve into technical details. </p>

<p>(FWIW, I highly recommend buying this book).</p>

CC BY-SA 4.0
2022-11-04T04:55:28.917Z
"In July..." What year was this?
Michael Altfield
<security><history><weaknesses>
What is the "1 RETURN" bug?
Wizard Of Ozzie
# What is the "1 RETURN" bug?

(Asked by: username_0 on 2015-06-17)

From Nathaniel Popper's *“Digital Gold : Bitcoin and the Inside Story of the Misfits and Millionaires Trying to Reinvent Money"*, this heavily edited (by me, for clarity) excerpt:

> “In late July Gavin and Satoshi got an e-mail from ...a programmer
> from Germany going by the screen name ArtForz, ... had found a
> previously undiscovered weakness in the code that ...made it possible
> to spend Bitcoins in someone else’s wallet.”
>
> “For now, don’t call it the ‘1 RETURN’ bug to anyone who doesn’t
> already know about it,” Satoshi wrote to Gavin.”

What is this `1 RETURN` bug? It's obviously been patched, but I'm interested because the book doesn't delve into technical details.

(FWIW, I highly recommend buying this book).

**Tags:** security, history, weaknesses

> **Comments:**
> **username_1**: "In July..." What year was this?  

---

## 1 answers

### Answer by username_2 on 2015-06-17. Score: 11 | Accepted answer

Have a look at the early sources here: <http://www.bitcointrading.com/forum/bitcoin-clients/original-bitcoin-source-code-archives/>

there is a small piece of code in script.cpp:

```
    case OP_RETURN:
    {
        pc = pend;
    }
    break;

```

which allows to spend ANY UTXO with just a very simple scriptSig `OP_1 OP_RETURN`

> **Comments:**
> **username_0**: Wow, what a monumental oversight. I'm not versed in C++, so can you clarify what's happening? It looks like if it's a `6a` (op_return) push code is encountered, the code breaks, leaving `op_true` on the stack, making the Tx valid?  
> **username_2**: Yes, in the early bitcoin versions `OP_RETURN` just finished the script evaluation without changing the stack value. So, the stack had 1 on the top. The other flaw in that version was concatenating scriptSig and scriptPubkey to one byte array and executing them as one script, not as two consecutive scripts. `return EvalScript(txin.scriptSig + CScript(OP_CODESEPARATOR) + txout.scriptPubKey, txTo, nIn, nHashType);` The bug was fixed by changing `OP_RETURN` opcode: now it finishes script execution as 'failed'  
> **username_1**: Wow, possibly the world's best example of Linus's Law https://en.wikipedia.org/wiki/Linus%27s_law  

---

