I have been running a simple ldap_bind() php script to verify the username/password combination of Active Directory users before presenting a simple menu to them. Unfortunately, as I’ve discovered, anyone can get the menu by entering a valid Active Directory group name and ANY string of characters for the password. In my case, my security auditor vendor guessed the username of “admin” and the password of “password”, which gave them the splash screen.
Previously working, yet faulty code.
I’ve tried using a different syntax for the second/username parameter using “UID=USERNAME,DC=DOMAIN,DC=LOCAL”. But that does not seem to ever work properly. I can only get the authentication to work with “USERNAME@DOMAIN.LOCAL” syntax.
The following code does a secondary check to ensure that the bind was indeed successful.