How Tanium Can Help with the MS Azure OMI Vulnerabilities (CVE-2021-38645, CVE-2021-38647, CVE-2021-38648, CVE-2021-38649)
Overview
On September 14, 2021, Microsoft issued a security advisory regarding multiple vulnerabilities in the Open Management Infrastructure that affects Linux VMs running the OMS Agent in Azure, as well as other Linux systems that have OMI version 1.6.8-0 or prior installed.
The OMI vulnerabilities are identified by the following four CVEs:
|
Identifier |
Type |
Score (Base/Temporal) |
Fix Version |
|---|---|---|---|
|
CVE-2021-38645 |
Privilege Escalation |
7.8/6.8 |
|
|
CVE-2021-38647 |
Remote Code Execution |
9.8/ |
|
|
CVE-2021-38648 |
Privilege Escalation |
7.8/6.8 |
|
|
CVE-2021-38649 |
Use-After-Free Privilege Escalation |
7.0/6.1 |
Azure customers who leverage services like Azure Automation, Azure Automation Update, Azure Diagnostics, Azure Operations Management Suite, Log Analytics, or Azure Configuration manager will have the OMS Agent and associated OMI installed automatically. Additionally, some products available in the Azure Marketplace may include OMI/OMS elements by default. **Because this product is installed in the background, customers may be impacted and be unaware of the presence of OMI on their systems. **
In some configurations, a service is exposed on port 5986 which allows an easily crafted request to exploit the bug and execute code as root on the system. Systems that do not open the port will still be vulnerable to the privilege elevation vulnerabilities.
All OMI versions prior to 1.6.8-1 are vulnerable and should be upgraded as soon as possible.
Finding the Issue
All four vulnerabilities are present in versions of OMI prior to 1.6.8-1. You can use Tanium to quickly evaluate your environment for these versions.
Tanium Interact
You can find the vulnerability status of your environment by importing the attached Tanium sensor and running the following question:
Get CVE-2021-38647 – OMI Status and Listen Ports contains 5986 from all machines with Is Linux contains True
To use this sensor in a self-managed Tanium environment, download CVE-2021-38647-OMIStatus.json and import it on the Sensors page of the Tanium Console. To use this sensor in a Tanium-as-a-Service environment, download CVE-2021-38647-OMIStatus.sh , create a new sensor named **CVE-2021-38647 OMI Status, **and copy the contents into the Linux sensor code, choosing Shell as the language. See Tanium Core Platform User Guide - Managing sensorsNo Content found for /db/organizations/tanium/repositories/master/content/documents/userguides/platform_user/authoring_sensors.dita for more information on creating Tanium sensors.
For systems exposing this port, it is recommended that you evaluate your network security group settings to restrict access to this port. Even if a system does not include listening port 5986, it is still vulnerable to the privilege escalation vectors associated with this set of vulnerabilities.
To build a targeting version of this question for actions, you can use:
Get Online from all machines with CVE-2021-39647 – OMI Status contains Vulnerable
Version 1.6.8-1 is the patched version of omi.
Tanium Comply
Tanium Comply is the recommended way to check for this vulnerability. Tanium Comply customers can build a Comply vulnerability assessment for CVE-2021-38645, CVE-2021-38647, CVE-2021-38648, and CVE-2021-38649 once they are available in the Tanium Vulnerability Library (TVL).
Mitigating the Issue
The vulnerabilities in OMI manifest as both a remote code execution as well as multiple privilege escalation vulnerabilities. To reduce your attack surface prior to a patch, it is strongly advised that you evaluate your Azure Network Security groups and on-premises systems for any systems listening on port 5986 (the WinRMport).
The following question can evaluate for those ports:
Get Computer Name and Listen Ports contains 5986 from all machines with Is Linux contains true
Review your associated Azure Network Security Groups for permissions around systems exposing this port.
Remediating the Issue
Tanium Interact
Install the OMSAgent for Linux with updated OMI version In the early morning hours of September 16, 2021, the Microsoft OMSAgent for Linux was updated to include the required 1.6.8-1 omi version. Microsoft has indicated that the patching of OMI happens automatically via the Azure service, however, customers can manually update this by following the instructions below. Customers using System Center with OMI, outside of Azure, will need to manually update.
Microsoft publishes the OMS agent releases and associated onboarding scripts and reinstallation instructions. You can use this information to create a package to update the agent on your system. Upgrading OMI outside of the OMS Agent package may create issues with dependencies required for Azure functionality.
You will need your workspace ID and primary key from your Log Analytics Workspace > Agent Management > Linux Servers dashboard.
Upgrade the OMS Agent for Linux Installer & OMI Once the OMS Agent installer is updated, you can create a package using the following settings:
-
Package Name: Upgrade OMSAgent for Linux
-
Content Set: Default
-
Command:
/bin/sh ./omsagent-1.13.40-0.universal.x64.sh --upgrade
-
Command Timeout: 5 Minutes
-
Download Timeout: 10 Minutes
-
Files: Specify a remote file based on the OMS Agent Releases link above which contains the necessary SHA256 and download URL. Alternatively, download the omsagent-1.13.40-0.universal.x64.sh and provide it as a local file at package creation. See the following examples:
-
Using the Remote File Location in a Package:
-
-
Including a local file in a Package:
-
Verification Query: CVE-2021-38647 - OMI Status:Version contains 1.6.8.1
The Log analytics workspace may show duplicate entries for each system replaced, as its default views are for 24 hours.
References