9100 - Pentesting Raw Printing (JetDirect, AppSocket, PDL-datastream)

👉 Overview


👀 What ?

9100 - Pentesting Raw Printing (JetDirect, AppSocket, PDL-datastream) involves the process of probing and exploring a printing protocol, typically found in network printers, for potential security vulnerabilities. It targets JetDirect, AppSocket, and PDL-datastream, which are all protocols utilized by printers to receive print jobs.

🧐 Why ?

The importance of this process lies in the fact that network printers can often be overlooked in terms of security, making them potential weak points in a network's defenses. If a malicious actor were able to exploit these vulnerabilities, they could potentially use the printer as an entry point into the network, gaining access to sensitive information or disrupting operations.

⛏️ How ?

To conduct a pentest on raw printing, one needs to first identify a printer on the network that utilizes one of the targeted protocols. This can be done through network scanning tools. Once a target is identified, various tools and techniques can be employed to attempt to exploit any vulnerabilities present, such as sending malformed print jobs or attempting to gain unauthorized access to the printer's settings.

⏳ When ?

Pentesting raw printing has become increasingly important as network printers have become more prevalent in both business and home environments. As such, it's been practiced since the early 2000s, with an increased focus in recent years due to the rise in cyber attacks targeting IoT devices.

⚙️ Technical Explanations


In the field of network security, raw printing protocols such as JetDirect, AppSocket, and PDL-datastream play significant roles. These protocols guide how a printer receives and processes a print job sent over a network. JetDirect, also known as Port 9100 Printing, is a technology developed by Hewlett-Packard. It operates by opening a network connection and sending a print job directly to a specific network printer's IP address on port 9100, hence its name.

AppSocket, on the contrary, is a protocol-agnostic, cross-platform printing protocol. It functions by establishing a direct IP-to-IP connection between the client and the printer. This means it can be used across different types of network printers, regardless of the underlying network architecture, making it a versatile tool for network printing.

PDL-datastream refers to the raw data sent to the printer, which is commonly in the Page Description Language (PDL). This language describes the layout and contents of the printed page in a higher level than actual printer commands; it includes commands for such features as font selection, graphics, and layout.

The importance of understanding and securing these printing protocols is paramount as vulnerabilities within them could be exploited by cyber attackers. For instance, if an attacker identifies a weakness in the protocol, they could send malformed print jobs that trigger unexpected behavior from the printer. This could result in disruptions to print operations or even cause the printer to crash.

More alarmingly, if an attacker gains unauthorized access to the printer's settings, they could manipulate the printer to act as a gateway for launching cyber attacks on other devices within the network. This could potentially lead to a full-blown network breach, with the attacker having access to sensitive data and resources.

Therefore, penetration testing (pentesting) of raw printing is an essential practice in network security. It involves a systematic process of identifying network printers that use these protocols, exploring possible vulnerabilities, and attempting to exploit them to assess the network's security posture. This proactive approach helps organizations to identify and fix security loopholes before they can be exploited by malicious actors.

Consider this scenario where we are going to pentest a printer in a network using JetDirect protocol. We will use the Nmap tool for network scanning and identification of the printer and then use PRET (Printer Exploitation Toolkit) to exploit potential vulnerabilities.

  1. Network Scanning: First, we need to identify the printer on the network. We can use Nmap, a popular network scanning tool, for this. The command below scans the network for devices on port 9100, typically used by JetDirect.
nmap -p 9100 192.168.1.0/24

This command will return a list of devices on the network with port 9100 open, which are likely to be printers using the JetDirect protocol.

  1. Printer Exploitation: Once we have identified our target printer, we can use PRET, a tool specifically designed for printer security testing. PRET connects to the printer and attempts to exploit known vulnerabilities in the printing protocols. In this case, we're using the PostScript language (ps) for our tests.
./pret.py printer_ip ps

This command will attempt to connect to the printer at printer_ip using the PostScript language. If successful, it will open an interactive shell, allowing us to send commands directly to the printer.

  1. Sending Malformed Print Jobs: Once connected, we can test the printer's handling of malformed print jobs. For instance, we can send an oversized job to the printer to see how it reacts.
print /path/to/large/file

If the printer crashes or behaves unexpectedly, this could indicate a potential vulnerability.

  1. Accessing Printer Settings: We can attempt to access the printer's settings with the 'get' command, which retrieves a specified configuration value.
get device.info

If we're able to retrieve sensitive information without adequate authorization, this could indicate a security issue.

Remember, the goal here is not to cause actual harm but to identify potential vulnerabilities that need to be addressed. Always ensure you have permission to conduct these tests.

We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.