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.
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 theLDAP_SEARCH_TEMPLATE
to a simpler one.