JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
Java


JAVA.INSEC.HVO : Insecure verifier Override for Hostname (Java)

要旨

A method that always returns true is used to perform hostname verification.

A method is considered to perform hostname verification if it's annotated with @com.juliasoft.julia.checkers.unsafeConnection.VerifiesHostname.

プロパティ

クラス名 Insecure verifier Override for Hostname (Java)
日本語クラス名 Insecure verifier Override for Hostname (Java)
クラス分類 セキュリティ (security)
ニーモニック JAVA.INSEC.HVO
カテゴリー
CWE CWE:287 Improper Authentication
OWASP-2017 OWASP-2017:A2 Broken authentication
OWASP-2021 OWASP-2021:A7 Identification and authorization failures
OWASP-2025 OWASP-2025:A07 Authentication Failures
対応言語 Available for Java and Kotlin.
有効/無効設定 このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Insecure verifier Override for Hostname (Java)"

// AuthenticationVerification.java
package com.juliasoft.julia.tests.checks.unsafeConnection;

import java.io.IOException;
import java.net.InetAddress;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

import javax.net.SocketFactory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
import javax.net.ssl.X509TrustManager;

import android.net.SSLCertificateSocketFactory;
import android.net.SSLSessionCache;

public class AuthenticationVerification {
  public static void verifier(String hostname, SSLSession session) {
      new HostnameVerifier() {
          @Override
          public boolean verify(String hostname, SSLSession session) {
              return true;                            /* Use of Insecure verify for Hostname (Java) warning issued here 
                                                       * - CodeSonar treats HostnameVerifier.verify() method
                                                       *   as annotated with @VerifiesHostname, but here it always returns true
                                                       */
          }
      }.verify(hostname, session);                    /* Insecure verifier Override for Hostname (Java) warning issued here 
                                                       * - invocation of verify() method that always returns true
                                                       */
  }

  public static void manager(X509Certificate[] serverChain, X509Certificate[] clientChain, String authType) throws CertificateException {
      new X509TrustManager() {
          @Override
          public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                                                      /* Use of Insecure verify for Certificate (Java) warning issued here 
                                                       * - CodeSonar treats X509TrustManager.checkClientTrusted())
                                                       *    as annotated with @ChecksPrincipalTrust, but here it never throws CertificateException
                                                       */
          }

          @Override
          public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                                                      /* Use of Insecure verify for Certificate (Java) warning issued here 
                                                      * - CodeSonar treats X509TrustManager.checkServerTrusted()
                                                      *   as annotated with @ChecksPrincipalTrust, but here it never throws CertificateException
                                                       */
          }

          @Override
          public X509Certificate[] getAcceptedIssuers() {
              return new X509Certificate[0];
          }
      }.checkServerTrusted(serverChain, authType);    /* Insecure verifier Override for Certificate (Java) warning issued here 
                                                       * - invocation of checkServerTrusted() method that never throws CertificateException
                                                       */
  }

  public static void sockets(SSLSessionCache cache) throws IOException {
      SocketFactory factory = SSLCertificateSocketFactory.getInsecure(100, cache); /* Insecure Socket Factory (Java) warning issued here 
                                                       * - CodeSonar treats SSLCertificateSocketFactory.getInsecure()
                                                       *   as annotated with @YieldsInsecureSSLSocketFactory
                                                       */
      InetAddress addr = InetAddress.getByName("www.juliasoft.com");
      factory.createSocket(addr, 100);                /* Untrusted Network Host (Java) warning issued here 
                                                       * - CodeSonar treats the first parameter to SocketFactory.createSocket()
                                                       *   as annotated with @HostnameToBeVerified, but verification is not performed on addr here 
                                                       */
  }
}

関連のある設定ファイルパラメータ

設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。

 

To report problems with this documentation, please visit https://support.codesecure.com/.