Skip to content
Memory corruption Write-up Advanced

Exploiting the HP Printer without the printer (Pwn2Own 2022)

A stack buffer overflow in the PostScript/CFF font parser of HP printers allows an attacker to execute arbitrary code by sending a malicious PostScript document to the raw printing port. The exploit achieves remote code execution without authentication.

InterruptLabs Follow

Published on interruptlabs.co.uk

Interrupt Labs exploited the HP Color LaserJet Pro M479fdw printer successfully in Pwn2Own Toronto 2022. This blog post describes the technical details of the vulnerability, and how we developed the exploit before we received the physical device.

Interrupt Labs (@InterruptLabs), on interruptlabs.co.uk

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The CFF Name INDEX parser calculates name lengths from offset differences without validating them, leading to a stack buffer overflow when copying the name into a fixed-size buffer.

Impact

An attacker could execute arbitrary code on the printer, potentially leading to a bind shell and full control of the device.

What the attacker needed

Network access to printer port 9100; printer supports PostScript and CFF fonts

How it was found

  1. Send a PostScript document containing a malicious CFF font to TCP port 9100 on the printer.
  2. The printer parses the CFF Name INDEX, where a crafted name length causes a stack buffer overflow.
  3. The overflow overwrites the saved instruction pointer and other registers.
  4. A stack pivot gadget redirects execution to a global buffer containing the font name.
  5. A ROP chain calls mmap to create an executable memory region and copies shellcode into it.
  6. The shellcode runs, providing a bind shell on port 4444.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

This is a memory corruption bug in a printer's font parsing code. When the printer processes a specially crafted font inside a print job, it writes more data than a buffer can hold, letting an attacker take control of the printer and run their own code.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More from HP

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.