Commit db7c295e authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[JM-1394] Fixed possible security vulnerability in trust manager via hijacked/spoofed dns.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10537 b35dd754-fafc-0310-a699-88a17e54d16e
parent 5760ff4d
...@@ -136,18 +136,17 @@ public class ServerTrustManager implements X509TrustManager { ...@@ -136,18 +136,17 @@ public class ServerTrustManager implements X509TrustManager {
} }
} }
// Verify that the first certificate in the chain corresponds to // Verify that the server either matches an identity from the chain, or
// the server we desire to authenticate. // a wildcard.
// Check if the certificate uses a wildcard indicating that subdomains are valid Boolean found = false;
if (peerIdentities.size() == 1 && peerIdentities.get(0).startsWith("*.")) { for (String identity : peerIdentities) {
// Remove the wildcard if (identity.equals(server) || identity.equals("*." + server)) {
String peerIdentity = peerIdentities.get(0).replace("*.", ""); found = true;
// Check if the requested subdomain matches the certified domain break;
if (!server.endsWith(peerIdentity)) {
throw new CertificateException("target verification failed of " + peerIdentities);
} }
} }
else if (!peerIdentities.contains(server)) {
if (!found) {
throw new CertificateException("target verification failed of " + peerIdentities); throw new CertificateException("target verification failed of " + peerIdentities);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment