CUPS vulnerability (CVE-2024-47176): is your Linux server affected?

Yesterday evening a CUPS vulnerability was made public – more precisely, a chain of four bugs affecting the printing subsystem of Linux and other Unix-like systems. By chaining the four bugs, an unauthenticated remote attacker can run commands on the machine if the cups-browsed service is running and the attacker’s UDP packet reaches port 631. Code execution also requires someone to print to the printer the attacker has slipped in.

At first the news talked about a critical bug “affecting every Linux system”, but the reality is narrower: on servers, cups-browsed usually isn’t even installed. Still, it’s worth spending a few minutes checking your machines now. Here is a summary of what is known as of Friday morning.

What happened?

The bugs were found by security researcher Simone Margaritelli, who made them public on 26 September at 20:00 UTC (22:00 Hungarian time), after some of the details had already leaked. The four bugs are in packages of the OpenPrinting project:

CVE Component Bug
CVE-2024-47176 cups-browsed (≤ 2.0.1) Listens on UDP port 631 on every network interface, and accepts packets from any source
CVE-2024-47076 libcupsfilters (≤ 2.1b1) Doesn’t validate the attributes returned by the printer (IPP server)
CVE-2024-47175 libppd (≤ 2.1b1) Writes the attributes into the temporary PPD file without validation
CVE-2024-47177 cups-filters (≤ 2.0.1) The foomatic-rip filter runs an arbitrary command from the PPD FoomaticRIPCommandLine parameter

According to the researcher’s write-up, the attack goes like this:

  1. The attacker sends a single UDP packet to port 631, containing the address of their own server.
  2. cups-browsed takes this as the announcement of a new network printer, and queries the details of the attacker’s “printer”.
  3. From the manipulated attributes it receives, the system creates a PPD file that also contains the attacker’s command. The new printer appears in the system, or it overwrites the address of an existing printer.
  4. When someone prints to this printer, foomatic-rip runs the command with the rights of the lp user.

On a local network, not even a UDP packet is needed: the attacker can achieve the same with an mDNS/DNS-SD announcement (zeroconf).

Opinions differ on the severity. According to Margaritelli, the first CVSS estimate of 9.9 came from a Red Hat engineer during the coordination process, but he himself considers it exaggerated. The Red Hat bulletin rates it “Important”, and points out that the code runs as the low-privileged lp user, and that exploitation requires the user to print. At the same time, the researcher writes that he scanned the internet for weeks, and several hundred thousand devices responded to his packet, as many as 200,000–300,000 at a time.

Who is affected by the CUPS vulnerability?

The key question is whether cups-browsed is running on the machine:

  • Desktops and laptops: the desktop editions of several distributions install and start it by default. These are the most affected, especially on public Wi-Fi.
  • Print servers: where CUPS is used for network printing, cups-browsed is often running too.
  • Servers: a basic Debian, Ubuntu Server or RHEL installation usually doesn’t have it. The exception can be when someone has installed a desktop environment on the server (for remote desktop, for example), or when the virtual machine was built from a desktop image.

According to the Red Hat bulletin, the service is disabled by default on RHEL, but if it is enabled, the default configuration is vulnerable.

How to check

First, check whether the service is running and whether anything is listening on UDP port 631:

systemctl status cups-browsed
ss -ulnp | grep 631

The installed packages on Debian and Ubuntu, and on the RHEL family:

dpkg -l cups-browsed cups-filters
rpm -q cups-filters

If cups-browsed is running, look at the /etc/cups/cups-browsed.conf file: according to Red Hat, the machine is vulnerable if the BrowseRemoteProtocols line contains the value cups. If the line is commented out, the built-in default applies, which also enables it.

If you have many machines to check, an Ansible ad-hoc command is faster than logging in to each one:

ansible all -b -m shell -a "systemctl is-active cups-browsed; ss -ulnp | grep 631"

What to do

On a server where you don’t need network printer discovery (that is, almost everywhere), stop and disable the service, or remove the package:

sudo systemctl disable --now cups-browsed
sudo apt purge cups-browsed      # Debian, Ubuntu

According to Red Hat, stopping cups-browsed doesn’t affect the use of printers that are already configured.

On a desktop where you need printer discovery, install the update as soon as it is released. Until then, set the line BrowseRemoteProtocols none in /etc/cups/cups-browsed.conf, and restart the service.

At the network edge, block inbound UDP 631 on the perimeter firewall and in your cloud security groups. The CUPS web interface and IPP port (TCP 631) don’t belong on the internet either.

Where the distributions stand on Friday morning

Distribution Status
Ubuntu On 26 September, at the same time as the announcement, released fixed packages for every supported LTS release (USN-7041-1 – USN-7045-1). The updated cups-browsed disables the old CUPS discovery protocol.
Red Hat Enterprise Linux 7, 8, 9 A bulletin and a workaround are available (stopping the service or BrowseRemoteProtocols none); follow the Red Hat bulletin for the fixed cups-filters packages.
Debian 12 At the time of writing, no security advisory (DSA) had been published yet; removing cups-browsed solves the problem in the meantime.

On Ubuntu, automatic security updates (unattended-upgrades) are enabled by default, so the fix will be installed on its own within a day; after that, Canonical also recommends restarting CUPS. On 24.04, needrestart usually does this, as we wrote in our article on Ubuntu 24.04.

No fix will come for CentOS 7, which went out of support on 30 June. If you still run a machine like that and cups-browsed is running on it, stopping the service is the only solution.

The lesson

The CUPS bug is not as serious as the xz case: there, the backdoor was reachable through the SSH server, while here we are talking about a service that rarely runs on servers. The lesson is still similar: anything that listens on the network is attack surface. A server should only run what it needs for its job, and you should regularly check what is listening on the ports (ss -tulnp). A virtual machine “recycled” from a desktop installation is quite likely running services that nobody knows about.

If you need help checking your servers or regularly reviewing unnecessary services, get in touch; you can read about our operations services on the Infrastructure and operations page.

Let’s talk about your project

Tell us briefly how we can help, and we will get back to you as soon as we can.

Get in touch