|
2 | 2 |
|
3 | 3 | {{#include ../../banners/hacktricks-training.md}}
|
4 | 4 |
|
5 |
| -There are several blogs in the Internet which **highlight the dangers of leaving printers configured with LDAP with default/weak** logon credentials.\ |
6 |
| -This is because an attacker could **trick the printer to authenticate against a rouge LDAP server** (typically a `nc -vv -l -p 444` is enough) and to capture the printer **credentials on clear-text**. |
| 5 | +There are several blogs in the Internet which **highlight the dangers of leaving printers configured with LDAP with default/weak** logon credentials. \ |
| 6 | +This is because an attacker could **trick the printer to authenticate against a rogue LDAP server** (typically a `nc -vv -l -p 389` or `slapd -d 2` is enough) and capture the printer **credentials in clear-text**. |
7 | 7 |
|
8 |
| -Also, several printers will contains **logs with usernames** or could even be able to **download all usernames** from the Domain Controller. |
| 8 | +Also, several printers will contain **logs with usernames** or could even be able to **download all usernames** from the Domain Controller. |
9 | 9 |
|
10 | 10 | All this **sensitive information** and the common **lack of security** makes printers very interesting for attackers.
|
11 | 11 |
|
12 |
| -Some blogs about the topic: |
| 12 | +Some introductory blogs about the topic: |
13 | 13 |
|
14 | 14 | - [https://www.ceos3c.com/hacking/obtaining-___domain-credentials-printer-netcat/](https://www.ceos3c.com/hacking/obtaining-___domain-credentials-printer-netcat/)
|
15 | 15 | - [https://medium.com/@nickvangilder/exploiting-multifunction-printers-during-a-penetration-test-engagement-28d3840d8856](https://medium.com/@nickvangilder/exploiting-multifunction-printers-during-a-penetration-test-engagement-28d3840d8856)
|
16 | 16 |
|
| 17 | +--- |
17 | 18 | ## Printer Configuration
|
18 | 19 |
|
19 |
| -- **Location**: The LDAP server list is found at: `Network > LDAP Setting > Setting Up LDAP`. |
20 |
| -- **Behavior**: The interface allows LDAP server modifications without re-entering credentials, aiming for user convenience but posing security risks. |
21 |
| -- **Exploit**: The exploit involves redirecting the LDAP server address to a controlled machine and leveraging the "Test Connection" feature to capture credentials. |
| 20 | +- **Location**: The LDAP server list is usually found in the web interface (e.g. *Network ➜ LDAP Setting ➜ Setting Up LDAP*). |
| 21 | +- **Behavior**: Many embedded web servers allow LDAP server modifications **without re-entering credentials** (usability feature → security risk). |
| 22 | +- **Exploit**: Redirect the LDAP server address to an attacker-controlled host and use the *Test Connection* / *Address Book Sync* button to force the printer to bind to you. |
22 | 23 |
|
| 24 | +--- |
23 | 25 | ## Capturing Credentials
|
24 | 26 |
|
25 |
| -**For more detailed steps, refer to the original [source](https://grimhacker.com/2018/03/09/just-a-printer/).** |
| 27 | +### Method 1 – Netcat Listener |
26 | 28 |
|
27 |
| -### Method 1: Netcat Listener |
| 29 | +```bash |
| 30 | +sudo nc -k -v -l -p 389 # LDAPS → 636 (or 3269) |
| 31 | +``` |
| 32 | + |
| 33 | +Small/old MFPs may send a simple *simple-bind* in clear-text that netcat can capture. Modern devices usually perform an anonymous query first and then attempt the bind, so results vary. |
28 | 34 |
|
29 |
| -A simple netcat listener might suffice: |
| 35 | +### Method 2 – Full Rogue LDAP server (recommended) |
| 36 | + |
| 37 | +Because many devices will issue an anonymous search *before* authenticating, standing up a real LDAP daemon yields much more reliable results: |
30 | 38 |
|
31 | 39 | ```bash
|
32 |
| -sudo nc -k -v -l -p 386 |
| 40 | +# Debian/Ubuntu example |
| 41 | +sudo apt install slapd ldap-utils |
| 42 | +sudo dpkg-reconfigure slapd # set any base-DN – it will not be validated |
| 43 | + |
| 44 | +# run slapd in foreground / debug 2 |
| 45 | +slapd -d 2 -h "ldap:///" # only LDAP, no LDAPS |
33 | 46 | ```
|
34 | 47 |
|
35 |
| -However, this method's success varies. |
| 48 | +When the printer performs its lookup you will see the clear-text credentials in the debug output. |
| 49 | + |
| 50 | +> 💡 You can also use `impacket/examples/ldapd.py` (Python rogue LDAP) or `Responder -w -r -f` to harvest NTLMv2 hashes over LDAP/SMB. |
36 | 51 |
|
37 |
| -### Method 2: Full LDAP Server with Slapd |
| 52 | +--- |
| 53 | +## Recent Pass-Back Vulnerabilities (2024-2025) |
38 | 54 |
|
39 |
| -A more reliable approach involves setting up a full LDAP server because the printer performs a null bind followed by a query before attempting credential binding. |
| 55 | +Pass-back is *not* a theoretical issue – vendors keep publishing advisories in 2024/2025 that exactly describe this attack class. |
40 | 56 |
|
41 |
| -1. **LDAP Server Setup**: The guide follows steps from [this source](https://www.server-world.info/en/note?os=Fedora_26&p=openldap). |
42 |
| -2. **Key Steps**: |
43 |
| - - Install OpenLDAP. |
44 |
| - - Configure admin password. |
45 |
| - - Import basic schemas. |
46 |
| - - Set ___domain name on LDAP DB. |
47 |
| - - Configure LDAP TLS. |
48 |
| -3. **LDAP Service Execution**: Once set up, the LDAP service can be run using: |
| 57 | +### Xerox VersaLink – CVE-2024-12510 & CVE-2024-12511 |
| 58 | + |
| 59 | +Firmware ≤ 57.69.91 of Xerox VersaLink C70xx MFPs allowed an authenticated admin (or anyone when default creds remain) to: |
| 60 | + |
| 61 | +* **CVE-2024-12510 – LDAP pass-back**: change the LDAP server address and trigger a lookup, causing the device to leak the configured Windows credentials to the attacker-controlled host. |
| 62 | +* **CVE-2024-12511 – SMB/FTP pass-back**: identical issue via *scan-to-folder* destinations, leaking NetNTLMv2 or FTP clear-text creds. |
| 63 | + |
| 64 | +A simple listener such as: |
49 | 65 |
|
50 | 66 | ```bash
|
51 |
| -slapd -d 2 |
| 67 | +sudo nc -k -v -l -p 389 # capture LDAP bind |
52 | 68 | ```
|
53 | 69 |
|
54 |
| -## References |
| 70 | +or a rogue SMB server (`impacket-smbserver`) is enough to harvest the credentials. |
55 | 71 |
|
56 |
| -- [https://grimhacker.com/2018/03/09/just-a-printer/](https://grimhacker.com/2018/03/09/just-a-printer/) |
| 72 | +### Canon imageRUNNER / imageCLASS – Advisory 20 May 2025 |
57 | 73 |
|
58 |
| -{{#include ../../banners/hacktricks-training.md}} |
| 74 | +Canon confirmed a **SMTP/LDAP pass-back** weakness in dozens of Laser & MFP product lines. An attacker with admin access can modify the server configuration and retrieve the stored credentials for LDAP **or** SMTP (many orgs use a privileged account to allow scan-to-mail). |
| 75 | + |
| 76 | +The vendor guidance explicitly recommends: |
| 77 | + |
| 78 | +1. Updating to patched firmware as soon as available. |
| 79 | +2. Using strong, unique admin passwords. |
| 80 | +3. Avoiding privileged AD accounts for printer integration. |
| 81 | + |
| 82 | +--- |
| 83 | +## Automated Enumeration / Exploitation Tools |
| 84 | + |
| 85 | +| Tool | Purpose | Example | |
| 86 | +|------|---------|---------| |
| 87 | +| **PRET** (Printer Exploitation Toolkit) | PostScript/PJL/PCL abuse, file-system access, default-creds check, *SNMP discovery* | `python pret.py 192.168.1.50 pjl` | |
| 88 | +| **Praeda** | Harvest configuration (including address books & LDAP creds) via HTTP/HTTPS | `perl praeda.pl -t 192.168.1.50` | |
| 89 | +| **Responder / ntlmrelayx** | Capture & relay NetNTLM hashes from SMB/FTP pass-back | `responder -I eth0 -wrf` | |
| 90 | +| **impacket-ldapd.py** | Lightweight rogue LDAP service to receive clear-text binds | `python ldapd.py -debug` | |
59 | 91 |
|
| 92 | +--- |
| 93 | +## Hardening & Detection |
60 | 94 |
|
| 95 | +1. **Patch / firmware-update** MFPs promptly (check vendor PSIRT bulletins). |
| 96 | +2. **Least-Privilege Service Accounts** – never use Domain Admin for LDAP/SMB/SMTP; restrict to *read-only* OU scopes. |
| 97 | +3. **Restrict Management Access** – place printer web/IPP/SNMP interfaces in a management VLAN or behind an ACL/VPN. |
| 98 | +4. **Disable Unused Protocols** – FTP, Telnet, raw-9100, older SSL ciphers. |
| 99 | +5. **Enable Audit Logging** – some devices can syslog LDAP/SMTP failures; correlate unexpected binds. |
| 100 | +6. **Monitor for Clear-Text LDAP binds** on unusual sources (printers should normally talk only to DCs). |
| 101 | +7. **SNMPv3 or disable SNMP** – community `public` often leaks device & LDAP config. |
61 | 102 |
|
| 103 | +--- |
| 104 | +## References |
| 105 | + |
| 106 | +- [https://grimhacker.com/2018/03/09/just-a-printer/](https://grimhacker.com/2018/03/09/just-a-printer/) |
| 107 | +- Rapid7. “Xerox VersaLink C7025 MFP Pass-Back Attack Vulnerabilities.” February 2025. |
| 108 | +- Canon PSIRT. “Vulnerability Mitigation Against SMTP/LDAP Passback for Laser Printers and Small Office Multifunction Printers.” May 2025. |
| 109 | + |
| 110 | +{{#include ../../banners/hacktricks-training.md}} |
0 commit comments