[CVE-2021-29156] LDAP Injection at https://██████
The target runs a version of ForgeRock OpenAM affected by CVE-2021-29156, which allows LDAP injection through the Webfinger protocol. An unauthenticated attacker could use it to retrieve password hashes character by character, or obtain a session token or private key.
Originally disclosed on HackerOne
- Triaged in 28 hours
- Fixed in 29 days
- Disclosed after 30 days
Description: https://█████ is vulnerable to CVE-2021-29156
References
- https://hackerone.com/reports/1278050
- https://nvd.nist.gov/vuln/detail/CVE-2021-29156
- https://portswigger.net/research/hidden-oauth-attack-vectors
- https://github.com/projectdiscovery/nuclei-templates/blob/74db4223c11d27a934ca1c417aa4abca9e70ad35/cves/2021/CVE-2021-29156.yaml
Impact
ForgeRock OpenAM before 13.5.1 allows LDAP injection via the Webfinger protocol. For example, an unauthenticated attacker can perform character-by-character retrieval of password hashes, or retrieve a session token or a private key.
System Host(s)
███████
Affected Product(s) and Version(s)
CVE Numbers
CVE-2021-29156
Steps to Reproduce
The references mentioned shall be helpful for successful reproduction, especially the one I reported the earlier day (#1278050) and the PortSwigger one.
-
Username starting with ██████████ exists: https://█████████/███/███████[200 OK]
-
Username starting with ███████ doesn't exist: https://██████████/██████████/█████████████[404 Not Found]
For 200 OK response, it also throws out OpenAM instance address: ███
Similar thing can be done for password enumeration as well. You can find the scripts I wrote for username and password enumeration in my earlier report at a different host.
Suggested Mitigation/Remediation Actions
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the Webfinger endpoint passes user-supplied input into an LDAP query without proper escaping, allowing injection.
Impact
An unauthenticated attacker could retrieve password hashes character by character, or obtain a session token or private key.
What the attacker needed
Unauthenticated access to the Webfinger endpoint
The fix
Versions before 13.5.1 are affected; upgrading to 13.5.1 or later would address it.
How it was found
- Request the Webfinger endpoint with a username that exists and observe a 200 OK response.
- Request the same endpoint with a username that does not exist and observe a 404 Not Found response.
- Use the difference in responses to enumerate valid usernames, and similarly enumerate passwords.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
LDAP is a directory service, like a phone book for user accounts. LDAP injection means sneaking extra instructions into a lookup so the server returns information it should not. Here the login-related Webfinger endpoint could be tricked into revealing whether a username exists and, in the worst case, secrets such as password hashes.
What is OAuth / SSO?
Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.