WAGO — 2 vulnerability checks

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

← All products · Feeds on GitHub

WAGO I/O System 758 Series Default Telnet Credentials

CVECVE-2012-4879
Severitycritical · CVSS 10.0
Categorydefault-credentials — Default credentials
Servicestelnet
Detectionscript, set_var, tcp_open, sleep, tcp_send, tcp_close, match · highest QoD 97
Feedtests/vulnerabilities/wago/CVE-2012-4879.yaml

WAGO I/O System 758 industrial PCs (758-870, 758-874, 758-875, 758-876) ship their Linux console with default accounts reachable over Telnet (CVE-2012-4879). The check requires the WagoIPC login greeting, then logs in with root/wago, admin/wago, root/admin, admin/admin, user/user, user/user00 and guest/guest. A login is confirmed when the shell computes the sum of two random numbers sent in an `echo` command, and only when a random password for the same user is refused. For a non-root account it also tries `su` with the hard-coded super-user password and reports it when `id -u` then returns 0.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Opens a persistent TCP/TLS socket
  3. Sends … on the open socket
  4. Parses / computes the next value with a Rhai script
  5. Sends {{acct.user}} on the open socket
  6. Sends … on the open socket
  7. Parses / computes the next value with a Rhai script
  8. Sends {{acct.pass}} on the open socket
  9. Sends echo NOCTIS$(({{proof.a}}+{{proof.b}}))U$(id -u)Z on the open socket
  10. Sends … on the open socket
  11. Parses / computes the next value with a Rhai script
  12. Sends … on the open socket
  13. Parses / computes the next value with a Rhai script
  14. Parses / computes the next value with a Rhai script
  15. … and 23 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/wago/CVE-2012-4879.yaml
# WAGO I/O System 758 series industrial PCs (758-870, 758-874, 758-875,
# 758-876) — default / hard-coded accounts on the Linux console reachable over
# Telnet (CVE-2012-4879, a different bug than the web accounts of
# CVE-2012-3013, see wago/CVE-2012-3013.yaml).
#
# Ported from OpenVAS/Greenbone NVT 2012/gb_wago_758_870_52940_telnet.nasl
# (OID 1.3.6.1.4.1.25623.1.0.104502, GPL-2.0-only): for each pair
# root:admin, admin:admin, user:user, user:user00, guest:guest, require
# "WagoIPC1 login" in the greeting, send the user, require "Password", send the
# password, report on a "-sh" shell prompt; then try `su` with the hard-coded
# super-user password "ko2003wa" and add it to the report when the reply holds
# "this is the super user account".
#
# Deviations from the NASL (stronger detection, documented in the PR):
#   * Credential list: the NVD record of CVE-2012-4879 gives root:wago and
#     admin:wago (plus user:user, guest:guest); the NASL never tries them.
#     Both are tried first, then the NASL's pairs.
#   * Two levels of proof. QoD 97: the logged-in shell evaluated
#     `echo NOCTIS$((a+b))` (two random integers) and printed the sum, which is
#     never in what we send. QoD 75: only the "-sh" prompt came back (the
#     NASL's evidence).
#   * The `su` step is proven the same way: after `su` + "ko2003wa", the shell
#     must print `NOCTISU0Z` for `echo NOCTISU$(id -u)Z` (uid 0), instead of a
#     banner text.
#   * `su` is only tried when the same echo showed a non-zero uid
#     (`echo NOCTIS$((a+b))U$(id -u)Z`), so an account that is already uid 0
#     (admin) cannot be credited with the super-user password.
#   * Accept-any-password guard: after a successful login, a second login with
#     the same user and a random password is made; when it also reaches the
#     shell (honeypot, broken login), the feed reports nothing. Fail-closed:
#     QoD 97 needs login(1) to actually reject it ("Login incorrect" or a new
#     "login:" prompt); when the control gives no clear answer, the shell proof
#     is reported at QoD 75 instead.
#   * Product gate relaxed to "WagoIPC" + "login:" (any WagoIPC<n> host name),
#     and a greeting that misses the first read is still tested.
#
# Nothing is changed on the device: only `echo` and `id -u` run. At most one
# wrong-password login (the control) is made, and only after a default login
# already worked. category: default-credentials so operators can exclude
# credential logins.
uid: f682ddfd-3cd9-4055-87c2-2af96d2a63cf
name: "WAGO I/O System 758 Series Default Telnet Credentials"
description: |
  WAGO I/O System 758 industrial PCs (758-870, 758-874, 758-875, 758-876) ship
  their Linux console with default accounts reachable over Telnet
  (CVE-2012-4879). The check requires the WagoIPC login greeting, then logs in
  with root/wago, admin/wago, root/admin, admin/admin, user/user, user/user00
  and guest/guest. A login is confirmed when the shell computes the sum of two
  random numbers sent in an `echo` command, and only when a random password for
  the same user is refused. For a non-root account it also tries `su` with the
  hard-coded super-user password and reports it when `id -u` then returns 0.
cves: [CVE-2012-4879]
cvss: 10.0
severity: critical
category: default-credentials
confidence_base: 0.30
tags: [wago, wago-758, ipc, ics, scada, telnet, default-credentials, hardcoded-credentials, intrusive]
services: [telnet]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-4879"
  - "https://www.cisa.gov/news-events/ics-alerts/ics-alert-12-097-01"
  - "https://www.securityfocus.com/bid/52940"

steps:
  # Random control password and the shell arithmetic proof.
  - id: gen-proof
    action: script
    store_as: proof
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      #{ a: "" + a, b: "" + b, marker: "NOCTIS" + (a + b), ctl_pw: "noctis" + rand_str(14) }

  # ------------------------------------------- one iteration per account
  # The whole group below runs once per pair; a finding (stop: true) ends it.
  - id: init-gate
    action: set_var
    loop:
      over:
        - {user: "root", pass: "wago"}
        - {user: "admin", pass: "wago"}
        - {user: "root", pass: "admin"}
        - {user: "admin", pass: "admin"}
        - {user: "user", pass: "user"}
        - {user: "user", pass: "user00"}
        - {user: "guest", pass: "guest"}
      var: acct
    var_name: gate
    var_value: false

  - id: init-shell
    action: set_var
    var_name: shell
    var_value: false

  - id: init-proof-ok
    action: set_var
    var_name: proof_ok
    var_value: false

  - id: init-ctl-ok
    action: set_var
    var_name: ctl_ok
    var_value: false

  - id: init-su-ok
    action: set_var
    var_name: su_ok
    var_value: false

  - id: init-su-note
    action: set_var
    var_name: su_note
    var_value: ""

  - id: init-late
    action: set_var
    var_name: late
    var_value: {response: ""}

  - id: init-out
    action: set_var
    var_name: tn_out
    var_value: ""

  - id: init-su-out
    action: set_var
    var_name: su_out
    var_value: ""

  - id: init-user-late
    action: set_var
    var_name: r_user_late
    var_value: {response: ""}

  - id: init-tail-late
    action: set_var
    var_name: r_tail_late
    var_value: {response: ""}

  - id: init-uid-zero
    action: set_var
    var_name: uid_zero
    var_value: false

  - id: init-ctl-rej
    action: set_var
    var_name: ctl_rej
    var_value: false

  - id: init-su
    action: set_var
    var_name: s_su
    var_value: {sent: false, response: ""}

  - id: init-su-pass
    action: set_var
    var_name: s_pass
    var_value: {sent: false, response: ""}

  - id: init-su-id
    action: set_var
    var_name: s_id
    var_value: {response: ""}

  - id: init-su-tail
    action: set_var
    var_name: s_tail
    var_value: {response: ""}

  - id: init-ctl-late
    action: set_var
    var_name: c_late
    var_value: {response: ""}

  - id: init-ctl-out
    action: set_var
    var_name: ctl_out
    var_value: ""

  - id: init-su-tail-late
    action: set_var
    var_name: s_tail_late
    var_value: {response: ""}

  - id: open
    action: tcp_open
    handle: tn
    port: "{{port}}"
    read_banner: true
    timeout_secs: 10
    store_as: conn

  # No "login:" in the first read: wait and read again (a zero-byte write
  # only triggers the read).
  - id: late-banner-wait
    action: sleep
    condition: "conn.connected == true && (type_of(conn.banner) != \"string\" || strstr(tolower(conn.banner), \"login:\") == \"\")"
    duration_ms: 2000

  - id: late-banner
    action: tcp_send
    handle: tn
    condition: "conn.connected == true && (type_of(conn.banner) != \"string\" || strstr(tolower(conn.banner), \"login:\") == \"\")"
    send: ""
    timeout_secs: 10
    store_as: late

  # Product gate: the IPC's console greets with "WagoIPC1 login:".
  - id: gate-check
    action: script
    condition: "conn.connected == true"
    store_as: gate
    code: |
      let g = "";
      if type_of(conn.banner) == "string" { g += conn.banner; }
      if type_of(late.response) == "string" { g += late.response; }
      let lg = tolower(g);
      strstr(lg, "wagoipc") != "" && strstr(lg, "login:") != ""

  - id: send-user
    action: tcp_send
    handle: tn
    condition: "gate == true"
    send: "{{acct.user}}\r\n"
    timeout_secs: 10
    store_as: r_user

  # "Password:" not in the first read (slow device): wait and read again.
  - id: late-password-wait
    action: sleep
    condition: "gate == true && (type_of(r_user.response) != \"string\" || strstr(tolower(r_user.response), \"password\") == \"\")"
    duration_ms: 2000

  - id: late-password
    action: tcp_send
    handle: tn
    condition: "gate == true && (type_of(r_user.response) != \"string\" || strstr(tolower(r_user.response), \"password\") == \"\")"
    send: ""
    timeout_secs: 10
    store_as: r_user_late

  # The NASL only sends the password once "Password" was asked for.
  - id: password-prompt
    action: script
    condition: "gate == true"
    store_as: gate
    code: |
      let p = "";
      if type_of(r_user.response) == "string" { p += r_user.response; }
      if type_of(r_user_late.response) == "string" { p += r_user_late.response; }
      strstr(tolower(p), "password") != ""

  - id: send-pass
    action: tcp_send
    handle: tn
    condition: "gate == true"
    send: "{{acct.pass}}\r\n"
    timeout_secs: 10
    store_as: r_pass

  - id: send-echo
    action: tcp_send
    handle: tn
    condition: "gate == true"
    send: "echo NOCTIS$(({{proof.a}}+{{proof.b}}))U$(id -u)Z\r\n"
    timeout_secs: 10
    store_as: r_echo

  - id: wait-output
    action: sleep
    condition: "gate == true"
    duration_ms: 1000

  # Zero-byte write: read whatever the shell printed after the last read.
  - id: flush
    action: tcp_send
    handle: tn
    condition: "gate == true"
    send: ""
    # Drain read: usually nothing is left, and a read waits up to
    # timeout_secs for a first byte — keep it short.
    timeout_secs: 3
    store_as: r_tail

  - id: collect
    action: script
    condition: "gate == true"
    store_as: tn_out
    code: |
      let out = "";
      for r in [r_pass, r_echo, r_tail] {
        if type_of(r.response) == "string" { out += r.response + "\n"; }
      }
      out

  # Neither the sum nor a rejection yet (slow login): wait longer, read again.
  - id: late-output-wait
    action: sleep
    condition: "gate == true && strstr(tn_out, proof.marker) == \"\" && strstr(tolower(tn_out), \"incorrect\") == \"\""
    duration_ms: 2500

  - id: late-output
    action: tcp_send
    handle: tn
    condition: "gate == true && strstr(tn_out, proof.marker) == \"\" && strstr(tolower(tn_out), \"incorrect\") == \"\""
    send: ""
    timeout_secs: 10
    store_as: r_tail_late

  - id: collect-late
    action: script
    condition: "gate == true && type_of(r_tail_late.response) == \"string\""
    store_as: tn_out
    code: |
      tn_out + r_tail_late.response

  - id: check-shell
    action: script
    condition: "gate == true"
    store_as: shell
    code: |
      strstr(tn_out, "-sh") != ""

  - id: check-proof
    action: script
    condition: "gate == true"
    store_as: proof_ok
    code: |
      strstr(tn_out, proof.marker) != ""

  # The same echo printed the uid: "<marker>U0Z" means the login is already
  # root (root, or admin with uid 0), so `su` would prove nothing.
  - id: check-uid
    action: script
    condition: "proof_ok == true"
    store_as: uid_zero
    code: |
      strstr(tn_out, proof.marker + "U0Z") != ""

  # ------------------------- hard-coded super-user password (non-root login)
  - id: su
    action: tcp_send
    handle: tn
    condition: "proof_ok == true && uid_zero == false"
    send: "su\r\n"
    timeout_secs: 10
    store_as: s_su

  - id: su-pass
    action: tcp_send
    handle: tn
    condition: "proof_ok == true && uid_zero == false && type_of(s_su.response) == \"string\" && strstr(tolower(s_su.response), \"password\") != \"\""
    send: "ko2003wa\r\n"
    timeout_secs: 10
    store_as: s_pass

  # Reads the effective uid without changing anything.
  - id: su-id
    action: tcp_send
    handle: tn
    condition: "proof_ok == true && uid_zero == false && s_pass.sent == true"
    send: "echo NOCTISU$(id -u)Z\r\n"
    timeout_secs: 10
    store_as: s_id

  - id: su-wait
    action: sleep
    condition: "proof_ok == true && uid_zero == false && s_pass.sent == true"
    duration_ms: 1500

  - id: su-flush
    action: tcp_send
    handle: tn
    condition: "proof_ok == true && uid_zero == false && s_pass.sent == true"
    send: ""
    # Drain read: usually nothing is left, and a read waits up to
    # timeout_secs for a first byte — keep it short.
    timeout_secs: 3
    store_as: s_tail

  - id: su-collect
    action: script
    condition: "proof_ok == true && uid_zero == false && s_pass.sent == true"
    store_as: su_out
    code: |
      let out = "";
      for r in [s_pass, s_id, s_tail] {
        if type_of(r.response) == "string" { out += r.response + "\n"; }
      }
      out

  # A wrong su password takes seconds to be refused: read once more.
  - id: su-late-wait
    action: sleep
    condition: "proof_ok == true && uid_zero == false && s_pass.sent == true && egrep(\"NOCTISU[0-9]+Z\", su_out) == \"\""
    duration_ms: 3500

  - id: su-late
    action: tcp_send
    handle: tn
    condition: "proof_ok == true && uid_zero == false && s_pass.sent == true && egrep(\"NOCTISU[0-9]+Z\", su_out) == \"\""
    send: ""
    timeout_secs: 10
    store_as: s_tail_late

  - id: su-check
    action: script
    condition: "proof_ok == true && uid_zero == false"
    store_as: su_ok
    code: |
      let out = su_out;
      if type_of(s_tail_late.response) == "string" { out += s_tail_late.response; }
      strstr(out, "NOCTISU0Z") != ""

  - id: su-note
    action: set_var
    condition: "su_ok == true"
    var_name: su_note
    var_value: " The account could also `su` to root with the hard-coded super-user password 'ko2003wa' (`id -u` returned 0)."

  - id: close
    action: tcp_close
    handle: tn

  # ---------------------------------- control: same user, random password
  - id: ctl-open
    action: tcp_open
    handle: ctl
    port: "{{port}}"
    condition: "shell == true || proof_ok == true"
    read_banner: true
    timeout_secs: 10
    store_as: ctl_conn

  - id: ctl-late-wait
    action: sleep
    condition: "(shell == true || proof_ok == true) && ctl_conn.connected == true && (type_of(ctl_conn.banner) != \"string\" || strstr(tolower(ctl_conn.banner), \"login:\") == \"\")"
    duration_ms: 2000

  - id: ctl-late
    action: tcp_send
    handle: ctl
    condition: "(shell == true || proof_ok == true) && ctl_conn.connected == true && (type_of(ctl_conn.banner) != \"string\" || strstr(tolower(ctl_conn.banner), \"login:\") == \"\")"
    send: ""
    timeout_secs: 10

  - id: ctl-user
    action: tcp_send
    handle: ctl
    condition: "shell == true || proof_ok == true"
    send: "{{acct.user}}\r\n"
    timeout_secs: 10
    store_as: c_user

  - id: ctl-pass
    action: tcp_send
    handle: ctl
    condition: "shell == true || proof_ok == true"
    send: "{{proof.ctl_pw}}\r\n"
    timeout_secs: 10
    store_as: c_pass

  - id: ctl-echo
    action: tcp_send
    handle: ctl
    condition: "shell == true || proof_ok == true"
    send: "echo NOCTIS$(({{proof.a}}+{{proof.b}}))U$(id -u)Z\r\n"
    timeout_secs: 10
    store_as: c_echo

  - id: ctl-wait-output
    action: sleep
    condition: "shell == true || proof_ok == true"
    duration_ms: 1000

  - id: ctl-flush
    action: tcp_send
    handle: ctl
    condition: "shell == true || proof_ok == true"
    send: ""
    # Drain read: usually nothing is left, and a read waits up to
    # timeout_secs for a first byte — keep it short.
    timeout_secs: 3
    store_as: c_tail

  - id: ctl-collect
    action: script
    condition: "shell == true || proof_ok == true"
    store_as: ctl_out
    code: |
      let out = "";
      for r in [c_pass, c_echo, c_tail] {
        if type_of(r.response) == "string" { out += r.response + "\n"; }
      }
      out

  # Neither a shell nor a rejection yet: login(1) answers a wrong password
  # only after its failure delay (about 3 s). Wait and read again.
  - id: ctl-late-output-wait
    action: sleep
    condition: "(shell == true || proof_ok == true) && strstr(ctl_out, proof.marker) == \"\" && strstr(ctl_out, \"-sh\") == \"\" && strstr(tolower(ctl_out), \"incorrect\") == \"\" && strstr(tolower(ctl_out), \"login:\") == \"\""
    duration_ms: 3000

  - id: ctl-late-output
    action: tcp_send
    handle: ctl
    condition: "(shell == true || proof_ok == true) && strstr(ctl_out, proof.marker) == \"\" && strstr(ctl_out, \"-sh\") == \"\" && strstr(tolower(ctl_out), \"incorrect\") == \"\" && strstr(tolower(ctl_out), \"login:\") == \"\""
    send: ""
    timeout_secs: 10
    store_as: c_late

  - id: ctl-close
    action: tcp_close
    handle: ctl

  - id: ctl-collect-late
    action: script
    condition: "(shell == true || proof_ok == true) && type_of(c_late.response) == \"string\""
    store_as: ctl_out
    code: |
      ctl_out + c_late.response

  # The random password reached a shell: honeypot / broken login, no finding.
  - id: ctl-check
    action: script
    condition: "shell == true || proof_ok == true"
    store_as: ctl_ok
    code: |
      strstr(ctl_out, proof.marker) != "" || strstr(ctl_out, "-sh") != ""

  # Fail-closed: the random password counts as rejected only when login
  # said so ("Login incorrect", or a new "WagoIPC<n> login:" prompt after the
  # password — not a bare "login:", which "Last login: ..." also contains).
  - id: ctl-rejected
    action: script
    condition: "(shell == true || proof_ok == true) && ctl_ok == false"
    store_as: ctl_rej
    code: |
      let o = tolower(ctl_out);
      strstr(o, "incorrect") != "" || egrep("wagoipc[0-9]* login:", o) != ""

  # ------------------------------------------------------------- findings
  - id: finding-shell
    action: match
    source: tn_out
    pattern: "NOCTIS[0-9]+"
    condition: "proof_ok == true && ctl_rej == true"
    on_match:
      finding:
        title: "WAGO 758 IPC Telnet default credentials {{acct.user}}:{{acct.pass}}"
        description: "The Linux console of the WAGO I/O System 758 industrial PC logged in the account '{{acct.user}}' over Telnet with the default password '{{acct.pass}}', and its shell evaluated an arithmetic `echo` sent by the scanner, while a random password was rejected (CVE-2012-4879).{{su_note}}"
        remediation: "Change the passwords of the root, admin, user and guest console accounts (and of the super user), disable the Telnet service when it is not needed, and keep the controller on an isolated control network that untrusted hosts cannot reach."
        confidence_delta: 0.65
        qod: 97
        evidence: "Telnet login {{acct.user}}:{{acct.pass}} accepted, shell printed {{proof.marker}} for `echo NOCTIS$(({{proof.a}}+{{proof.b}}))` (random password rejected).{{su_note}} Output: {{tn_out}}"
      stop: true

  # The shell proof worked but the control login gave no clear answer
  # (refused connection, connection limit, very slow login): still a login
  # with a default password, reported at a lower QoD.
  - id: finding-shell-control-unknown
    action: match
    source: tn_out
    pattern: "NOCTIS[0-9]+"
    condition: "proof_ok == true && ctl_ok == false && ctl_rej == false"
    on_match:
      finding:
        title: "WAGO 758 IPC Telnet default credentials {{acct.user}}:{{acct.pass}}"
        description: "The Linux console of the WAGO I/O System 758 industrial PC logged in the account '{{acct.user}}' over Telnet with the default password '{{acct.pass}}' and its shell evaluated an arithmetic `echo` sent by the scanner. A second login with a random password gave no clear answer, so a login that accepts any password could not be ruled out (CVE-2012-4879).{{su_note}}"
        remediation: "Change the passwords of the root, admin, user and guest console accounts (and of the super user), disable the Telnet service when it is not needed, and keep the controller on an isolated control network that untrusted hosts cannot reach."
        confidence_delta: 0.50
        qod: 75
        evidence: "Telnet login {{acct.user}}:{{acct.pass}} accepted, shell printed {{proof.marker}} for `echo NOCTIS$(({{proof.a}}+{{proof.b}}))`; random-password control inconclusive.{{su_note}} Output: {{tn_out}}"
      stop: true

  - id: finding-prompt
    action: match
    source: tn_out
    pattern: "-sh"
    condition: "proof_ok == false && shell == true && ctl_rej == true"
    on_match:
      finding:
        title: "WAGO 758 IPC Telnet default credentials {{acct.user}}:{{acct.pass}}"
        description: "The Linux console of the WAGO I/O System 758 industrial PC logged in the account '{{acct.user}}' over Telnet with the default password '{{acct.pass}}' and showed a shell prompt, while a random password was rejected. The output of the arithmetic `echo` was not captured (CVE-2012-4879)."
        remediation: "Change the passwords of the root, admin, user and guest console accounts (and of the super user), disable the Telnet service when it is not needed, and keep the controller on an isolated control network that untrusted hosts cannot reach."
        confidence_delta: 0.50
        qod: 75
        evidence: "Telnet login {{acct.user}}:{{acct.pass}} accepted, shell prompt shown (random password rejected): {{tn_out}}"
      stop: true

WAGO I/O System 758 Series Default Web Credentials

CVECVE-2012-3013
Severitycritical · CVSS 10.0
Categorydefault-credentials — Default credentials
Serviceshttp, https
Detectionset_var, tcp_connect, match, script · highest QoD 97
Feedtests/vulnerabilities/wago/CVE-2012-3013.yaml

WAGO I/O System 758 industrial PCs (758-870, 758-874, 758-875, 758-876) ship Web Based Management accounts with default passwords (CVE-2012-3013). The check confirms the device by its Wago IO-IPC title page, then requests the web security page /security.htm. When it asks for a login, it first makes sure a random account is refused, then logs in over HTTP Basic auth with root/admin, admin/admin, user/user, user/user00 and guest/guest; reaching the "Configuration side for the web security" page proves the default credential. When the page opens without any login, that is reported as a separate, lower-confidence finding. Only GET requests are sent.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /cgi-bin/ssi.cgi/title.ssi HTTP/1.0
  2. Checks gate.banner for Wago IO-IPC
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET /security.htm HTTP/1.0
  4. Parses / computes the next value with a Rhai script
  5. Checks sec.banner for (?s)^HTTP/1\.[01] 200\b.*<title>Configuration side for the web securi… → finding QoD 75: WAGO I/O System 758 Web Security Page Not Protected
  6. Parses / computes the next value with a Rhai script
  7. Raw TCP (TLS on HTTPS), sent verbatim: GET /security.htm HTTP/1.0
  8. Parses / computes the next value with a Rhai script
  9. Raw TCP (TLS on HTTPS), sent verbatim: GET /security.htm HTTP/1.0
  10. Checks login.banner for (?s)^HTTP/1\.[01] 200\b.*<title>Configuration side for the web securi… → finding QoD 97: Logged in to the WAGO Web Based Management with the default credential …: GET /security.htm returned HTTP 200 with the 'Configuration side …

References:

Feed source — tests/vulnerabilities/wago/CVE-2012-3013.yaml
# WAGO I/O System 758 series industrial PCs (758-870, 758-874, 758-875,
# 758-876) — hard-coded / default accounts on the Web Based Management
# (CVE-2012-3013, ICS-ALERT-12-097-01).
#
# Ported from OpenVAS/Greenbone NVT 2012/gb_wago_758_870_52940_http.nasl
# (OID 1.3.6.1.4.1.25623.1.0.103465, GPL-2.0-only):
#   1. Product gate: GET /cgi-bin/ssi.cgi/title.ssi must contain "Wago IO-IPC".
#   2. GET /security.htm without credentials. If it answers "Unauthorized",
#      retry with HTTP Basic auth for root:admin, admin:admin, user:user,
#      user:user00 and guest:guest; a reply holding both
#      "<title>Configuration side for the web security" and
#      "Webserver security functions" is the authenticated security page —
#      a read-only post-login proof.
#   3. Otherwise the NASL reports the page as not protected at all.
#
# Deviations from the NASL (stronger detection, stated in the PR):
#   * "Not protected" branch: the NASL reports it for ANY reply without the
#     word "Unauthorized" (a 404, an error page, a redirect...). Here it needs
#     an unauthenticated HTTP 200 that carries both security-page markers, and
#     it is reported as its own lower-QoD finding (no default credential is
#     involved).
#   * Accept-any-password control: before the default logins, the page is
#     requested with a random user and password. If that already opens the
#     security page, the server does not check credentials (honeypot, broken
#     auth) and no default-credential finding is reported — the NASL would
#     report root:admin. The random account does not exist on a real device.
#   * Every working default pair gets its own finding (the NASL stops at the
#     first one).
#
# Nothing is changed on the device: only GET requests are sent.
uid: a9a4a851-3f44-4e0a-951e-646c425db97c
name: "WAGO I/O System 758 Series Default Web Credentials"
description: |
  WAGO I/O System 758 industrial PCs (758-870, 758-874, 758-875, 758-876)
  ship Web Based Management accounts with default passwords (CVE-2012-3013).
  The check confirms the device by its Wago IO-IPC title page, then requests
  the web security page /security.htm. When it asks for a login, it first makes
  sure a random account is refused, then logs in over HTTP Basic auth with
  root/admin, admin/admin, user/user, user/user00 and guest/guest; reaching the
  "Configuration side for the web security" page proves the default credential.
  When the page opens without any login, that is reported as a separate,
  lower-confidence finding. Only GET requests are sent.
cves: [CVE-2012-3013]
cvss: 10.0
severity: critical
category: default-credentials
confidence_base: 0.30
tags: [openvas-migrated, wago, ics, scada, plc, default-credentials, http]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-3013"
  - "https://www.cisa.gov/news-events/ics-alerts/ics-alert-12-097-01"
  - "https://www.securityfocus.com/bid/52940"
  - "OpenVAS/Greenbone NASL 2012/gb_wago_758_870_52940_http.nasl (GPL-2.0-only)"

steps:
  - id: init-product
    action: set_var
    var_name: product
    var_value: false
  - id: init-locked
    action: set_var
    var_name: locked
    var_value: false
  - id: init-anycred
    action: set_var
    var_name: anycred
    var_value: true
  # Pre-init the stored results the scripts read, so a skipped or failed
  # request never leaves an undefined variable behind.
  - id: init-sec
    action: set_var
    var_name: sec
    var_value: {banner: null}
  - id: init-ctrl
    action: set_var
    var_name: ctrl
    var_value: {banner: null}

  # 1. Product gate — the Wago IO-IPC title page.
  - id: gate-probe
    action: tcp_connect
    port: "{{port}}"
    send: "GET /cgi-bin/ssi.cgi/title.ssi HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    store_as: gate
  - id: gate-match
    action: match
    source: gate.banner
    pattern: 'Wago IO-IPC'
    on_match:
      set_vars:
        product: true

  # 2. The security page without credentials.
  - id: sec-probe
    action: tcp_connect
    port: "{{port}}"
    send: "GET /security.htm HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    store_as: sec
    condition: "product"
  - id: sec-locked
    action: script
    code: |
      let b = sec.banner;
      type_of(b) == "string" && ereg("^HTTP/1\\.[01] ", b)
        && (ereg("^HTTP/1\\.[01] 401", b)
            || (b.contains("Unauthorized")
                && !b.contains("Webserver security functions")))
    store_as: locked
    condition: "product"
  # 2a. Page open without any login (stricter than the NASL: 200 + both markers).
  - id: detect-open
    action: match
    source: sec.banner
    pattern: '(?s)^HTTP/1\.[01] 200\b.*<title>Configuration side for the web security.*Webserver security functions'
    condition: "product && !locked"
    on_match:
      finding:
        title: "WAGO I/O System 758 Web Security Page Not Protected"
        confidence_delta: 0.45
        qod: 75
        evidence: "GET /security.htm without any credentials returned HTTP 200 with the 'Configuration side for the web security' page of the WAGO Web Based Management."

  # 3. Control — a random account must not open the security page.
  - id: control-auth
    action: script
    code: 'base64_encode("noctis" + rand_hex(6) + ":" + rand_hex(10))'
    store_as: bad_auth
    condition: "product && locked"
  - id: control
    action: tcp_connect
    port: "{{port}}"
    send: "GET /security.htm HTTP/1.0\r\nHost: {{target_host}}\r\nAuthorization: Basic {{bad_auth}}\r\n\r\n"
    store_as: ctrl
    condition: "product && locked"
  # Fail-closed: anycred stays true unless the control got a real HTTP reply
  # that does not show the security page.
  - id: control-check
    action: script
    code: |
      let b = ctrl.banner;
      !(type_of(b) == "string" && ereg("^HTTP/1\\.[01] ", b))
        || (b.contains("<title>Configuration side for the web security")
            && b.contains("Webserver security functions"))
    store_as: anycred
    condition: "product && locked"

  # 4. Default logins — one request + one match per pair (the loop groups the
  #    three steps). No stop: every working pair gets its own finding.
  - id: init-login
    action: set_var
    var_name: login
    var_value: {banner: null}
    loop:
      var: acct
      over:
        - {label: "root/admin", b64: "cm9vdDphZG1pbg=="}
        - {label: "admin/admin", b64: "YWRtaW46YWRtaW4="}
        - {label: "user/user", b64: "dXNlcjp1c2Vy"}
        - {label: "user/user00", b64: "dXNlcjp1c2VyMDA="}
        - {label: "guest/guest", b64: "Z3Vlc3Q6Z3Vlc3Q="}
  - id: login
    action: tcp_connect
    port: "{{port}}"
    send: "GET /security.htm HTTP/1.0\r\nHost: {{target_host}}\r\nAuthorization: Basic {{acct.b64}}\r\n\r\n"
    store_as: login
    condition: "product && locked && !anycred"
  - id: detect-default
    action: match
    source: login.banner
    pattern: '(?s)^HTTP/1\.[01] 200\b.*<title>Configuration side for the web security.*Webserver security functions'
    condition: "product && locked && !anycred"
    on_match:
      finding:
        confidence_delta: 0.65
        qod: 97
        evidence: "Logged in to the WAGO Web Based Management with the default credential {{acct.label}}: GET /security.htm returned HTTP 200 with the 'Configuration side for the web security' page, while a random account was refused."

View these feeds on GitHub