[axis] 45/60: Fix CVE-2014-3596
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Thu Jan 12 17:30:45 UTC 2017
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to branch master
in repository axis.
commit 36b5144525b865ae2b1d8bceb752f8f1a3c925cf
Author: Markus Koschany <apo at debian.org>
Date: Thu Sep 25 20:47:50 2014 +0000
Fix CVE-2014-3596
---
debian/changelog | 20 ++++
debian/compat | 2 +-
debian/control | 8 +-
...fix-CVE-2012-5784.patch => CVE-2014-3596.patch} | 111 +++++++++++++--------
debian/patches/series | 2 +-
5 files changed, 97 insertions(+), 46 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 7303e38..4bd6f4b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,23 @@
+axis (1.4-21) unstable; urgency=high
+
+ * Team upload.
+ * Fix CVE-2014-3596.
+ - Relace 06-fix-CVE-2012-5784.patch with CVE-2014-3596.patch which fixes
+ both CVE issues. Thanks to Raphael Hertzog for the report.
+ - The getCN function in Apache Axis 1.4 and earlier does not properly
+ verify that the server hostname matches a domain name in the subject's
+ Common Name (CN) or subjectAltName field of the X.509 certificate,
+ which allows man-in-the-middle attackers to spoof SSL servers via a
+ certificate with a subject that specifies a common name in a field
+ that is not the CN field. NOTE: this issue exists because of an
+ incomplete fix for CVE-2012-5784.
+ - (Closes: #762444)
+ * Declare compliance with Debian Policy 3.9.6.
+ * Use compat level 9 and require debhelper >=9.
+ * Use canonical VCS fields.
+
+ -- Markus Koschany <apo at gambaru.de> Thu, 25 Sep 2014 19:45:08 +0000
+
axis (1.4-20) unstable; urgency=low
* Updated the dependency on the Servlet API (2.5 -> 3.0)
diff --git a/debian/compat b/debian/compat
index 7f8f011..ec63514 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-7
+9
diff --git a/debian/control b/debian/control
index c881402..009e364 100644
--- a/debian/control
+++ b/debian/control
@@ -6,13 +6,13 @@ Uploaders: Torsten Werner <twerner at debian.org>,
Damien Raude-Morvan <drazzib at debian.org>,
Jakub Adam <jakub.adam at ktknet.cz>,
Emmanuel Bourg <ebourg at apache.org>
-Build-Depends: debhelper (>= 7), cdbs, ant-optional, default-jdk, libwsdl4j-java,
+Build-Depends: debhelper (>= 9), cdbs, ant-optional, default-jdk, libwsdl4j-java,
libcommons-logging-java, libcommons-httpclient-java, bnd,
libcommons-discovery-java, libgnumail-java, libservlet3.0-java,
maven-repo-helper
-Standards-Version: 3.9.4
-Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/axis
-Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/axis
+Standards-Version: 3.9.6
+Vcs-Svn: svn://anonscm.debian.org/pkg-java/trunk/axis
+Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-java/trunk/axis
Homepage: http://ws.apache.org/axis/
Package: libaxis-java
diff --git a/debian/patches/06-fix-CVE-2012-5784.patch b/debian/patches/CVE-2014-3596.patch
similarity index 73%
rename from debian/patches/06-fix-CVE-2012-5784.patch
rename to debian/patches/CVE-2014-3596.patch
index 7c47487..bf36a97 100644
--- a/debian/patches/06-fix-CVE-2012-5784.patch
+++ b/debian/patches/CVE-2014-3596.patch
@@ -1,19 +1,25 @@
-Description: Fixed CN extraction from DN of X500 principal and wildcard validation
+From: David Jorm and Arun Neelicattu (Red Hat Product Security)
+Date: Thu, 25 Sep 2014 19:38:17 +0000
+Subject: CVE-2014-3596
- axis (1.4-16.2) unstable; urgency=low
+The getCN function in Apache Axis 1.4 and earlier does not properly
+verify that the server hostname matches a domain name in the subject's
+Common Name (CN) or subjectAltName field of the X.509 certificate,
+which allows man-in-the-middle attackers to spoof SSL servers via a
+certificate with a subject that specifies a common name in a field
+that is not the CN field. NOTE: this issue exists because of an
+incomplete fix for CVE-2012-5784.
- * Fixed CN extraction from DN of X500 principal and wildcard validation
+Forwarded: no
+Bug: https://bugs.debian.org/762444
+---
+ .../axis/components/net/JSSESocketFactory.java | 309 ++++++++++++++++++++-
+ 1 file changed, 303 insertions(+), 6 deletions(-)
-Author: Alberto Fernández Martínez <infjaf at gmail.com>
-
-
-Origin: other
-Bug-Debian: http://bugs.debian.org/692650
-Forwarded: https://issues.apache.org/jira/browse/AXIS-2883
-Last-Update: <2012-12-06>
-
---- axis-1.4.orig/src/org/apache/axis/components/net/JSSESocketFactory.java
-+++ axis-1.4/src/org/apache/axis/components/net/JSSESocketFactory.java
+diff --git a/src/org/apache/axis/components/net/JSSESocketFactory.java b/src/org/apache/axis/components/net/JSSESocketFactory.java
+index dd3f991..abffcdd 100644
+--- a/src/org/apache/axis/components/net/JSSESocketFactory.java
++++ b/src/org/apache/axis/components/net/JSSESocketFactory.java
@@ -15,12 +15,6 @@
*/
package org.apache.axis.components.net;
@@ -27,13 +33,14 @@ Last-Update: <2012-12-06>
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
-@@ -28,7 +22,27 @@ import java.io.OutputStream;
+@@ -28,7 +22,33 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateParsingException;
+import java.security.cert.X509Certificate;
++import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.Hashtable;
@@ -41,9 +48,14 @@ Last-Update: <2012-12-06>
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
-+import java.util.StringTokenizer;
+import java.util.regex.Pattern;
+
++import javax.naming.InvalidNameException;
++import javax.naming.NamingException;
++import javax.naming.directory.Attribute;
++import javax.naming.directory.Attributes;
++import javax.naming.ldap.LdapName;
++import javax.naming.ldap.Rdn;
+import javax.net.ssl.SSLException;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSocket;
@@ -55,7 +67,7 @@ Last-Update: <2012-12-06>
/**
-@@ -41,6 +55,10 @@ import java.util.Hashtable;
+@@ -41,6 +61,10 @@ import java.util.Hashtable;
*/
public class JSSESocketFactory extends DefaultSocketFactory implements SecureSocketFactory {
@@ -66,7 +78,7 @@ Last-Update: <2012-12-06>
/** Field sslFactory */
protected SSLSocketFactory sslFactory = null;
-@@ -187,6 +205,260 @@ public class JSSESocketFactory extends D
+@@ -187,6 +211,279 @@ public class JSSESocketFactory extends DefaultSocketFactory implements SecureSoc
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage("createdSSL00"));
}
@@ -74,8 +86,8 @@ Last-Update: <2012-12-06>
return sslSocket;
}
+ /**
-+ * Verifies that the given hostname in certicifate is the hostname we are trying to connect to
-+ * http://www.cvedetails.com/cve/CVE-2012-5783/
++ * Verifies that the given hostname in certicifate is the hostname we are trying to connect to.
++ * This resolves CVE-2012-5784 and CVE-2014-3596
+ * @param host
+ * @param ssl
+ * @throws IOException
@@ -139,9 +151,9 @@ Last-Update: <2012-12-06>
+ // to establish the socket to the hostname in the certificate.
+ // Don't trim the CN, though.
+
-+ String cn = getCN(cert);
++ String[] cns = getCNs(cert);
+ String[] subjectAlts = getDNSSubjectAlts(cert);
-+ verifyHostName(host, cn.toLowerCase(Locale.US), subjectAlts);
++ verifyHostName(host, cns, subjectAlts);
+
+ }
+
@@ -188,7 +200,7 @@ Last-Update: <2012-12-06>
+ * @throws SSLException
+ */
+
-+ private static void verifyHostName(final String host, String cn, String[] subjectAlts)throws SSLException{
++ private static void verifyHostName(final String host, String[] cns, String[] subjectAlts)throws SSLException{
+ StringBuffer cnTested = new StringBuffer();
+
+ for (int i = 0; i < subjectAlts.length; i++){
@@ -201,13 +213,18 @@ Last-Update: <2012-12-06>
+ cnTested.append("/").append(name);
+ }
+ }
-+ if (cn != null && verifyHostName(host, cn)){
-+ return;
-+ }
-+ cnTested.append("/").append(cn);
++ for (int i = 0; i < cns.length; i++) {
++ String cn = cns[i];
++ if (cn != null) {
++ cn = cn.toLowerCase(Locale.US);
++ if (verifyHostName(host, cn)) {
++ return;
++ }
++ cnTested.append("/").append(cn);
++ }
++ }
+ throw new SSLException("hostname in certificate didn't match: <"
+ + host + "> != <" + cnTested + ">");
-+
+ }
+
+ private static boolean verifyHostName(final String host, final String cn){
@@ -300,7 +317,7 @@ Last-Update: <2012-12-06>
+ }
+
+
-+ private static String getCN(X509Certificate cert) {
++ private static String[] getCNs(X509Certificate cert) {
+ // Note: toString() seems to do a better job than getName()
+ //
+ // For example, getName() gives me this:
@@ -310,20 +327,34 @@ Last-Update: <2012-12-06>
+ // EMAILADDRESS=juliusdavies at cucbc.com
+ String subjectPrincipal = cert.getSubjectX500Principal().toString();
+
-+ return getCN(subjectPrincipal);
++ return getCNs(subjectPrincipal);
+
+ }
-+ private static String getCN(String subjectPrincipal) {
-+ StringTokenizer st = new StringTokenizer(subjectPrincipal, ",");
-+ while(st.hasMoreTokens()) {
-+ String tok = st.nextToken().trim();
-+ if (tok.length() > 3) {
-+ if (tok.substring(0, 3).equalsIgnoreCase("CN=")) {
-+ return tok.substring(3);
-+ }
-+ }
-+ }
-+ return null;
++ private static String[] getCNs(String subjectPrincipal) {
++ if (subjectPrincipal == null) {
++ return null;
++ }
++ final List cns = new ArrayList();
++ try {
++ final LdapName subjectDN = new LdapName(subjectPrincipal);
++ final List rdns = subjectDN.getRdns();
++ for (int i = rdns.size() - 1; i >= 0; i--) {
++ final Rdn rds = (Rdn) rdns.get(i);
++ final Attributes attributes = rds.toAttributes();
++ final Attribute cn = attributes.get("cn");
++ if (cn != null) {
++ try {
++ final Object value = cn.get();
++ if (value != null) {
++ cns.add(value.toString());
++ }
++ }
++ catch (NamingException ignore) {}
++ }
++ }
++ }
++ catch (InvalidNameException ignore) { }
++ return cns.isEmpty() ? null : (String[]) cns.toArray(new String[ cns.size() ]);
+ }
+
}
diff --git a/debian/patches/series b/debian/patches/series
index 3e6ca49..bbd7595 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,4 +2,4 @@
02-gcj-4.4.patch
axis-bz152255.patch
javadoc.diff
-06-fix-CVE-2012-5784.patch
+CVE-2014-3596.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/axis.git
More information about the pkg-java-commits
mailing list