TRANSACTIONS ON DEPENDABLE AND SECURE COMPUTING 1
LDAP Injection Techniques
Jose Mar´a Alonso, Rodolfo Bord´on, Marta Beltr´an and Antonio Guzm´an
AbstractThe increase in the number of databases accessed only by
some applications has made code injection attacks an important threat
to almost any current system. If one of these applications accepts inputs
from a client and executes these inputs without rst validating them,
the attackers are free to execute their own queries and therefore, to
extract, modify or delete the content of the database associated to the
application. Several works have analyzed SQL injection attacks and their
consequences. However, there is very little work in other code injection
techniques attacking other languages or protocols. In this paper a deep
analysis of the LDAP injection techniques is presented. Furthermore, a
clear distinction between classic and blind injection techniques is made.
Finally, a real LDAP environment has been implemented to evaluate
the security of applications based on LDAP and to exemplify the most
common vulnerabilities and their possible consequences.
Index TermsWeb applications security, code injection techniques,
LDAP.
I. INTRODUCTION
The amount of data stored in organizational databases has increased
very fast in last years due to the rapid advancement of information
technologies. And a lot of these data is sensitive, private and critical
to the organizations, their clients and partners.
Therefore, the databases are usually installed behind internal
rewalls, protected with intrusion detection mechanisms and accessed
only by some application programs. To access a database, users have
to connect to one of these applications and to submit queries trough
them to the database. Then, the threat to databases arises when these
application programs do not behave properly and send these queries
without validating user inputs rst.
In fact, over a 50% web applications vulnerabilities are input
validation vulnerabilities ([1]) which allow the exploitation of code
injection techniques.
These attacks have proliferated in recent years causing severe
damages in several systems and applications. The SQL injection
techniques are the most widely used and studied ([2], [3], [4], [5])
but there are other injection techniques associated to other languages
or protocols such as XPath ([6], [7]) or LDAP ([8], [9]).
The only hope in preventing the consequences of this kind of
attacks lies in studying the different code injection possibilities and
in making them public and well known for all the programmers and
administrators ([10], [11], [12]).
In this paper the LDAP injection techniques are analyzed in
depth, because all the web applications based on LDAP trees can
be vulnerable to this kind of attacks. The key to exploit injection
techniques with LDAP is to concatenate attack lters to the lters
used to search in the directory services.
Using these techniques, an attacker may obtain direct access to
the hierarchical database underlying an LDAP tree, and therefore to
important information of the corporative network. And this can be
even more critical because the security of many applications and
services are based on LDAP directories in current single sign-on
Jose Mar´a Alonso and Rodolfo Bord´on are with Informatica64,
c/Juan Ramon Jimenez 8, 28933 M´ostoles, Madrid, Spain. Email:
[email protected],
[email protected]
Marta Beltr´an and Antonio Guzm´an are with the Computing
Department, Universidad Rey Juan Carlos, Edicio Departamental
II, Campus de M´ostoles, 28933 M´ostoles, Madrid, Spain. E-mail:
[email protected],
[email protected]
environments ([13], [14]). Although the vulnerabilities that lead to
these consequences are easy to understand and to solve, they persist
due to the lack of information about these attacks and their effects.
The main contributions of this paper are a rst study of the LDAP
vulnerabilities and a deep analysis of the injection techniques which
can be used to exploit these vulnerabilities. Furthermore, a real
environment has been implemented to perform different experiments
in typical LDAP scenarios and to evaluate the possible danger of this
kind of attacks.
It is important to note that the use of lters to limit the information
that is showed to a client sending an LDAP search to the server
does not increase the security of the applications, because these
lters does not prevent the use of blind code injection techniques,
capable of exploiting injection techniques without having detailed
error messages from the server. Therefore, both, the classic and the
blind code injection techniques will be studied in depth in this paper.
This paper is organized as follows. Section 2 gives an LDAP
protocol overview necessary to understand the concepts used in the
rest of the paper. Section 3 presents the typical LDAP environment
where the LDAP injection attacks reported in Section 4 usually take
place. Section 5 summarizes the most important results obtained using
these injection techniques to exploit the reported vulnerabilities in
the typical environments. Based on these results, solutions for the
LDAP injection vulnerabilities are proposed in Section 6. And, nally,
Section 7 presents conclusions and future work.
II. LDAP OVERVIEW
Directories are hierarchical databases designed to store and to
organize information sharing certain common attributes:
²The information structure: a tree of directory entries.
²Powerful browsing and search capabilities
Therefore, a directory is a database specialized in searches instead
in updates and in processing specic queries instead in results listing.
Furthermore, a directory tolerates temporal inconsistencies between
its copies.
A directory service is a software application implemented to access
the directories information. It usually allows data replication and
distribution and acts as an abstraction layer between users and shared
resources.
The Lightweight Directory Access Protocol is a protocol for
querying and modifying directory services running over TCP/IP ([15],
[16]). It allows quick and efcient searches and updates of this kind
of services. The most widely used implementation of this protocol are
ADAM (Active Directory Application Mode, [17]) and OpenLDAP
([18]).
LDAP is object-oriented, therefore, every entry in a LDAP tree is
an instance of an object and must correspond to the rules xed for
the attributes of that object.
LDAP is also based on the client/server model, therefore, clients
send operation requests to the server and the server responses with
the directory information. The most frequent operation request is to
search for directory entries, and to response these requests the server
has to test if an entry of the LDAP tree contains a given attribute
value. This test is performed using the LDAP lters dened in the
RFC 4515.