CUPS flaws enable Linux remote code execution, but there’s a catch

Share:

Under certain conditions, attackers can chain a set of vulnerabilities in multiple components of the CUPS open-source printing system to execute arbitrary code remotely on vulnerable machines.

Tracked as CVE-2024-47076 (libcupsfilters), CVE-2024-47175 (libppd), CVE-2024-47176 (cups-browsed) and CVE-2024-47177 (cups-filters) and discovered by Simone Margaritelli, these security flaws don’t affect systems in their default configuration.

CUPS (short for Common UNIX Printing System) is the most widely used printing system on Linux systems, and it is also generally supported on devices running Unix-like operating systems such as FreeBSD, NetBSD, and OpenBSD and their derivates.

One of its components is the cups-browsed daemon, which searches the local network for advertised network or shared printers and makes them available for printing on the machine. This is similar to how Windows and Macs can search the network for remote network printers to print to.

Margaritelli found that if the cups-browsed daemon is enabled, which is not on most systems, it will listen on UDP port 631. It will also, by default, allow remote connections from any device on the network to create a new printer.

He discovered he could create a malicious PostScript Printer Description (PPD) printer that could be manually advertised to an exposed cups-browsed service running on UDP port 631.

This causes the remote machine to automatically install the malicious printer and make it available for printing. If the user on that exposed server prints to the new printer, the malicious command in the PPD will be executed locally on the computer.

The command to execute when printing is added through a foomatic-rip filter, which executes commands on a device so that a print job is rendered correctly.

Commands added using the foomatic-rip filter
Commands added using the foomatic-rip filter (Simone Margaritelli)

Limited world impact

While this is a remote code execution chain, it should be noted from the start that attackers must overcome some obstacles to exploit the vulnerabilities and actually achieve remote code execution.

The first is that the targeted systems must have the cups-browsed daemon enabled, which is usually not enabled by default, to expose their UDP ports on a network. Then, the attacker has to trick a user into printing from a malicious printer server on their local network that suddenly appears on their machine.

“It is a chain of bugs that rely on spoofing a printer in your local network that is automatically added via network discovery if it is turned on at all – usually not in its default configuration. Then an unverified variable that is used to exploit other vulnerabilities in the CUPS system to execute code, but only when a print job is triggered,” said Ilkka Turunen, Field CTO at Sonatype.

“Good news then – it’s an RCE but with several mitigations, including the fact the attacker needs to be able to connect to a computer via UDP which is widely disabled on network ingress and the service is usually not on by default. It seems like the real world impact is low.”

For these reasons, Red Hat has rated the flaws as having an “Important” severity impact instead of critical.

While BleepingComputer’s tests showed that most of our Linux servers did not have the service enabled by default, one of our Ubuntu VMs did. Others have also noted on Twitter that cups-browsed was enabled by default on their Linux devices.

No patches, but mitigation measures are available

While patches are still in development, Red Hat shared mitigation measures requiring admins to stop the cups-browsed service from running and prevent it from being started on reboot using the following commands to break the exploit chain:

Red Hat users can also use the following command to find out if cups-browsed is running on their systems:

sudo systemctl status cups-browsed

If the result displays “Active: inactive (dead),” then the exploit chain is halted, and the system is not vulnerable. If the result shows “running” or “enabled,” and the “BrowseRemoteProtocols” directive contains the value “cups” in the configuration file /etc/cups/cups-browsed.conf, then the system is vulnerable.

Sergiu Gatlan

Leave a Comment

Your email address will not be published. Required fields are marked *

loader-image
London, GB
3:10 am, Jan 26, 2025
weather icon 2°C
L: -0° | H: 3°
scattered clouds
Humidity: 80 %
Pressure: 1007 mb
Wind: 3 mph WSW
Wind Gust: 9 mph
UV Index: 0
Precipitation: 0 mm
Clouds: 30%
Rain Chance: 0%
Visibility: 10 km
Sunrise: 7:47 am
Sunset: 4:38 pm
DailyHourly
Daily ForecastHourly Forecast
Today 9:00 pm
weather icon
-0° | 3°°C 1 mm 100% 19 mph 93 % 1006 mb 0 mm/h
Tomorrow 9:00 pm
weather icon
6° | 8°°C 1 mm 100% 22 mph 90 % 984 mb 0 mm/h
Tue Jan 28 9:00 pm
weather icon
7° | 9°°C 1 mm 100% 21 mph 86 % 996 mb 0 mm/h
Wed Jan 29 9:00 pm
weather icon
5° | 7°°C 1 mm 100% 15 mph 93 % 1001 mb 0 mm/h
Thu Jan 30 9:00 pm
weather icon
3° | 6°°C 0.93 mm 93% 10 mph 95 % 1023 mb 0 mm/h
Today 6:00 am
weather icon
2° | 4°°C 0 mm 0% 9 mph 81 % 1006 mb 0 mm/h
Today 9:00 am
weather icon
4° | 5°°C 0 mm 0% 14 mph 77 % 1003 mb 0 mm/h
Today 12:00 pm
weather icon
6° | 6°°C 0 mm 0% 17 mph 81 % 997 mb 0 mm/h
Today 3:00 pm
weather icon
5° | 5°°C 1 mm 100% 19 mph 93 % 990 mb 0 mm/h
Today 6:00 pm
weather icon
8° | 8°°C 1 mm 100% 14 mph 84 % 988 mb 0 mm/h
Today 9:00 pm
weather icon
9° | 9°°C 0 mm 0% 16 mph 79 % 986 mb 0 mm/h
Tomorrow 12:00 am
weather icon
8° | 8°°C 1 mm 100% 20 mph 90 % 979 mb 0 mm/h
Tomorrow 3:00 am
weather icon
7° | 7°°C 1 mm 100% 14 mph 77 % 982 mb 0 mm/h
Name Price24H (%)
Bitcoin(BTC)
€99,743.84
0.20%
Ethereum(ETH)
€3,170.69
1.06%
XRP(XRP)
€2.97
0.16%
Tether(USDT)
€0.95
-0.01%
Solana(SOL)
€243.50
2.23%
Dogecoin(DOGE)
€0.336884
1.13%
USDC(USDC)
€0.95
-0.01%
Shiba Inu(SHIB)
€0.000019
0.07%
Pepe(PEPE)
€0.000014
-0.40%
Peanut the Squirrel(PNUT)
€0.341643
3.03%
Scroll to Top