Skip to content

Distrust certs issued after 00:00:00 Oct. 21, 2016 by StartCom and WoSign - #9469

Closed
shigeki wants to merge 2 commits into
nodejs:masterfrom
shigeki:WoSign_StartCom_check
Closed

Distrust certs issued after 00:00:00 Oct. 21, 2016 by StartCom and WoSign #9469
shigeki wants to merge 2 commits into
nodejs:masterfrom
shigeki:WoSign_StartCom_check

Conversation

@shigeki

Copy link
Copy Markdown
Contributor
Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

crypto, tls and test.

Description of change

Per discussion of #9434, this PR checks the certs issued by StartCom and WoSign and if notBefore is after 00:00:00 Oct. 21 2016, the tls client connection is failed with CERT_REVOKED error.

This also includes CNNIC whitelist update since #1895 that expired certs were removed and a minor bug fix of test/parallel/test-tls-cnnic-whitelist.js which came from 2bc7841.

R: @bnoordhuis

@shigekishigeki added tls Issues and PRs related to the tls subsystem. crypto Issues and PRs related to the crypto subsystem. test Issues and PRs related to the tests. labels Nov 4, 2016
@nodejs-github-botnodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Nov 4, 2016
@shigeki

Copy link
Copy Markdown
ContributorAuthor

@bnoordhuisbnoordhuis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mostly LGTM. There is a typo in the second commit log: s/udpate/update/

Comment threadsrc/node_crypto.cc Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You could write this as for (auto it : StartComAndWoSignDNs) {

@seishunseishunNov 4, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for (auto& startcom_wosign : StartComAndWoSignDNs) { to avoid a needless copy.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done. I used const auto& since it is just a reference.

Comment threadtest/fixtures/keys/Makefile Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you wrap this at 80 columns?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done. I missed Makefile is out of lint checks.

Comment threadsrc/StartComAndWoSignData.inc Outdated

@not-an-aardvarknot-an-aardvarkNov 4, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just as a precaution: How did you create these arrays? We might want to double-check that they are accurate. (I'm hoping to avoid an issue like this.)

@shigekishigekiNov 7, 2016

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

The data is ASN.1 encoded with Name type. Here is a list of subject names included in StartComAndWoSignData.inc and they all matches the names listed in https://bugzilla.mozilla.org/show_bug.cgi?id=1309707#c16 and certdata.txt in Node.

$ cat printStartComWoSign.cc
#include<cstdint>
#include<cstdio>
#include<x509.h>
#include<bio.h>
#include"StartComAndWoSignData.inc"intmain() {
char buf[1024];
constunsignedchar* startcom_wosign_data;
X509_NAME* startcom_wosign_name;
BIO *bio = BIO_new_fp(stdout, BIO_NOCLOSE);
for(constauto& it : StartComAndWoSignDNs) {
startcom_wosign_data = it.data;
startcom_wosign_name = d2i_X509_NAME(NULL, &startcom_wosign_data, it.len);
X509_NAME_oneline(startcom_wosign_name, buf, sizeof buf);
BIO_printf(bio, "%s\n", buf);
}
}
$ ./printStartComWoSign
/C=CN/O=WoSign CA Limited/CN=CA \xE6\xB2\x83\xE9\x80\x9A\xE6\xA0\xB9\xE8\xAF\x81\xE4\xB9\xA6
/C=CN/O=WoSign CA Limited/CN=CA WoSign ECC Root
/C=CN/O=WoSign CA Limited/CN=Certification Authority of WoSign
/C=CN/O=WoSign CA Limited/CN=Certification Authority of WoSign G2
/C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Certification Authority
/C=IL/O=StartCom Ltd./CN=StartCom Certification Authority G2

Comment threadsrc/node_crypto.cc Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm... would there possibly be a more generic way of doing this? Adding functions that are specific to StartCom and WoSign seems... troubling.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I don't think it leads troubling because this function checks the cert subject name with a specific type of structure provided by Mozilla only for StartCom and WoSign distrusting.
This function (and this features) will be removed after deprecating their root cert when all issued certs are expired. So I don't think it need to be more generic.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

const?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

@shigeki
shigekiforce-pushed the WoSign_StartCom_check branch from e8ae182 to 20750b6CompareNovember 7, 2016 01:11
@shigeki

Copy link
Copy Markdown
ContributorAuthor

Fixed this according to the comments except the one from @jasnell .

@indutny Sorry for missing you to mention. Please look at this if you have time.

@indutnyindutny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, if CI is green.

Comment threadsrc/node_crypto.cc Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could it be const?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

It's not. I'm not sure why.

intX509_cmp_time(constASN1_TIME*s, time_t*t);

@shigeki

Copy link
Copy Markdown
ContributorAuthor

CI is again running on https://ci.nodejs.org/job/node-test-pull-request/4795/ .

Comment threadsrc/node_crypto.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor, but calling it it is confusing, as it's not an iterator.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@seishun Yes, I rename it to dn after 'distinguished name`. Thanks.

@ChALkeRChALkeR added the security Issues and PRs related to security. label Nov 7, 2016
@ChALkeR

Copy link
Copy Markdown
Member

@bnoordhuis, does that look good to you now?

@shigeki

Copy link
Copy Markdown
ContributorAuthor

I've just resolved the conflict of test/parallel/test-tls-cnnic-whitelist.js and rebased against the latest master.

Firefox51 is to be stable on Jan 24th and Chrome56 is on Jan 31st, 2017. They will begin to have WoSing/StartCom checks in their stable release.

I think it is better to land this in the end of Jan, 2017 to align the browser release.

@shigeki

Copy link
Copy Markdown
ContributorAuthor

Chrome 56 is released today. It is ready to land this. The approval from @bnoordhuis is needed. How is it?

@bnoordhuisbnoordhuis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. s/certifiate/certificate/ in the first commit log and I'd say "Remove expired certificates from CNNIC whitelist." in the second one.

@shigeki
shigekiforce-pushed the WoSign_StartCom_check branch from e11d2ab to 4e5bc71CompareJanuary 26, 2017 16:29
@shigeki

Copy link
Copy Markdown
ContributorAuthor

@bnoordhuis Oh, typo. Thanks. Fixed.

I also added an announcement link from apple https://support.apple.com/en-us/HT204132 in the commit log. I will land this tomorrow after rebasing and running CI.

After that, it should be discussed if it should be backported to LTS.

@jasnell

Copy link
Copy Markdown
Member

I'm +1 on backporting this to 6 and 4. @nodejs/lts

@shigeki
shigekiforce-pushed the WoSign_StartCom_check branch from 4e5bc71 to 9363bd0CompareJanuary 31, 2017 11:06
imyller added a commit to imyller/meta-nodejs that referenced this pull request Mar 2, 2017
 Notable changes:
* deps:
* update V8 to 5.5 (Michaël Zasso) [#11029](nodejs/node#11029)
* upgrade libuv to 1.11.0 (cjihrig) [#11094](nodejs/node#11094)
* add node-inspect 1.10.4 (Jan Krems) [#10187](nodejs/node#10187)
* upgrade zlib to 1.2.11 (Sam Roberts) [#10980](nodejs/node#10980)
* lib: build `node inspect` into `node` (Anna Henningsen) [#10187](nodejs/node#10187)
* crypto: Remove expired certs from CNNIC whitelist (Shigeki Ohtsu) [#9469](nodejs/node#9469)
* inspector: add --inspect-brk (Josh Gavant) [#11149](nodejs/node#11149)
* fs: allow WHATWG URL objects as paths (James M Snell) [#10739](nodejs/node#10739)
* src: support UTF-8 in compiled-in JS source files (Ben Noordhuis) [#11129](nodejs/node#11129)
* url: extend url.format to support WHATWG URL (James M Snell) [#10857](nodejs/node#10857)
PR-URL: nodejs/node#11185
Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
jasnell pushed a commit that referenced this pull request Mar 7, 2017
CNNIC Whitelist was updated with removing expired certificates.
Fixes: #1895
PR-URL: #9469
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
jasnell pushed a commit that referenced this pull request Mar 7, 2017
When tls client connects to the server with certification issued by
either StartCom or WoSign listed in StartComAndWoSignData.inc, check
notBefore of the server certificate and CERT_REVOKED error returns if
it is after 00:00:00 on October 21, 2016.
See for details in
https://blog.mozilla.org/security/2016/10/24/distrusting-new-wosign-and-startcom-certificates/,
https://security.googleblog.com/2016/10/distrusting-wosign-and-startcom.html
and
https://support.apple.com/en-us/HT204132Fixes: #9434
PR-URL: #9469
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
jasnell pushed a commit that referenced this pull request Mar 7, 2017
CNNIC Whitelist was updated with removing expired certificates.
Fixes: #1895
PR-URL: #9469
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
jasnell pushed a commit that referenced this pull request Mar 7, 2017
When tls client connects to the server with certification issued by
either StartCom or WoSign listed in StartComAndWoSignData.inc, check
notBefore of the server certificate and CERT_REVOKED error returns if
it is after 00:00:00 on October 21, 2016.
See for details in
https://blog.mozilla.org/security/2016/10/24/distrusting-new-wosign-and-startcom-certificates/,
https://security.googleblog.com/2016/10/distrusting-wosign-and-startcom.html
and
https://support.apple.com/en-us/HT204132Fixes: #9434
PR-URL: #9469
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
CNNIC Whitelist was updated with removing expired certificates.
Fixes: #1895
PR-URL: #9469
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
When tls client connects to the server with certification issued by
either StartCom or WoSign listed in StartComAndWoSignData.inc, check
notBefore of the server certificate and CERT_REVOKED error returns if
it is after 00:00:00 on October 21, 2016.
See for details in
https://blog.mozilla.org/security/2016/10/24/distrusting-new-wosign-and-startcom-certificates/,
https://security.googleblog.com/2016/10/distrusting-wosign-and-startcom.html
and
https://support.apple.com/en-us/HT204132Fixes: #9434
PR-URL: #9469
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@MylesBorinsMylesBorins mentioned this pull request Mar 9, 2017
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
CNNIC Whitelist was updated with removing expired certificates.
Fixes: #1895
PR-URL: #9469
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
When tls client connects to the server with certification issued by
either StartCom or WoSign listed in StartComAndWoSignData.inc, check
notBefore of the server certificate and CERT_REVOKED error returns if
it is after 00:00:00 on October 21, 2016.
See for details in
https://blog.mozilla.org/security/2016/10/24/distrusting-new-wosign-and-startcom-certificates/,
https://security.googleblog.com/2016/10/distrusting-wosign-and-startcom.html
and
https://support.apple.com/en-us/HT204132Fixes: #9434
PR-URL: #9469
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@MylesBorinsMylesBorins mentioned this pull request Mar 9, 2017
shigeki pushed a commit that referenced this pull request Mar 28, 2017
The additional validity checks applied to StartCom and WoSign
certificates failed to free memory before returning.
Refs: #9469Fixes: #12033
PR-URL: #12089
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 28, 2017
The additional validity checks applied to StartCom and WoSign
certificates failed to free memory before returning.
Refs: #9469Fixes: #12033
PR-URL: #12089
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 29, 2017
The additional validity checks applied to StartCom and WoSign
certificates failed to free memory before returning.
Refs: #9469Fixes: #12033
PR-URL: #12089
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 29, 2017
The additional validity checks applied to StartCom and WoSign
certificates failed to free memory before returning.
Refs: #9469Fixes: #12033
PR-URL: #12089
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 29, 2017
The additional validity checks applied to StartCom and WoSign
certificates failed to free memory before returning.
Refs: #9469Fixes: #12033
PR-URL: #12089
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 29, 2017
The additional validity checks applied to StartCom and WoSign
certificates failed to free memory before returning.
Refs: #9469Fixes: #12033
PR-URL: #12089
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 29, 2017
The additional validity checks applied to StartCom and WoSign
certificates failed to free memory before returning.
Refs: #9469Fixes: #12033
PR-URL: #12089
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
kevinsawicki pushed a commit to electron/node that referenced this pull request May 16, 2017
When tls client connects to the server with certification issued by
either StartCom or WoSign listed in StartComAndWoSignData.inc, check
notBefore of the server certificate and CERT_REVOKED error returns if
it is after 00:00:00 on October 21, 2016.
See for details in
https://blog.mozilla.org/security/2016/10/24/distrusting-new-wosign-and-startcom-certificates/,
https://security.googleblog.com/2016/10/distrusting-wosign-and-startcom.html
and
https://support.apple.com/en-us/HT204132Fixes: nodejs/node#9434
PR-URL: nodejs/node#9469
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
kevinsawicki pushed a commit to electron/node that referenced this pull request May 16, 2017
CNNIC Whitelist was updated with removing expired certificates.
Fixes: nodejs/node#1895
PR-URL: nodejs/node#9469
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
kevinsawicki pushed a commit to electron/node that referenced this pull request May 16, 2017
The additional validity checks applied to StartCom and WoSign
certificates failed to free memory before returning.
Refs: nodejs/node#9469Fixes: nodejs/node#12033
PR-URL: nodejs/node#12089
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.cryptoIssues and PRs related to the crypto subsystem.securityIssues and PRs related to security.testIssues and PRs related to the tests.tlsIssues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

11 participants

@shigeki@ChALkeR@jasnell@joaocgreis@sam-github@indutny@bnoordhuis@seishun@not-an-aardvark@MylesBorins@nodejs-github-bot