where the permissions grant the rights to query, modify or remove
anything inside the LDAP tree.
The same advanced exploitation techniques available in SQL
Injection can also be similarly applied in LDAP Injection.
Example
Vulnerable code with comments:
line 0: 
line 1: 
line 2: <%@ Language=VBScript %>
line 3: <%
line 4:  Dim userName
line 5:  Dim filter
line 6:  Dim ldapObj
line 7:
line 8:  Const LDAP_SERVER = "ldap.example"
line 9:
line 10: 
userName = Request.QueryString("user")
line 11:
line 12: 
if( userName = "" ) then
line 13: 
Response.Write("Invalid
request. Please specify a
valid user name
")
line 14: 
Response.End()
line 15: 
end if
line 16:
line 17:
line 18: 
filter = "(uid=" + CStr(userName) +
")"
  searching
for the user entry
line 19:
line 20:
line 21: 
 Creating the LDAP object and setting
the base dn
31
Copyright 2004, Web Application Security Consortium. All rights reserved.




Unlimited Web Hosting




 
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.