From 756478486524bb59933907bdb413709ea55167b4 Mon Sep 17 00:00:00 2001 From: markd Date: Fri, 1 Apr 2011 20:53:55 +0000 Subject: Add blacklist of fraudulent certificates. Patch from upstream. Bump PKGREVISION. --- x11/qt4-libs/Makefile | 3 +- x11/qt4-libs/distinfo | 6 +- .../patch-src_network_ssl_qsslcertificate.cpp | 75 ++++++++++++++++++++++ .../patch-src_network_ssl_qsslcertificate_p.h | 27 ++++++++ .../patch-src_network_ssl_qsslsocket_openssl.cpp | 35 ++++++++++ 5 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 x11/qt4-libs/patches/patch-src_network_ssl_qsslcertificate.cpp create mode 100644 x11/qt4-libs/patches/patch-src_network_ssl_qsslcertificate_p.h create mode 100644 x11/qt4-libs/patches/patch-src_network_ssl_qsslsocket_openssl.cpp (limited to 'x11') diff --git a/x11/qt4-libs/Makefile b/x11/qt4-libs/Makefile index db781540a88..5ded53448b0 100644 --- a/x11/qt4-libs/Makefile +++ b/x11/qt4-libs/Makefile @@ -1,10 +1,11 @@ -# $NetBSD: Makefile,v 1.57 2011/03/03 05:50:04 adam Exp $ +# $NetBSD: Makefile,v 1.58 2011/04/01 20:53:55 markd Exp $ PKG_DESTDIR_SUPPORT= user-destdir .include "../../x11/qt4-libs/Makefile.common" PKGNAME= qt4-libs-${QTVERSION} +PKGREVISION= 1 COMMENT= C++ X GUI toolkit # XXX this is to test what really gets installed when 'do-install' is disabled diff --git a/x11/qt4-libs/distinfo b/x11/qt4-libs/distinfo index b828417acd2..44e54d44a8a 100644 --- a/x11/qt4-libs/distinfo +++ b/x11/qt4-libs/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.51 2011/03/03 05:50:04 adam Exp $ +$NetBSD: distinfo,v 1.52 2011/04/01 20:53:55 markd Exp $ SHA1 (qt-everywhere-opensource-src-4.7.2.tar.gz) = 84414f82bbc9e8d356b986d5d1ebee89d06e4f2e RMD160 (qt-everywhere-opensource-src-4.7.2.tar.gz) = de3d1c172c23c33681a0945c331db179c84cb7b5 @@ -42,3 +42,7 @@ SHA1 (patch-cf) = 8b18fce7f564e8cd688f09fd5de6340771f428e8 SHA1 (patch-cg) = c5948cea47fb4134c626415b0b2c36660beea64a SHA1 (patch-ch) = 8efaa05e564022710ff978b59581c017bbece979 SHA1 (patch-ci) = 2fecb3ea7796fcf5c0db421a9d10b31a35225c6d +SHA1 (patch-src_network_ssl_qsslcertificate.cpp) = e3dbbdbe1357f000abf5833758b79350d1a6f266 +SHA1 (patch-src_network_ssl_qsslcertificate_p.h) = 1f3335975dc42661311e85fd06e7c48e7eed5687 +SHA1 (patch-src_network_ssl_qsslsocket_openssl.cpp) = 47c5aa045abbc02f027515c00fa8b12847ff0884 + diff --git a/x11/qt4-libs/patches/patch-src_network_ssl_qsslcertificate.cpp b/x11/qt4-libs/patches/patch-src_network_ssl_qsslcertificate.cpp new file mode 100644 index 00000000000..a171f4f764d --- /dev/null +++ b/x11/qt4-libs/patches/patch-src_network_ssl_qsslcertificate.cpp @@ -0,0 +1,75 @@ +$NetBSD: patch-src_network_ssl_qsslcertificate.cpp,v 1.1 2011/04/01 20:53:55 markd Exp $ + +From 04e074e8d7c097295505e63565abdc7ca2b49f7b Mon Sep 17 00:00:00 2001 +From: Peter Hartmann +Date: Thu, 24 Mar 2011 14:42:22 +0100 +Subject: [PATCH] QSslCertificate: report fraudulent certificates as invalid + +There are some fraudulent certificates in the wild that are not valid; +this patch introduces a blacklist of serial numbers of those +certificates. + +Reviewed-by: Richard J. Moore +Reviewed-by: Markus Goetz +Task-number: QTBUG-18338 +--- + +diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp +index 618ac79..a5cdf01 100644 +--- src/network/ssl/qsslcertificate.cpp ++++ src/network/ssl/qsslcertificate.cpp +@@ -219,17 +219,19 @@ bool QSslCertificate::isNull() const + Returns true if this certificate is valid; otherwise returns + false. + +- Note: Currently, this function only checks that the current ++ Note: Currently, this function checks that the current + data-time is within the date-time range during which the +- certificate is considered valid. No other checks are +- currently performed. ++ certificate is considered valid, and checks that the ++ certificate is not in a blacklist of fraudulent certificates. + + \sa isNull() + */ + bool QSslCertificate::isValid() const + { + const QDateTime currentTime = QDateTime::currentDateTime(); +- return currentTime >= d->notValidBefore && currentTime <= d->notValidAfter; ++ return currentTime >= d->notValidBefore && ++ currentTime <= d->notValidAfter && ++ ! QSslCertificatePrivate::isBlacklisted(*this); + } + + /*! +@@ -798,6 +800,30 @@ QList QSslCertificatePrivate::certificatesFromDer(const QByteAr + return certificates; + } + ++// These certificates are known to be fraudulent and were created during the comodo ++// compromise. See http://www.comodo.com/Comodo-Fraud-Incident-2011-03-23.html ++static const char *certificate_blacklist[] = { ++ "04:7e:cb:e9:fc:a5:5f:7b:d0:9e:ae:36:e1:0c:ae:1e", ++ "f5:c8:6a:f3:61:62:f1:3a:64:f5:4f:6d:c9:58:7c:06", ++ "d7:55:8f:da:f5:f1:10:5b:b2:13:28:2b:70:77:29:a3", ++ "39:2a:43:4f:0e:07:df:1f:8a:a3:05:de:34:e0:c2:29", ++ "3e:75:ce:d4:6b:69:30:21:21:88:30:ae:86:a8:2a:71", ++ "e9:02:8b:95:78:e4:15:dc:1a:71:0a:2b:88:15:44:47", ++ "92:39:d5:34:8f:40:d1:69:5a:74:54:70:e1:f2:3f:43", ++ "b0:b7:13:3e:d0:96:f9:b5:6f:ae:91:c8:74:bd:3a:c0", ++ "d8:f3:5f:4e:b7:87:2b:2d:ab:06:92:e3:15:38:2f:b0", ++ 0 ++}; ++ ++bool QSslCertificatePrivate::isBlacklisted(const QSslCertificate &certificate) ++{ ++ for (int a = 0; certificate_blacklist[a] != 0; a++) { ++ if (certificate.serialNumber() == certificate_blacklist[a]) ++ return true; ++ } ++ return false; ++} ++ + #ifndef QT_NO_DEBUG_STREAM + QDebug operator<<(QDebug debug, const QSslCertificate &certificate) + { diff --git a/x11/qt4-libs/patches/patch-src_network_ssl_qsslcertificate_p.h b/x11/qt4-libs/patches/patch-src_network_ssl_qsslcertificate_p.h new file mode 100644 index 00000000000..336c86ab510 --- /dev/null +++ b/x11/qt4-libs/patches/patch-src_network_ssl_qsslcertificate_p.h @@ -0,0 +1,27 @@ +$NetBSD: patch-src_network_ssl_qsslcertificate_p.h,v 1.1 2011/04/01 20:53:55 markd Exp $ + +From 04e074e8d7c097295505e63565abdc7ca2b49f7b Mon Sep 17 00:00:00 2001 +From: Peter Hartmann +Date: Thu, 24 Mar 2011 14:42:22 +0100 +Subject: [PATCH] QSslCertificate: report fraudulent certificates as invalid + +There are some fraudulent certificates in the wild that are not valid; +this patch introduces a blacklist of serial numbers of those +certificates. + +Reviewed-by: Richard J. Moore +Reviewed-by: Markus Goetz +Task-number: QTBUG-18338 + +diff --git a/src/network/ssl/qsslcertificate_p.h b/src/network/ssl/qsslcertificate_p.h +index cdceb0f..1ce33d3 100644 +--- src/network/ssl/qsslcertificate_p.h ++++ src/network/ssl/qsslcertificate_p.h +@@ -96,6 +96,7 @@ public: + static QSslCertificate QSslCertificate_from_X509(X509 *x509); + static QList certificatesFromPem(const QByteArray &pem, int count = -1); + static QList certificatesFromDer(const QByteArray &der, int count = -1); ++ static bool isBlacklisted(const QSslCertificate &certificate); + + friend class QSslSocketBackendPrivate; + diff --git a/x11/qt4-libs/patches/patch-src_network_ssl_qsslsocket_openssl.cpp b/x11/qt4-libs/patches/patch-src_network_ssl_qsslsocket_openssl.cpp new file mode 100644 index 00000000000..dc35c17ad23 --- /dev/null +++ b/x11/qt4-libs/patches/patch-src_network_ssl_qsslsocket_openssl.cpp @@ -0,0 +1,35 @@ +From b87528a71b66e786c11804d7b79e408aae612748 Mon Sep 17 00:00:00 2001 +From: Peter Hartmann +Date: Fri, 25 Mar 2011 13:45:24 +0100 +Subject: [PATCH] QSslSocket internals: abort on encountering blacklisted certificates + +tested manually with "openssl s_server -cert blacklisted.pem -key +key.pem" and connecting a QSslSocket. + +Reviewed-by: Markus Goetz +Task-number: QTBUG-18338 +--- + src/network/ssl/qsslsocket_openssl.cpp | 7 +++++++ + 1 files changed, 7 insertions(+), 0 deletions(-) + +diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp +index 0866534..2427193 100644 +--- src/network/ssl/qsslsocket_openssl.cpp ++++ src/network/ssl/qsslsocket_openssl.cpp +@@ -1193,6 +1193,13 @@ bool QSslSocketBackendPrivate::startHandshake() + X509 *x509 = q_SSL_get_peer_certificate(ssl); + configuration.peerCertificate = QSslCertificatePrivate::QSslCertificate_from_X509(x509); + q_X509_free(x509); ++ if (QSslCertificatePrivate::isBlacklisted(configuration.peerCertificate)) { ++ q->setErrorString(QSslSocket::tr("The peer certificate is blacklisted")); ++ q->setSocketError(QAbstractSocket::SslHandshakeFailedError); ++ emit q->error(QAbstractSocket::SslHandshakeFailedError); ++ plainSocket->disconnectFromHost(); ++ return false; ++ } + + // Start translating errors. + QList errors; +-- +1.6.1 + -- cgit v1.2.3