Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate SSL pinning and trust chain verification. #534

Merged
merged 1 commit into from
Aug 30, 2017

Conversation

richardjrossiii
Copy link
Contributor

Oh boy. Here's a controversial change.

Let's give a bit of backstory.

A few weeks ago, Facebook was contacted by a whitehat hacker (the good
guys) about a security vulnerability here in SocketRocket.

For those of you who are truly interested in what that security flaw
was, it is essentially the same flaw as outlined here:

https://www.synopsys.com/blogs/software-security/ineffective-certificate-pinning-implementations/

So, we were faced with a choice - quietly push out a patch, and hope
that eventually existing applications updated, or be transparent and
admit we screwed up.

This is us admititng we screwed up. And while yes, we could probably fix
the implementation. But we talked internally, and decided that the best
approach here is to completely remove the option for pinning.

For all of our existing users that use certificate pinning, while we
understand that in the past there has been a very large barrier to entry
with getting a CA to issue a certificate.

However, since the rollout of CAs like LetsEncrypt, there's become an
ever-dwindling reason to actually use self-signed or unsigned
certificates.

For this reason, we're going to go ahead and deprecate the APIs that
allow SSL pinning and disabling trust chain verification. The pinning
APIs are now going to throw an exception when invoked, and the trust
chain APIs have deprecation warnings.

If you are a user of these APIs, and you for some reason CANNOT use
a trust chain validated certificate, PLEASE speak up. While we cannot
think of any reason to use those kinds of certificates, it's entirely
possible we overlooked something. We'll leave this pullrequest unmerged
for a two week period (Monday, August 28th, 2017), at which point,
unless we have feedback convincing us otherwise, we will go ahead with
this change.

Copy link
Contributor

@nlutsenko nlutsenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few nits on documentation, but looks good.
Feel free to merge at will or give it some soak time before, so everyone is aware of it.

@@ -13,6 +13,9 @@

NS_ASSUME_NONNULL_BEGIN

// NOTE: While publicly, SocketRocket does not support configuring the security policy with pinned certificates,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Use a section comment aka /** ... */ as well as document the class itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a private class as of right now, I don't think full documentation is required at this time. I will change to using /** comments though.

- (void)setSR_SSLPinnedCertificates:(nullable NSArray *)SR_SSLPinnedCertificates
{
[NSURLProtocol setProperty:[SR_SSLPinnedCertificates copy] forKey:SRSSLPinnnedCertificatesKey inRequest:self];
[NSException raise:NSGenericException
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Not sure if Generic or Parameter exception? You sure about Generic? Not that it matters much tho...

Oh boy. Here's a controversial change.
![](http://i.imgur.com/t8JjQix.gif)

Let's give a bit of backstory.

A few weeks ago, Facebook was contacted by a whitehat hacker (the good
guys) about a security vulnerability here in SocketRocket.

For those of you who are truly interested in what that security flaw
was, it is essentially the same flaw as outlined here:

https://www.synopsys.com/blogs/software-security/ineffective-certificate-pinning-implementations/

So, we were faced with a choice - quietly push out a patch, and hope
that eventually existing applications updated, or be transparent and
admit we screwed up.

This is us admititng we screwed up. And while yes, we could probably fix
the implementation. But we talked internally, and decided that the best
approach here is to completely remove the option for pinning.

For all of our existing users that use certificate pinning, while we
understand that in the past there has been a very large barrier to entry
with getting a CA to issue a certificate.

However, since the rollout of CAs like LetsEncrypt, there's become an
ever-dwindling reason to actually use self-signed or unsigned
certificates.

For this reason, we're going to go ahead and deprecate the APIs that
allow SSL pinning and disabling trust chain verification. The pinning
APIs are now going to throw an exception when invoked, and the trust
chain APIs have deprecation warnings.

If you are a user of these APIs, and you for some reason **CANNOT** use
a trust chain validated certificate, PLEASE speak up. While we cannot
think of any reason to use those kinds of certificates, it's entirely
possible we overlooked something. We'll leave this pullrequest unmerged
for a two week period (Monday, August 28th, 2017), at which point,
unless we have feedback convincing us otherwise, we will go ahead with
this change.
@richardjrossiii richardjrossiii merged commit 28035e1 into master Aug 30, 2017
@richardjrossiii richardjrossiii deleted the richardross.pinning branch August 30, 2017 21:19
vdbt added a commit to vdbt/SocketRocket that referenced this pull request Oct 23, 2017
Deprecate SSL pinning and trust chain verification. (facebookincubator#534)
@chax
Copy link

chax commented Feb 28, 2018

I know this is already merged, but here is an example where you would need self signed certificate and you don't have a possibility of using CA to make valid trusted certificate.

Imagine this, you have a device which has REST API and it's only accessible locally over LAN. Since it is local device, it has a local IP address, but doesn't have domain. You still want to use SSL for this REST API, that is, access it over HTTPS. Since it has only local IP address and no domain, it's impossible for CA to issue certificate and our only option is to use self signed certificate.

@davidperrenoud
Copy link

In the wake of Project Atlas and the lack of adoption of HPKP, wouldn't certificate pinning be useful in preventing eavesdropping by using a rogue root certificate?

Or is there a way to enforce Certificate Transparency inside my iOS/Android app?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants