CUPS flaws allow remote code execution on Linux systems under certain conditions


CUPS flaws allow remote code execution on Linux systems under certain conditions

Pierluigi Paganini
September 27, 2024

A researcher has disclosed details of an unpatched Linux vulnerability, initially labeled as critical, that allows remote code execution.

The popular cybersecurity researcher Simone Margaritelli (@evilsocket) disclosed technical details of an unpatched vulnerability impacting Linux systems.

On September 23, Margaritelli announced plans to disclose an unauthenticated remote code execution (RCE) vulnerability affecting all GNU/Linux systems within two weeks. The flaw was rated as critical and received a CVSS score of 9.9. Margaritelli expressed disappointment with the responsible disclosure process, explaining that despite his disclosure, no CVE had been assigned, and, to make matters worse, no one was working to address the issue.

“Devs are still arguing about whether or not some of the issues have a security impact. I’ve spent the last 3 weeks of my sabbatical working full time on this research, reporting, coordination and so on with the sole purpose of helping and pretty much only got patronized because the devs just can’t accept that their code is crap – responsible disclosure: no more.” said the expert.

Information about the Linux vulnerability was leaked on GitHub, for this reason, the Italian researcher decided to release the technical details and published a proof-of-concept (PoC) exploit on September 26, 2024.

The researcher disclosed four vulnerabilities, tracked as CVE-2024-47076, CVE-2024-47175, CVE-2024-47176 and CVE-2024-47177, impacting the CUPS (Common UNIX Printing System) open-source printing system. CUPS provides tools to manage, discover and share printers for Linux distributions.

The vulnerabilities are IPP attribute sanitization, command execution, and packet trust issues.

Below are the details provided by the researcher:

  • 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 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).” wrote the expert.

A remote, unauthenticated attacker can achieve arbitrary code execution by replacing IPP URLs with a malicious one. This allows the attacker to execute commands when a print job starts on the targeted device.

Red Hat warned that chaining these vulnerabilities could lead to remote code execution, resulting in data theft or damage to critical production systems.

“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.” reads the advisory published by Red Hat, which rated the issues with a severity impact of Important because the issues don’t impact default configurations. “Red Hat rates these issues with a severity impact of Important. While all versions of RHEL are affected, it is important to note that affected packages are not vulnerable in their default configuration.”

An attacker can exploit these vulnerabilities through a specific sequence of actions. First, the cups-browsed service must be manually enabled or started on the targeted machine. For an attack to be successful, the attacker needs access to a vulnerable server. This can happen either through unrestricted public internet access or by gaining access to an internal network where local connections are trusted.

Once the attacker obtains access to the system, they can advertise a malicious IPP server, essentially tricking the system into provisioning a malicious printer. When a victim attempts to print from this compromised device, the attacker can then execute arbitrary code on the victim’s machine, potentially leading to a full system compromise. This vulnerability chain relies on the trust placed in network printers and weak access controls.

These vulnerabilities have yet to be addressed, however, Margaritelli claims CUPS developers have admitted that the vulnerabilities cannot be easily fixed. As temporary mitigation, when printing is not needed, users can run two commands to stop a vulnerable service and prevent it from restarting when the system is rebooted.

To stop a running cups-browsed service, an administrator should use the following command:

$ sudo  systemctl stop cups-browsed

The cups-browsed service can also be prevented from starting on reboot with:

$ sudo systemctl disable cups-browsed

Blocking all traffic to UDP port 631 and DNS-SD traffic can also mitigate attacks. 

Follow me on Twitter: @securityaffairs and Facebook and Mastodon

Pierluigi Paganini

(SecurityAffairs – hacking, LINUX CUPS flaws)







Source link