ZeroHour
The Hacker Newspublished ()ingested @TheHackersNews

Critical Linux CUPS Printing System Flaws Could Allow Remote Command Execution

Vulnerabilities mentionedAll →

CVEVulnerabilityCVSSEPSSFlagsAffectedExposurePublished
CVE-2024-47076
Unsanitized IPP attribute injection in OpenPrinting libcupsfilters (CWE-20)

OpenPrinting's libcupsfilters, the library providing CUPS filter functionality for printer data-format conversion, fails to sanitize IPP attributes returned from IPP servers in its cfGetPrinterAttributes5 function (CWE-20, CVSS 8.6). The flaw is triggered when a system running CUPS contacts an attacker-controlled or untrusted IPP server and uses the returned attributes, for example to generate a PPD file, allowing attacker-controlled data to flow into the rest of the CUPS system. On its own this yields high-integrity attacker data injection (per the CVSS vector, no direct confidentiality or availability loss), but it is one of several CUPS flaws disclosed together in late September 2024 that, when chained under certain conditions, can result in remote code execution on Linux and Unix systems. Any system running libcupsfilters is affected; CUPS and its filter libraries ship by default with most major Linux distributions, and public internet scans around disclosure found roughly 75,000 hosts exposing the IPP service (TCP 631) directly to the internet. Proof-of-concept details are public (an EvilSocket writeup and the OpenPrinting GitHub advisory GHSA-w63j-6g73-wmg5), the flaw is not yet in CISA KEV, and EPSS assigns a 77.6% probability of exploitation within 30 days, though no confirmed in-the-wild exploitation appears in the provided data.

Do: Upgrade libcupsfilters to the patched release identified in the OpenPrinting advisory GHSA-w63j-6g73-wmg5 (fixed in libcupsfilters 2.1.0), applying your distribution's updated cups-filters/CUPS packages; also install the companion CUPS component fixes released the same week, since this flaw is typically chained with other CUPS bugs (notably in cups-browsed) for remote code execution. Until patched, restrict or disable exposure of the IPP service (TCP 631) to untrusted networks and avoid creating or refreshing printer queues from untrusted or mDNS-advertised IPP servers.

8.678% PoC ×2
  • OpenPrinting libcupsfilters Affected version range not enumerated in the source data; see vendor advisory GHSA-w63j-6g73-wmg5 for affected/fixed ranges (patched in libcupsfilters 2.1.0 per
masstens of millions of Linux/Unix systems ship the vulnerable library; ~75,000 hosts expose IPP (TCP 631) directly to the internet per public scans
CVE-2024-47175
Unsanitized IPP input in OpenPrinting libppd enables RCE chain on Linux CUPS

CVE-2024-47175 is an improper input validation flaw (CWE-20) in OpenPrinting's libppd: the ppdCreatePPDFromIPP2 function fails to sanitize IPP attributes when writing them into a generated PPD buffer. When this unsanitized, attacker-controlled input flows through the CUPS print pipeline — for example via the cups-browsed entry point abused in CVE-2024-47176, in combination with functions such as cfGetPrinterAttributes5 — it can ultimately be executed by Foomatic print filters, giving remote code execution. Affected systems are Linux/Unix hosts running the CUPS printing stack with vulnerable libppd components, which includes widely used distributions such as Debian and, per press coverage, most other major Linux distros. Exploitation status: public proofs of concept and researcher write-ups exist, the flaw carries a high EPSS score (63.6% probability of exploitation within 30 days, 99th percentile) and warnings about abuse including DDoS, but it is not yet in CISA's KEV catalog, so no confirmed widespread in-the-wild exploitation is documented in the available data.

Do: Install your distribution's security updates — upgrade libppd to the patched release (2.1b1 or later, per the OpenPrinting advisory GHSA-7xfx-47qg-grp6) and apply the matching cups/cups-filters fixes. As interim mitigation, disable or stop cups-browsed if not needed and block or restrict inbound UDP 631 (and IPP/port 631 generally) from untrusted networks, particularly on internet-facing hosts. Check whether CUPS is running and reachable on your systems and whether configured printers rely on Foomatic filters, which the RCE chain requires.

9.864% PoC ×2
  • OpenPrinting libppd
  • Debian Linux
largetens of thousands of internet-exposed CUPS hosts (roughly 75,000 per public internet-wide scans at disclosure), on top of a far larger install base of Linux…
CVE-2024-47176
Unauthenticated RCE chain in OpenPrinting cups-browsed (CVE-2024-47176)

CVE-2024-47176 is a flaw in cups-browsed, the network printer auto-discovery component of the OpenPrinting CUPS printing stack shipped with most major Linux and Unix distributions, which binds to UDP port 631 on all interfaces (INADDR_ANY) and therefore accepts and trusts unauthenticated packets from any source. A remote attacker can send a crafted browse/IPP packet that makes cups-browsed issue a Get-Printer-Attributes IPP request to an attacker-controlled URL. On its own this flaw is rated Medium (5.3), but chained with companion flaws in libcupsfilters (CVE-2024-47076), libppd (CVE-2024-47175), and cups-filters (CVE-2024-47177) it enables unauthenticated arbitrary command execution when a user prints to the attacker's malicious printer; the exposure has also been noted as abusable for DDoS amplification. Any Linux/Unix system running cups-browsed with UDP/631 reachable from an untrusted network is affected. No confirmed widespread in-the-wild exploitation has been reported and the flaw is not yet in CISA's KEV, but public proofs of concept exist and EPSS assigns a ~51% probability of exploitation within 30 days (99th percentile).

Do: Update cups-browsed and the companion cups-filters/libcupsfilters/libppd packages to the patched releases published by OpenPrinting and your distribution alongside the September 2024 advisories (see GHSA-rj88-6mr5-rcw8). If patched packages are not yet available, stop or disable the cups-browsed service, or firewall inbound UDP port 631 from untrusted networks and ensure it binds only to localhost where network printer discovery is not needed. Audit whether cups-browsed is running and whether UDP/631 is reachable from the internet, and treat any network-reachable CUPS host as a candidate for the full RCE chain.

5.351% PoC ×2
  • OpenPrinting cups-browsed
massmillions of Linux/Unix installations (cups-browsed ships in the default print stack of major distributions), of which only on the order of tens of thousands of…
CVE-2024-47177
Rejected reason: ** REJECT ** DO NOT USE THIS CANDIDATE NUMBER.

Rejected reason: ** REJECT ** DO NOT USE THIS CANDIDATE NUMBER. ConsultIDs: CVE-2024-47076, CVE-2024-47175, CVE-2024-47176. Reason: This candidate is a duplicate of CVE-2024-47076, CVE-2024-47175, and CVE-2024-47176. Notes: All CVE users should reference CVE-2024-47076, CVE-2024-47175, and/or CVE-2024-47176 instead of this candidate. This CVE was issued to a vulnerability that is dependent on CVE-2024-47076, CVE-2024-47175, and CVE-2024-47176. According to rule 4.2.15 of the CVE CNA rules, \"CNAs MUST NOT assign a different CVE ID to a Vulnerability that is fully interdependent with another Vulnerability. The Vulnerabilities are effectively the same single Vulnerability and MUST use one CVE ID.

NVD description · AI analysis pending
Full article1,045 words · extracted from thehackernews.com · click to collapse

A new set of security vulnerabilities has been disclosed in the OpenPrinting Common Unix Printing System (CUPS) on Linux systems that could permit remote command execution under certain conditions.

"A remote unauthenticated attacker can silently replace existing printers' (or install new ones) IPP urls with a malicious one, resulting in arbitrary command execution (on the computer) when a print job is started (from that computer)," security researcher Simone Margaritelli said.

CUPS is a standards-based, open-source printing system for Linux and other Unix-like operating systems, including ArchLinux, Debian, Fedora, Red Hat Enterprise Linux (RHEL), ChromeOS, FreeBSD, NetBSD, OpenBSD, openSUSE, and SUSE Linux.

The list of vulnerabilities is as follows -

  • CVE-2024-47176 - cups-browsed <= 2.0.1 binds on UDP INADDR_ANY:631 trusting any packet from any source to trigger a Get-Printer-Attributes IPP request to an attacker-controlled URL
  • CVE-2024-47076 - libcupsfilters <= 2.1b1 cfGetPrinterAttributes5 does not validate or sanitize the IPP attributes returned from an IPP server, providing attacker-controlled data to the rest of the CUPS system
  • CVE-2024-47175 - libppd <= 2.1b1 ppdCreatePPDFromIPP2 does not validate or sanitize the IPP attributes when writing them to a temporary PPD file, allowing the injection of attacker-controlled data in the resulting PPD
  • CVE-2024-47177 - cups-filters <= 2.0.1 foomatic-rip allows arbitrary command execution via the FoomaticRIPCommandLine PPD parameter

A net consequence of these shortcomings is that they could be fashioned into an exploit chain that allows an attacker to create a malicious, fake printing device on a network-exposed Linux system running CUPS and trigger remote code execution upon sending a print job.

"The issue arises due to improper handling of 'New Printer Available' announcements in the 'cups-browsed' component, combined with poor validation by 'cups' of the information provided by a malicious printing resource," network security company Ontinue said.

"The vulnerability stems from inadequate validation of network data, allowing attackers to get the vulnerable system to install a malicious printer driver, and then send a print job to that driver triggering execution of the malicious code. The malicious code is executed with the privileges of the lp user – not the superuser 'root.'"

RHEL, in an advisory, said all versions of the operating system are affected by the four flaws, but noted that they are not vulnerable in their default configuration. It tagged the issues as Important in severity, given that the real-world impact is likely to be low.

"By chaining this group of vulnerabilities together, an attacker could potentially achieve remote code execution which could then lead to theft of sensitive data and/or damage to critical production systems," it said.

Cybersecurity firm Rapid7 pointed out that affected systems are exploitable, either from the public internet or across network segments, only if UDP port 631 is accessible and the vulnerable service is listening.

Palo Alto Networks has disclosed that none of its products and cloud services contain the aforementioned CUPS-related software packages, and therefore are not impacted by the flaws.

Patches for the vulnerabilities are currently being developed and are expected to be released in the coming days. Until then, it's advisable to disable and remove the cups-browsed service if it's not necessary, and block or restrict traffic to UDP port 631.

"It looks like the embargoed Linux unauth RCE vulnerabilities that have been touted as doomsday for Linux systems, may only affect a subset of systems," Benjamin Harris, CEO of WatchTowr, said in a statement shared with The Hacker News.

"Given this, while the vulnerabilities in terms of technical impact are serious, it is significantly less likely that desktop machines/workstations running CUPS are exposed to the Internet in the same manner or numbers that typical server editions of Linux would be."

Satnam Narang, senior staff research engineer at Tenable, said these vulnerabilities are not at a level of a Log4Shell or Heartbleed.

"The reality is that across a variety of software, be it open or closed source, there are a countless number of vulnerabilities that have yet to be discovered and disclosed," Narang said. "Security research is vital to this process and we can and should demand better of software vendors."

"For organizations that are honing in on these latest vulnerabilities, it's important to highlight that the flaws that are most impactful and concerning are the known vulnerabilities that continue to be exploited by advanced persistent threat groups with ties to nation states, as well as ransomware affiliates that are pilfering corporations for millions of dollars each year."

Nearly 75,000 Machines Expose CUPS

Akamai, in its own insights into the CUPS flaws, said an attack leveraging these flaws isn't "particularly complex," but emphasized that it requires multiple steps for successful exploitation.

It also said it found about 75,000 machines worldwide that expose CUPS to the internet, with the web infrastructure company finding the service running on several platforms, including Ubuntu, macOS, CentOS, Debian, Fedora, OpenShift, Oracle Linux Server, Red Hat, Rocky Linux, SUSE, openSUSE, AlmaLinux, Amazon Linux, and others.

The top five regions with the most exposed instances are South Korea (21,974), the United States (11,413), Hong Kong (4,772), Germany (4,723), and China (4,570).

"Approximately 5.4% of Linux machines are exposed to the internet and receive incoming traffic from external sources," Akamai noted.

"When inspecting network policies that affect this traffic, we saw that 19.3% of those machines allow incoming internet traffic by default — meaning that no specific network policies are in place to restrict or control the flow of incoming traffic."

CUPS Vulnerability Scanner Released

Security researcher Marcus Hutchins, who goes by the online alias MalwareTech, has released an automated scanner on GitHub to scan local networks for devices vulnerable to CVE-2024-47176.

"The vulnerability arises from the fact that cups-browsed binds its control port (UDP port 631) to INADDR_ANY, exposing it to the world," Hutchins said. "Since requests are not authenticated, anyone capable of reaching the control port can instruct cups-browsed to perform printer discovery."

"In cases when the port is not reachable from the internet (due to firewalls or NAT), it may still be reachable via the local network, enabling privilege escalation and lateral movement."

(The story was updated after publication on October 9, 2024, to include details about the CVE-2024-47176 vulnerability scanner.)

Found this article interesting? Follow us on Google News, Twitter and LinkedIn to read more exclusive content we post.

Text extracted automatically; images, tables and formatting may be missing. Original: https://thehackernews.com/2024/09/critical-linux-cups-printing-system.html