Skip to content

LDAP injection in auth_ldap_user

Moderate
arikfr published GHSA-32fw-wc7f-7qg9 May 18, 2024

Package

No package listed

Affected versions

>3

Patched versions

None

Description

Starting from v3, Redash supports LDAP/AD authentication. The email from the user input is used to format a LDAP filter query string [1] that allows unauthenticated attacker to alter the filter query.

Impact

The LDAP authentication is disabled by default and has to be enabled by the Redash instance administrator.

Another limiting factor is that the default value of settings.LDAP_SEARCH_TEMPLATE is (cn=%(username)s) and the ldap3 library, currently used by Redash, is quite strict about the number of parenthesis and also allows only one root query object. I.e. usual LDAP injection payloads that result in a query filter with non-matching parenthesis or multiple root query objects won't be accepted.

Nevertheless the settings.LDAP_SEARCH_TEMPLATE is configurable by Redash administrators and Redash provides instructions on how to customize it for integration with a specific LDAP provider. In case the setting is set to a LDAP filter that starts with logical AND & or logical OR | operator from the list of popular LDAP filters, for example (&(objectClass=inetOrgPerson)(userPassword=*)(cn=%(username)s)) to narrow only to users with passwords, the injection allows to create a valid filter query that will pass ldap3 checks.

As a result it is possible to use it for a variation of password spray attack - brute-force all users' passwords with a single request.

Patches

Considering that LDAP was always an optional feature of Redash and none of the current maintainers is using it, we will make a best effort fix but can't guarantee it's working. The next release will include this fix.

Workarounds

Patch ldap_auth.py to filter user input in the username field or change the LDAP_SEARCH_TEMPLATE to a simpler one.

Severity

Moderate
5.3
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
None
Availability
None
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N

CVE ID

CVE-2020-36144

Weaknesses

No CWEs

Credits