Werk #14281: Fix local privilege escalation from site users
|Titel||Fix local privilege escalation from site users|
|Checkmk-Edition||Checkmk Raw (CRE)|
|Checkmk-Version||2.2.0i1 2.1.0p7 2.0.0p28|
|Kompatibilität||Kompatibel - benötigt kein manuelles Eingreifen|
Each Checkmk site provides it's HTTP services (UI, APIs) using it's own site Apache process. Global access to this site Apache is provided via the system Apache which is opening the 80 and 443 ports for external requests, depending on your system configuration.
To learn about the site Apache, the system Apache reads a reverse proxy configuration provided by the site user. This could be used by a site user to make the system Apache execute code as root user, since the System Apache is typically started initially with root privileges.
To close this gap, we now need to separate the system Apache configuration from the site user access.
To eliminate the privilege escalation, you will have to execute the command omd update-apache-config [SITE] once for each of your sites after the omd update command.
Besides the one-time fix, this change has a consequence for the use of omd config and omd update. There are two situations where this is relevant:
a) If you change the options APACHE_TCP_ADDR, APACHE_TCP_PORT or APACHE_MODE
You will have to call omd update-apache-config [SITE] as root user after changing one of the site configuration options APACHE_TCP_ADDR, APACHE_TCP_PORT or APACHE_MODE. This needs to be done to update and apply the system Apache configuration. If you don't do this and start your site, your UI may be not available anymore.
The omd config command will output a warning to notify you about this necessary step in the future.
b) If you execute omd update and the proxy configuration changes
The update is performed as site user. Which means that, after this werk, we can not update and apply the system apache configuration anymore automatically.
To apply the latest apache configuration, the command omd update-apache-config [SITE] needs to be executed after the update.
The omd update will automatically detect the need for this additional step and show you a confirmation dialog before starting the update to notify you about this necessary step and giving you the chance to interrupt the procedure in case you don't have the option to execute the command as root user.
All maintained versions (>=1.6) are subject to this vulnerability. It is likely that also previous versions were vulnerable. Users of previous versions are highly recommended to update or consider other mitigations.
If you want to solve this issue for a site that is using an unpatched version, you can do it by replacing the file /omd/apache/[SITE].conf with a file like follows. Please note, that you will have to replace all occurrences [SITE] with the ID of your site and [PORT] with the port of the site apache. After you replaced the file, you will have to restart the system Apache.
# version: 0 # Make sure that symlink /omd does not make problems <Directory /> Options +FollowSymlinks </Directory> <IfModule mod_proxy_http.c> ProxyRequests Off ProxyPreserveHost On <Proxy http://127.0.0.1:[PORT]/[SITE]> Order allow,deny allow from all </Proxy> <Location /[SITE]> # Setting "retry=0" to prevent 60 second caching of problem states e.g. when # the site apache is down and someone tries to access the page. # "disablereuse=On" prevents the apache from keeping the connection which leads to # wrong devlivered pages sometimes ProxyPass http://127.0.0.1:[PORT]/[SITE] retry=0 disablereuse=On timeout=120 ProxyPassReverse http://127.0.0.1:[PORT]/[SITE] </Location> </IfModule> <IfModule !mod_proxy_http.c> Alias /[SITE] /omd/sites/[SITE] <Directory /omd/sites/[SITE]> Deny from all ErrorDocument 403 "<h1>Checkmk: Incomplete Apache Installation</h1>You need mod_proxy and mod_proxy_http in order to run the web interface of Checkmk." </Directory> </IfModule> <Location /[SITE]> ErrorDocument 503 "<meta http-equiv='refresh' content='60'><h1>Checkmk: Site Not Started</h1>You need to start this site in order to access the web interface.<!-- IE shows its own short useless error message otherwise: placeholder -->" </Location>
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H 8.8 (https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H)
CVE will be added later.
We thank Jan-Philipp Litza (PLUTEX GmbH) for reporting this issue!