repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
5985-5986-pentesting-omi.mdMarkdown56 lines3.2 KiBrendered raw download
---
title: "5985, 5986 - Pentesting OMI"
section: "Network Services"
sectionSlug: "network-services-pentesting"
sourcePath: "src/network-services-pentesting/5985-5986-pentesting-omi.md"
sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/5985-5986-pentesting-omi.md"
sha: "188de82beb54e70956b2952367a0af91d26758b8"
isIndex: false
modified: true
license: "CC-BY-NC-4.0"
---

# 5985, 5986 - Pentesting OMI

## Basic Information

Microsoft's **Open Management Infrastructure (OMI)** is an open-source implementation of the Distributed Management Task Force's CIM and WS-Management standards for Unix-like systems.<sup>[[1]](#references)</sup> Some Azure management extensions install OMI on Linux virtual machines, including extensions associated with services such as:<sup>[[3]](#references)</sup>

- **Azure Automation**
- **Azure Automatic Update**
- **Azure Operations Management Suite**
- **Azure Log Analytics**
- **Azure Configuration Management**
- **Azure Diagnostics**

Depending on the extension and configuration, `omiengine` may run as root and expose an HTTPS listener. OMI can also operate through a local Unix socket, so installation alone does not prove that a network listener is reachable.<sup>[[3]](#references)</sup>

Common WS-Management ports are **5985/TCP** for HTTP and **5986/TCP** for HTTPS.<sup>[[4]](#references)</sup>

## CVE-2021-38647 (OMIGOD)

Microsoft disclosed CVE-2021-38647 in September 2021. Vulnerable OMI versions could incorrectly authorize an unauthenticated request sent to the `/wsman` endpoint when the `Authorization` header was omitted.<sup>[[2]](#references)</sup><sup>[[3]](#references)</sup>

On a network-exposed vulnerable instance, an attacker could send an `ExecuteShellCommand` SOAP request without that header and execute commands as root.<sup>[[4]](#references)</sup> The following is only the relevant body excerpt; a complete request also needs the WS-Management envelope fields described in the linked analysis and proof of concept:

```xml
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing"
   ...
   <s:Body>
      <p:ExecuteShellCommand_INPUT xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem">
         <p:command>id</p:command>
         <p:timeout>0</p:timeout>
      </p:ExecuteShellCommand_INPUT>
   </s:Body>
</s:Envelope>
```

Patch OMI and restrict WS-Management listeners to trusted management networks. Horizon3.ai's repository contains a technical proof of concept suitable for controlled validation.<sup>[[5]](#references)</sup>

## References

- [1] [Microsoft - Open Management Infrastructure](https://github.com/microsoft/omi)
- [2] [Microsoft Security Response Center - CVE-2021-38647](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-38647)
- [3] [Wiz Research - OMIGOD vulnerabilities in OMI](https://www.wiz.io/blog/omigod-critical-vulnerabilities-in-omi-azure)
- [4] [Horizon3.ai - OMIGOD RCE in Azure Linux deployments](https://www.horizon3.ai/omigod-rce-vulnerability-in-multiple-azure-linux-deployments/)
- [5] [Horizon3.ai - CVE-2021-38647 proof of concept and analysis](https://github.com/horizon3ai/CVE-2021-38647)