Skip to content
RCE Write-up Advanced

Attacking UNIX Systems via CUPS, Part I

cups-browsed listens on UDP port 631 and trusts any packet, allowing an attacker to make it connect to a malicious IPP server. The attacker can then inject PPD directives that lead to arbitrary command execution when a print job is sent.

evilsocket.net

Published on evilsocket.net

Hello friends, this is the first of two, possibly three (if and when I have time to finish the Windows research) writeups. We will start with targeting GNU/Linux systems with an RCE.

The author, on evilsocket.net

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

Likely the combination of cups-browsed trusting unauthenticated UDP packets, libcupsfilters and libppd not sanitising IPP attributes before writing them into a PPD file, and foomatic-rip executing commands from the FoomaticRIPCommandLine PPD directive.

Impact

A remote unauthenticated attacker could execute arbitrary commands on the victim's computer when a print job is started, but the attacker must wait for a print job to be sent to the fake printer.

What the attacker needed

Cups-browsed listening on UDP port 631; attacker can send UDP packets to the target; victim sends a print job to the fake printer

The fix

The report recommends disabling and removing cups-browsed, updating CUPS, and blocking UDP port 631; the text does not state that the vulnerabilities were fixed.

How it was found

  1. Send a UDP packet to port 631 on the target containing a URL pointing to an attacker-controlled IPP server.
  2. The target's cups-browsed connects to that URL and sends a Get-Printer-Attributes request.
  3. The attacker's IPP server responds with crafted attributes that inject PPD directives, including a command to execute.
  4. The fake printer is added to the system without user notification.
  5. When a print job is sent to the fake printer, the injected PPD directives cause the command to run.

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.

CUPS is the printing system on Linux and other Unix-like systems. A background service called cups-browsed automatically discovers printers on the network. The report shows that anyone who can send a special network packet to that service can trick it into connecting to a fake printer controlled by the attacker, and later run commands on the victim's computer when a print job is sent.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.