Java


JAVA.INSEC.LDAP.ANON : Anonymous LDAP Authentication (Java)

要旨

LDAP authentication is set to anonymous, thus compromising security.

This checker identifies security issues related to authentication procedures, such as using no password for LDAP authentication or using the host name in conditions.

プロパティ

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

The following code is taken from Sun Microsystem's None.java example.

import javax.naming.*;
import javax.naming.directory.*;

import java.util.Hashtable;

public class None {

  @SuppressWarnings({ "rawtypes", "unchecked" })
  public static void main(String[] args) {
    // Set up environment for creating initial context
    Hashtable env = new Hashtable(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial");

    // Use anonymous authentication
    env.put(Context.SECURITY_AUTHENTICATION, "none"); // "Anonymous LDAP Authentication (Java)" warning issued here

    try {
      // Create initial context
      DirContext ctx = new InitialDirContext(env);

      System.out.println(ctx.lookup("ou=NewHires"));

      // do something useful with ctx

      // Close the context when we're done
      ctx.close();
    } catch (NamingException e) {
      e.printStackTrace();
    }
  }
}

解決法

Check if the warning actually corresponds to a real security issue related to authentication and, if that is the case, use a more secure authentication procedure.

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

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