// HackTricks · Network Services

9100/tcp - PJL (Printer Job Language)

9100/tcp - PJL (Printer Job Language)

Basic Information

From here: Raw printing is what we define as the process of making a connection to port 9100/tcp of a network printer. It is the default method used by CUPS and the Windows printing architecture to communicate with network printers as it is considered as ‘the simplest, fastest, and generally the most reliable network protocol used for printers’. Raw port 9100 printing, also referred to as JetDirect, AppSocket or PDL-datastream actually is not a printing protocol by itself. Instead all data sent is directly processed by the printing device, just like a parallel connection over TCP. In contrast to LPD, IPP and SMB, this can send direct feedback to the client, including status and error messages. Such a bidirectional channel gives us direct access to results of PJL, PostScript or PCL commands. Therefore raw port 9100 printing – which is supported by almost any network printer – is used as the channel for security analysis with PRET and PFT.[1]

For broader printer-assessment background, see the Hacking Printers wiki.[6]

Default port: 9100

9100/tcp open  jetdirect

Enumeration

Manual

nc -vn <IP> 9100
@PJL INFO STATUS      #CODE=40000   DISPLAY="Sleep"   ONLINE=TRUE
@PJL INFO ID          # ID (Brand an version): Brother HL-L2360D series:84U-F75:Ver.b.26
@PJL INFO PRODINFO    #Product info
@PJL FSDIRLIST NAME="0:\" ENTRY=1 COUNT=65535  #List dir
@PJL INFO VARIABLES   # Environment variables
@PJL INFO FILESYS     #?
@PJL INFO TIMEOUT     #Timeout variables
@PJL RDYMSG           #Ready message
@PJL FSINIT             # Potentially destructive filesystem initialization; do not issue during enumeration
@PJL FSDIRLIST
@PJL FSUPLOAD         # Read/upload a printer filesystem object to the client
@PJL FSDOWNLOAD       # Send/download client data into the printer filesystem
@PJL FSDELETE         #Useful to delete a file

PJL filesystem commands are vendor- and model-dependent. FSDELETE, FSDOWNLOAD, and especially FSINIT can alter or destroy printer data, so begin with read-only INFO/FSDIRLIST requests and use write operations only with explicit authorization.[4]

Automatic

nmap -sV --script pjl-ready-message -p <PORT> <IP>
msf> use auxiliary/scanner/printer/printer_env_vars
msf> use auxiliary/scanner/printer/printer_list_dir
msf> use auxiliary/scanner/printer/printer_list_volumes
msf> use auxiliary/scanner/printer/printer_ready_message
msf> use auxiliary/scanner/printer/printer_version_info
msf> use auxiliary/scanner/printer/printer_download_file
msf> use auxiliary/scanner/printer/printer_upload_file
msf> use auxiliary/scanner/printer/printer_delete_file

Printers Hacking tool

PRET automates PostScript, PJL, and PCL printer-security testing, including filesystem operations where supported.[5]

XPS/TrueType VM exploitation (Canon ImageCLASS)

  • Deliver XPS over PJL:[2]

    • @PJL ENTER LANGUAGE = XPS
    • Then send the XPS ZIP bytes on the same TCP connection.
  • Minimal XPS page referencing an attacker font:

<Glyphs Fill="#ff000000" FontUri="/Resources/evil.ttf" FontRenderingEmSize="12" OriginX="10" OriginY="10"/>
  • RCE primitive summary (TrueType hinting VM):[2][3]

    • Hinting bytecode in TTF is executed by a TrueType VM. Canon’s VM lacked stack bounds checks.
    • CINDEX: OOB stack read → info leak
    • DELTAP1: unchecked relative stack pivot → controlled writes with subsequent pushes
    • Combine WS/RS (VM storage write/read) to stage values and perform a precise 32-bit write after pivot.
  • Exploit outline:

    1. Create XPS with the page above and include /Resources/evil.ttf.
    2. In fpgm/prep, use CINDEX to leak and compute stack_cur.
    3. Stage target value with WS; pivot with DELTAP1 to the destination; use RS to write it (e.g., to a function pointer) to gain PC control.
  • Send over 9100/tcp:

{ printf "@PJL ENTER LANGUAGE = XPS\r\n"; cat exploit.xps; } | nc -q0 <PRINTER_IP> 9100
  • exploit.xps is a valid XPS ZIP containing Documents/1/Pages/1.fpage and /Resources/evil.ttf.

Shodan

  • pjl port:9100

References