本仓库包含一个免费扫描器,用于检测易受Wiz威胁研究团队发现的"OMIGOD"漏洞之一(特别是CVE-2021-38647)影响的VM。
来自Wiz的原始博客文章:https://www.wiz.io/blog/omigod-critical-vulnerabilities-in-omi-azure
扫描器需要Azure凭据连接到Azure API,给定订阅和资源组(默认情况下会扫描所有可用的),检索Linux VM列表并报告机器是否可能易受攻击。
同时请务必查看微软为此目的提供的自有工具:https://github.com/microsoft/OMS-Agent-for-Linux/tree/master/tools/OMIcheck
为了对Azure API进行身份验证,支持azure cli(默认)和交互式浏览器身份验证,请查看--auth命令行参数。
没有一种直接的方法可以在不运行Linux机器本身命令的情况下确定您的机器是否易受OMI影响,而这可以通过Azure API使用扩展中的RunShellScript命令来支持。微软的自有工具(https://github.com/microsoft/OMS-Agent-for-Linux/tree/master/tools/OMIcheck)也采用了这种方法。
值得注意的是,即使VM易受攻击,它也可能没有通过HTTP/HTTPS(默认方式)暴露OMI服务器,即使暴露了,这些端口也可能被Azure网络安全组阻止,因此无法访问。这并不能成为避免修补的理由,但如果您有很多易受攻击的Linux VM,了解哪些VM更暴露并优先处理可能会很有用。
omigood采用这种更全面的方法,并将生成一个JSON输出,其中包含多个检查,您可以通过命令行选项触发这些检查以确定您的攻击面。
以下是omigood执行的检查:
1.13.40版本。您可以查看我们运行的脚本此处。-e命令行选项启用。-r命令行选项启用。风险自负!/usr/bin/id命令。此检查为可选,因为它涉及尝试利用VM。使用-a命令行选项启用。仅用于您被授权测试的目标。风险自负!生成的JSON输出文件包含所有扫描到的VM的信息:ID、操作系统、网络安全组、电源状态等。
与检查相关的标志('YES'/'NO')如下:
YES。1.13.40,则为YES。YES。YES。仅在-e命令行选项下有效。1.6.8-1,则为YES。仅在-r命令行选项下有效。YES。仅在-r命令行选项下有效。YES。仅在-r命令行选项下有效。usage: omigood_scanner.py [-h] [-v] [--auth {azurecli,interactivebrowser}] [-r] [-a] [-e] [-s SUBSCRIPTIONS]
[-g RESOURCEGROUPS] [-m VMS] -o OUTPUT
OMIGood scanner for CVE-2021-38647
optional arguments:
-h, --help show this help message and exit
-v, --verbose [OPTIONAL] Verbose mode: Displays additional debug details.
--auth {azurecli,interactivebrowser}
Authentication mode. Default: azurecli.
-r, --runscript [OPTIONAL] Run Script. Runs bash script on target VMs to check for OMI server, agent and
version. Disabled by default. Use at your own risk.
-a, --attack [OPTIONAL] Try to attack the host. Disabled by default. Use at your own risk.
-e, --effective [OPTIONAL] Check Effective Security Rules. Disabled by default. Requires higher permissions on
Azure.
-s SUBSCRIPTIONS, --subscriptions SUBSCRIPTIONS
[OPTIONAL] Comma separate list of subscriptions IDs. If not specified, it will try all.
-g RESOURCEGROUPS, --resourcegroups RESOURCEGROUPS
[OPTIONAL] Comma separated list of Resource Group names. If not specified, it will try all. If
specified, it will work only with a single subscription provided.
-m VMS, --vms VMS [OPTIONAL] Comma separated list of VM names. If not specified, it will try all. If specified,
it will work only with a single subscription and a single resource group provided.
-o OUTPUT, --output OUTPUT
JSON output file with results.
本仓库中提供的软件和代码示例按“原样”提供,不提供任何形式的明示或暗示的保证。使用风险自负。