Description
It is possible to configure Apache CXF to use the com.sun.net.ssl implementation via 'System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");'. When this system property is set, CXF uses some reflection to try to make the HostnameVerifier work with the old com.sun.net.ssl.HostnameVerifier interface. However, the default HostnameVerifier implementation in CXF does not implement the method in this interface, and an exception is thrown. However, in Apache CXF prior to 3.2.5 and 3.1.16 the exception is caught in the reflection code and not properly propagated. What this means is that if you are using the com.sun.net.ssl stack with CXF, an error with TLS hostname verification will not be thrown, leaving a CXF client subject to man-in-the-middle attacks.
Mitigation
We recommend upgrading to a version of this component that is not vulnerable to this specific issue. Alternatively, this vulnerability can be mitigated by ensuring that the `java.protocol.handler.pkgs` system property is not set to `com.sun.net.ssl.internal.www.protocol`. In other words, the following line should never be used without first upgrading:
`System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");`