CVE-2026-44304
Authenticated LDAP injection in Lemur allows for privilege escalation.
- CVSS 8.1
- CWE-90
- Input Validation and Sanitization
- Remote
Lemur manages TLS certificate creation. Prior to 1.9.0, Lemur's LDAP authentication module (lemur/auth/ldap.py) constructs LDAP search filters using unsanitized user input via Python string interpolation. An authenticated LDAP user can inject LDAP filter metacharacters through the username field to manipulate group membership queries and escalate their privileges to administrator. This vulnerability is fixed in 1.9.0.
- CWE
- CWE-90
- CVSS base score
- 8.1
- Published
- 2026-05-12
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Privilege Escalation
- Affected component
- Lemur
- Fixed by upgrading
- Yes
Solution
Upgrade Lemur to version 1.9.0 or later.
Vulnerable code sample
import ldap
def get_user_roles(connection, username):
"""
Finds all the groups a user is a member of to determine roles.
This function contains a vulnerability.
"""
# Assume 'LDAP_SEARCH_BASE' and 'LDAP_ADMIN_GROUP' are fetched from config
LDAP_SEARCH_BASE = "ou=users,dc=example,dc=com"
LDAP_ADMIN_GROUP = "cn=lemur-admins,ou=groups,dc=example,dc=com"
# VULNERABLE: The username from the login form is used directly in the LDAP
# filter via string formatting. An attacker can inject valid LDAP filter
# syntax (e.g., '*)' or 'admin)(|(uid=*))') to manipulate the query's
# logic and escalate privileges.
search_filter = "(&(uid=%s)(memberOf=%s))" % (username, LDAP_ADMIN_GROUP)
try:
# The application executes the search. If the manipulated query returns any
# result, the user is incorrectly granted admin privileges.
results = connection.search_s(
LDAP_SEARCH_BASE,
ldap.SCOPE_SUBTREE,
search_filter,
['cn'] # Attributes to return
)
if results:
# If the search returns a result, the user is in the admin group.
return ['admin']
else:
return ['user']
except ldap.LDAPError:
# In case of an error or no user found
return []Patched code sample
import ldap.filter
def is_user_in_admin_group(username: str) -> str:
"""
Constructs a safe LDAP search filter to check for admin group membership.
This function demonstrates the fix for an LDAP injection vulnerability by
sanitizing the username before it is used to build the search filter.
"""
# The vulnerable method involved directly inserting the username into the
# filter string, for example:
# vulnerable_filter = f"(&(cn=lemur-admins)(memberUid={username}))"
# The fix is to properly escape any special LDAP filter metacharacters
# that might be present in the user-provided username.
escaped_username = ldap.filter.escape_filter_chars(username)
# The search filter is now safely constructed using the sanitized input.
# An attacker cannot inject filter characters like ')' or '*' to manipulate
# the query's logic.
safe_search_filter = f"(&(cn=lemur-admins)(memberUid={escaped_username}))"
# In a real application, this safe_search_filter would be used to query
# the LDAP server. We return it here for demonstration.
return safe_search_filterPayload
*
Cite this entry
@misc{vaitp:cve202644304,
title = {{Authenticated LDAP injection in Lemur allows for privilege escalation.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-44304},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-44304/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
