id: ms-exchange-local-domain

info:
  name: Microsoft Exchange Autodiscover - Local Domain Exposure
  author: userdehghani
  severity: info
  description: |
    Microsoft Exchange is prone to a local domain exposure using the Autodiscover v2 endpoint.
  impact: |
    An attacker can leverage this information for reconnaissance and targeted attacks.
  remediation: |
    Restrict access to the Autodiscover service or configure it to not expose local domain information.
  reference:
    - https://support.microsoft.com/en-gb/topic/autodiscover-v2-returns-internalurl-not-externalurls-in-other-site-774301e2-2d1e-d5e0-aa41-a49f6e9b06f4
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
    cwe-id: CWE-200
    cpe: cpe:2.3:a:microsoft:exchange_server:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 1
    shodan-query: http.title:outlook exchange
    product: exchange_server
    vendor: microsoft
  tags: misconfig,microsoft,ms-exchange,ad,dc

http:
  - method: GET
    path:
      - "{{BaseURL}}/autodiscover/autodiscover.json?Protocol=ActiveSync&Email=user@domain.tld&RedirectCount=1"

    matchers-condition: and
    matchers:
      - type: regex
        part: header
        regex:
          - "(?i)(X-Calculatedbetarget:)"

      - type: status
        status:
          - 200
          - 302

    extractors:
      - type: kval
        kval:
          - x_calculatedbetarget
# digest: 4b0a0048304602210091f43149842e3b6bfce0dba853acf1487b11d60bf751dee3d1a28459eac6defe022100a5fa435c22e336d5229f3a6370b8f21745cc8ac0c71983be964095d845c696c0:922c64590222798bb761d5b6d8e72950