id: vmware-detect

info:
  name: VMware Detection
  author: elouhi
  severity: info
  description: Sends a POST request containing a SOAP payload to a vCenter server to obtain version information
  reference:
    - https://www.pwndefend.com/2021/09/23/exposed-vmware-vcenter-servers-around-the-world-cve-2021-22005/
    - https://svn.nmap.org/nmap/scripts/vmware-version.nse
  metadata:
    max-request: 1
  tags: tech,vcenter,vmware,discovery

http:
  - raw:
      - |
        POST /sdk/ HTTP/1.1
        Host: {{Hostname}}

        <?xml version="1.0" encoding="UTF-8"?>
        <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
           <soap:Header>
              <operationID>00000001-00000001</operationID>
           </soap:Header>
           <soap:Body>
              <RetrieveServiceContent xmlns="urn:internalvim25">
                 <_this xsi:type="ManagedObjectReference" type="ServiceInstance">ServiceInstance</_this>
              </RetrieveServiceContent>
           </soap:Body>
        </soap:Envelope>

    matchers-condition: and
    matchers:
      - type: status
        status:
          - 200

      - type: word
        part: body
        words:
          - 'ha-folder-root'
          - 'RetrieveServiceContentResponse'
        condition: or

      - type: word
        part: header
        words:
          - "text/xml"

    extractors:
      - type: regex
        part: body
        group: 1
        regex:
          - "<name>(.*?)</name>"
          - "<version>(.*?)</version>"
          - "<build>(.*?)</build>"
          - "<osType>(.*?)</osType>"
          - "<productLineId>(.*?)</productLineId>"
          - "<apiType>(.*?)</apiType>"
# digest: 4a0a00473045022100d6b26246fbf633b401cc425c45d4609e6cacab38a69104cfc13601cf5ad028c4022061ed0e4ba449622a089167e2a0a3cf2143abdb998c60488845c0406b2f99e7d2:922c64590222798bb761d5b6d8e72950