How I tricked Symantec with a Fake Private Key

Hanno's Blog

Thursday, July 20. 2017

How I tricked Symantec with a Fake Private Key


Trackbacks

Wellenreiten 07/2017
Wer als “Websurfer” metaphorisch auf den Wellen des Netzes reitet, findet dabei zwar keine paradiesischen Inseln, manchmal aber immerhin ganz interessante Lektüre. Im Juli 2017 kann ich u.a. folgende Fundstücke empfehlen und der werten Lesers
Weblog: Netz - Rettung - Recht
Tracked: Aug 01, 07:35

Comments
Display comments as (Linear | Threaded)

What a sad world we live in :( Noobs, noobs everywhere.
Great job, Hanno!
#1 Peter on 2017-07-20 20:09 (Reply)
>> Comodo didn’t fall for it. They answered me that there is something wrong with this key.

Were they responding to you as the reporter "I found something suspicious in Pastebin" or as the site owner?

Basically, did they at any point contact the domain owner (via their WHOIS email or whatever) to say "Someone appears to have uploaded a private key to Pastebin"?

Asking for a friend.
#2 Rory on 2017-07-20 21:14 (Reply)
Comodo didn't respond to me as a domain owner at all. However what I don't know is if they responded to the site owners of the legitimate revocations.
#2.1 Hanno (Homepage) on 2017-07-20 21:19 (Reply)
Great find!

Comodo seems to have updated their description already https://support.comodo.com/index.php?/Knowledgebase/Article/View/684/17/how-do-i-verify-that-a-private-key-matches-a-certificate-openssl

Aside from that, I'm not sure what the intended use of their article is. My personal guess is that it's intended to be useful for people who have to match their private key files to their public key files. Usually they'd not have a "forged" key laying around. For the purpose of finding the right file it's completely reasonable to only check the modulus. I imagine a case where some guy that manages his own websites somehow confused the naming of his key files and needs to match them again.
However it's always better to check for consistency, of couse.

My point being: It might be unfair to imply that all of the descriptions that you found are *wrong* when their purpose is not to cryptographically verify that some private key belongs to some public key but to merely match one file to another.

It's terrifying though that you actually were able to "abuse" that in a real scenario with a real CA involved. (Well, you could debate whether they are a "real CA" ;) )
#3 Nocta on 2017-07-20 21:52 (Reply)
> My point being: It might be unfair to imply that all of the descriptions that
> you found are *wrong* when their purpose is not to cryptographically
> verify that some private key belongs to some public key but to merely
> match one file to another.

I understand your argument, but I disagree.
Ultimately if you want to be a trustworthy security company whatever you put on your webpage may be considered reliable information by people seeking to educate themselves. Thus I expect that such information is both accurate and tries to err on the side of security by default.

And it doesn't matter here for whom that information was meant to be. If it's out on the Internet you can expect people will find and read it.
#3.1 Hanno (Homepage) on 2017-07-21 09:17 (Reply)
Re: "Notably there are downstream consumers of this function that failed to copy that part of the documentation, see for example the corresponding PHP function (the limitation is however mentioned in a comment by a user)."

The PHP documentation [1] has been updated [2] to include a very similar note as that in the OpenSSL docs. Thank you for your feedback.

[1] http://php.net/manual/en/function.openssl-x509-check-private-key.php
[2] https://bugs.php.net/74959
#4 Peter on 2017-07-20 23:17 (Reply)
That's good. However as I already said in the OpenSSL bug tracker I don't think this is an issue that should be fixed by documenting it better. Ultimately if the function is named "check private key" then it should check the private key.

But I understand that PHP is just forwarding the function call to OpenSSL. It should be fixed there.
#4.1 Hanno (Homepage) on 2017-07-21 10:07 (Reply)
Agreed. I just wanted to update the docs, whether the function implementation is fixed or not, it's important to know it's (current) limitations.
#4.1.1 Peter on 2017-07-21 18:10 (Reply)
The question "does the private key match" IMO is the wrong question in this context, and it is rather silly to stupid that there is a separate process for this case.
What SHOULD be done is that the private key should be used to generate and sign a revocation request (something that any sane key infrastructure should already support, though a search indicates the TLS infrastructure might not qualify), thus just re-using an ordinary and fully automated method of revocation.
Yes, there also needs to be a way to revoke certificates if the owner lost access to the private key, but there are good reasons for that to be a manual process with heavy checking (thus take some time), but there is no reason to use it for all other cases that could be handled 100% automated and ought to result in certificates being revoked within minutes.
#5 RD on 2017-07-21 16:00 (Reply)
Actually there is such a method for the TLS ecosystem, it's part of the ACME protocol. However I think currently only Let's Encrypt supports it [1].

[1] https://letsencrypt.org/docs/revoking/
#5.1 Hanno (Homepage) on 2017-07-21 16:17 (Reply)
typo: accidentaly -> accidentally
#6 Dan Langille (Homepage) on 2017-07-25 22:54 (Reply)
Thanks for bringing awareness to this issue! I've updated the checks and information at https://www.sslshopper.com/certificate-key-matcher.html to do the full check instead of just a modulus check.
#7 Robert (Homepage) on 2017-08-16 16:14 (Reply)

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

 
 

About

This blog is written by Hanno Böck. Unless noted otherwise, its content is licensed as CC0.

You can find my web page with links to my work as a journalist here.

I am also publishing a newsletter about climate change and decarbonization technologies.

The blog uses the free software Serendipity and is hosted at schokokeks.org.

Hanno on Mastodon | Contact / Imprint | Privacy / Datenschutz