diff options
author | Peter Hartmann <peter.hartmann@nokia.com> | 2011-09-05 10:53:49 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2011-09-06 14:25:20 (GMT) |
commit | 64adbd0c5775f97343afbe0e7b5fde0d70bdaedd (patch) | |
tree | 1b9c7bbcfd15bedc8a80e655a3841d9664145087 /src | |
parent | ef774ee93cb561d072137f2a11c2d347bedf6342 (diff) | |
download | Qt-64adbd0c5775f97343afbe0e7b5fde0d70bdaedd.zip Qt-64adbd0c5775f97343afbe0e7b5fde0d70bdaedd.tar.gz Qt-64adbd0c5775f97343afbe0e7b5fde0d70bdaedd.tar.bz2 |
QSslCertificate: block all DigiNotar (intermediate and root) certs
and do not only check leaf certificates, but all intermediates and
the root. Tested manually with the cross-signed intermediates.
Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/network/ssl/qsslcertificate.cpp | 27 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_openssl.cpp | 15 |
2 files changed, 34 insertions, 8 deletions
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index ab09932..2a2ad55 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -792,15 +792,38 @@ static const char *certificate_blacklist[] = { "92:39:d5:34:8f:40:d1:69:5a:74:54:70:e1:f2:3f:43", "addons.mozilla.org", // Comodo "b0:b7:13:3e:d0:96:f9:b5:6f:ae:91:c8:74:bd:3a:c0", "login.live.com", // Comodo "d8:f3:5f:4e:b7:87:2b:2d:ab:06:92:e3:15:38:2f:b0", "global trustee", // Comodo - "05:e2:e6:a4:cd:09:ea:54:d6:65:b0:75:fe:22:a2:56", "*.google.com", // DigiNotar + + "05:e2:e6:a4:cd:09:ea:54:d6:65:b0:75:fe:22:a2:56", "*.google.com", // leaf certificate issued by DigiNotar + "0c:76:da:9c:91:0c:4e:2c:9e:fe:15:d0:58:93:3c:4c", "DigiNotar Root CA", // DigiNotar root + "f1:4a:13:f4:87:2b:56:dc:39:df:84:ca:7a:a1:06:49", "DigiNotar Services CA", // DigiNotar intermediate signed by DigiNotar Root + "36:16:71:55:43:42:1b:9d:e6:cb:a3:64:41:df:24:38", "DigiNotar Services 1024 CA", // DigiNotar intermediate signed by DigiNotar Root + "0a:82:bd:1e:14:4e:88:14:d7:5b:1a:55:27:be:bf:3e", "DigiNotar Root CA G2", // other DigiNotar Root CA + "a4:b6:ce:e3:2e:d3:35:46:26:3c:b3:55:3a:a8:92:21", "CertiID Enterprise Certificate Authority", // DigiNotar intermediate signed by "DigiNotar Root CA G2" + "5b:d5:60:9c:64:17:68:cf:21:0e:35:fd:fb:05:ad:41", "DigiNotar Qualified CA", // DigiNotar intermediate signed by DigiNotar Root + + "1184640176", "DigiNotar Services 1024 CA", // DigiNotar intermediate cross-signed by Entrust + "120000525", "DigiNotar Cyber CA", // DigiNotar intermediate cross-signed by CyberTrust + "120000505", "DigiNotar Cyber CA", // DigiNotar intermediate cross-signed by CyberTrust + "120000515", "DigiNotar Cyber CA", // DigiNotar intermediate cross-signed by CyberTrust + "20015536", "DigiNotar PKIoverheid CA Overheid en Bedrijven", // DigiNotar intermediate cross-signed by the Dutch government + "20001983", "DigiNotar PKIoverheid CA Organisatie - G2", // DigiNotar intermediate cross-signed by the Dutch government + "d6:d0:29:77:f1:49:fd:1a:83:f2:b9:ea:94:8c:5c:b4", "DigiNotar Extended Validation CA", // DigiNotar intermediate signed by DigiNotar EV Root + "1e:7d:7a:53:3d:45:30:41:96:40:0f:71:48:1f:45:04", "DigiNotar Public CA 2025", // DigiNotar intermediate +// "(has not been seen in the wild so far)", "DigiNotar Public CA - G2", // DigiNotar intermediate +// "(has not been seen in the wild so far)", "Koninklijke Notariele Beroepsorganisatie CA", // compromised during DigiNotar breach +// "(has not been seen in the wild so far)", "Stichting TTP Infos CA," // compromised during DigiNotar breach + "1184640175", "DigiNotar Root CA", // DigiNotar intermediate cross-signed by Entrust + "1184644297", "DigiNotar Root CA", // DigiNotar intermediate cross-signed by Entrust 0 }; bool QSslCertificatePrivate::isBlacklisted(const QSslCertificate &certificate) { for (int a = 0; certificate_blacklist[a] != 0; a++) { + QString blacklistedCommonName = QString::fromUtf8(certificate_blacklist[(a+1)]); if (certificate.serialNumber() == certificate_blacklist[a++] && - certificate.subjectInfo(QSslCertificate::CommonName) == QString::fromUtf8(certificate_blacklist[a])) + (certificate.subjectInfo(QSslCertificate::CommonName) == blacklistedCommonName || + certificate.issuerInfo(QSslCertificate::CommonName) == blacklistedCommonName)) return true; } return false; diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 5a606af..8e53974 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1246,12 +1246,15 @@ bool QSslSocketBackendPrivate::startHandshake() // Start translating errors. QList<QSslError> errors; - if (QSslCertificatePrivate::isBlacklisted(configuration.peerCertificate)) { - QSslError error(QSslError::CertificateBlacklisted, configuration.peerCertificate); - errors << error; - emit q->peerVerifyError(error); - if (q->state() != QAbstractSocket::ConnectedState) - return false; + // check the whole chain for blacklisting (including root, as we check for subjectInfo and issuer) + foreach (const QSslCertificate &cert, configuration.peerCertificateChain) { + if (QSslCertificatePrivate::isBlacklisted(cert)) { + QSslError error(QSslError::CertificateBlacklisted, cert); + errors << error; + emit q->peerVerifyError(error); + if (q->state() != QAbstractSocket::ConnectedState) + return false; + } } bool doVerifyPeer = configuration.peerVerifyMode == QSslSocket::VerifyPeer |