[//]: # (werk v2)
# Privilege escalation in Windows agent
key | value
---------- | ---
compatible | yes
version | 2.4.0b1
date | 2024-02-26T14:44:18+00:00
level | 1
class | security
component | checks
edition | cre
In order to execute some system commands Checkmk Windows agent writes cmd files to
`C:\Windows\Temp\` and afterwards executes them.
The permissions of the files were set restrictive but existing files were not properly
handled.
If a cmd file already existed and was write protected the agent was not able to rewrite
the file but did not handle this case and executed the file nevertheless.
We thank Michael Baer (SEC Consult Vulnerability Lab) for reporting this issue.
**Affected Versions**:
* 2.2.0
* 2.1.0
* 2.0.0
**Indicators of Compromise**:
The filename of the cmd file needed to be guessed therefore the proof-of-concept creates a
lot of files in `C\Windows\Temp` with the filename `cmk_all_\d+_1.cmd`.
These file-creation events could be monitored.
**Vulnerability Management**:
We have rated the issue with a CVSS Score of 8.8 (High) with the following CVSS vector:
`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H`.
We assigned CVE-2024-0670 to this vulnerability.
**Changes**:
This Werk changes the temp folder and adds a subfolder with more restrictive permissions
in which the files are created.
Also errors are handled better.