“NginxDay2022”: NGINX LDAP reference implementation Zero Day Vulnerability
The nginx-ldap-auth reference implementation allows HTTP request headers to override command-line configuration, enabling an attacker to redirect authentication to a malicious LDAP server and capture credentials, or to modify the LDAP query template to bypass group restrictions. This can lead to authentication bypass and information disclosure.
grimhacker.com
Published on grimhacker.com
A recent zero-day vulnerability has been publicly shared revealing a critical issue with the nginx-ldap-auth software package allowing attackers to potentially bypass authentication and disclose key information on vulnerable servers. NGINX have now published a blog post responding to this vulnerability…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The daemon trusts HTTP request headers to override command-line configuration for sensitive LDAP settings without validation.
Impact
An attacker could bypass authentication, capture administrator credentials, and potentially achieve account takeover and information disclosure.
What the attacker needed
Nginx-ldap-auth daemon configured via command line; attacker controls HTTP request headers; malicious LDAP server for first attack
How it was found
- Send an HTTP request with the X-Ldap-URL header pointing to a malicious LDAP server.
- The request is proxied to the nginx-ldap-auth daemon.
- The daemon connects to the malicious LDAP server.
- The daemon binds using the administrator-configured credentials.
- The daemon performs an LDAP search for the username using the configured template.
- The daemon binds using the user's DN and password, and returns a 200 response, granting access.
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 write-up has not been written yet. The Original tab links to the source.
The nginx-ldap-auth tool is a sample program that helps NGINX check usernames and passwords against an LDAP directory. It was built so that certain settings, like which LDAP server to talk to, can be changed by whoever sends a request. An attacker can use that to make the tool talk to a fake server they control, steal the real server's password, or change the search query to skip group checks.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.