r/Bitcoin • u/marcan42 • May 02 '16
How Craig constructed the "message" that he "signed" using Satoshi's key
Craig was a bit clever here. He did not cheat, and did not use modified command line tools. He indeed posted a message signed by Satoshi's key, that validates correctly. This might explain how he fooled a few people. However, that message just so happens to be a hash of an early Bitcoin transaction, not anything proving his identity. Here's how he did it.
First, check out Dan Kaminsky's blogpost for less-stupid instructions and an archive of the files you need (instead of having to transcribe hex from Craig's post). Although Dan concludes that the signature does not validate, that's actually only due to the & vs. && bug in the last bash command. If you run the corrected command, it works:
$ base64 --decode signiture.der > sig.asn1 && openssl dgst -verify sn-pub.pem -signature sig.asn1 sn7-message.txt
Verified OK
What's the signed message? This:
$ xxd sn7-message.txt
00000000: 479f 9dff 0155 c045 da78 4021 7785 5fdb G....U.E.x@!w._.
00000010: 4f0f 396d c0d2 c24f 7376 dd56 e2e6 8b05 O.9m...Osv.V....
That's just binary junk. It was really signed by Satoshi though.
We now know that the signature turned out to correspond to a real Bitcoin transaction (credit to /u/JoukeH). Compare its input script with:
$ xxd sig.asn1
00000000: 3045 0221 00c1 2a7d 5497 2f26 d14c b311 0E.!..*}T./&.L..
00000010: 339b 5122 f8c1 8741 7dde 1e8e fb68 41f5 3.Q"...A}....hA.
00000020: 5c34 220a e002 2066 632c 5cd4 161e fa3a \4"... fc,\....:
00000030: 2837 764e ee9e b849 75dd 54c2 de28 65e9 (7vN...Iu.T..(e.
00000040: 7525 85c5 3e7c ce u%..>|.
So where did sn7-message.txt come from? To put it together, we need to follow the OP_CHECKSIG documentation. Specifically, the message to be signed is the transaction, but with the input script replaced with the output script of the transaction that sent the coins in the first place, plus the hash type value of '1'.
First we download the two transactions:
$ curl -so send.bin https://webbtc.com/tx/12b5633bad1f9c167d523ad1aa1947b2732a865bf5414eab2f9e5ae5d5c191ba.bin
$ curl -so spend.bin https://webbtc.com/tx/828ef3b079f9c23829c56fe86e85b4a69d9e06e5b54ea597eef5fb3ffef509fe.bin
Then we dike out the script bit from send.bin and insert it into spend.bin, replacing the input script, and append '1' as a 32-bit little endian integer:
$ head -c 41 spend.bin >sig_txn.bin
$ dd if=send.bin bs=1 skip=204 count=68 status=none >>sig_txn.bin
$ tail -c 161 spend.bin >>sig_txn.bin
$ echo -ne '\x01\x00\x00\x00' >>sig_txn.bin
Take the SHA-256 hash and there you go:
$ sha256sum sig_txn.bin
479f9dff0155c045da78402177855fdb4f0f396dc0d2c24f7376dd56e2e68b05 sig_txn.bin
You can also validate this against the Signature Hash field in webbtc's script debug view. Bitcoin actually does a double SHA-256 here, once as part of the protocol, and once as part of the elliptic curve code. So apply sha256sum again:
$ sha256sum sn7-message.txt
3ec9cbc0d1aa849c16a1b276b246e057e7232b21926e428cc09b692c14336f44 sn7-message.txt
... and you get the Signature Hash.
Interestingly, the source address of this transaction (the bit cut out from send.bin) is the same as in the example on the OP_CHECKSIG documentation wiki page - so he was too lazy even to pick another address, although he picked a different spend transaction.
This is what us security guys call a replay attack. Well played, Craig.
Edits: links and spelling.
Edit2: to make it clear, as /u/bedstefar points out, this doesn't prove that Craig is not Satoshi. It only proves that his blog post doesn't prove that he is Satoshi, and anyone could've written a similar blog post.
Edit3: the blog post does claim that the (incompletely displayed, unverifiable) Sartre text hashes to the same hash as my sig_txn.bin. That much is obviously a lie and patent nonsense, unless you believe he's the first person in the world to come up with a SHA-256 preimage attack. He didn't have to doctor any screenshots or tools for that, the lie is that where he says "The contents of this file have been displayed in the figure below." he's displaying the contents of a different file.
Edit4: Wow, thanks for the gold!
19
u/zappso May 02 '16
Craig's blog post may be convoluted and ambiguous but now you've shown it contains a big lie:
Either Craig is lying, or he has found a SHA256 collision where the hash of a text file of Sartre is the same as the hash derived from the transactions you described.
23
u/Crackmacs May 02 '16
I don't understand this but I am glad you guys are on top of it. To me, a hobbyist/enthusiast or whatever, layman? It seems like Craig's story just doesn't add up. He should have rock solid proof but isn't providing it? If he were Satoshi, it would be pretty trivial right?
92
u/[deleted] May 02 '16 edited May 02 '16
Thanks for this.
This will be highly embarrassing for Andresen, Matonis and the media that are involved in this 'reveal'
16
u/dooglus May 02 '16
I repeated your steps and verified that I can create a 274 byte file with the same sha256 hash as Wright's "Sartre" file but which contains no 'a's:
http://i.imgur.com/QdJ6iBh.png
So while we have no proof that Wright isn't satoshi, we also have no proof that he is. We also have proof that he has taken an old signature made by satoshi years ago and attempted to pass it off as a new signature.
1
u/flat5 May 02 '16
"Compare its input script with:"
Can someone explain what "input script" is being referred to here?
3
u/jl_2012 May 02 '16
It is never possible to prove someone is not Satoshi, unless he/she is just too young to be Satoshi.
3
u/[deleted] May 02 '16
Camus can do, but Sartre is smarter.
3
u/[deleted] May 02 '16
AGENDA: Evidently as Wright cannot provide a clear proof he just brings noise confusion and FUD.
The doubt will still be used to organize a social attack on bitcoin enforcing Gavin takeover of development and attacking core, bringing blacklists, huge blocks on centralized institutions controlled by banks.
END of the experiment and smoke big cigar
2
u/TotesMessenger May 02 '16
I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:
If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / ^Contact)
1
u/Satonamo May 02 '16
Thanks a ton for this explanation, I was looking for this.
1
u/DunningKrooger May 02 '16
1
u/Lite_Coin_Guy May 03 '16
marcan42 700 bits /u/changetip Thx for that. Here are some free bits :-)
0
u/[deleted] May 02 '16
Meaningless. Bitcoin is now autonomous in that anon controls how it evolves from now on.
0
u/[deleted] May 02 '16
[deleted] — view deleted comment
5
u/[deleted] May 02 '16
[removed] — view removed comment