CAREL pCOWeb — 1 vulnerability check

noctis ships 1 vulnerability check for CAREL pCOWeb, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

CAREL pCOWeb Default Root Passwords (Telnet)

CVECVE-2019-13553
Severitycritical · CVSS 9.8
Categorydefault-credentials — Default credentials
Servicestelnet
Detectionscript, set_var, tcp_open, sleep, tcp_send, tcp_close, match · highest QoD 97
Feedtests/vulnerabilities/carel-pcoweb/CVE-2019-13553.yaml

CAREL pCOWeb network cards for HVAC controllers (also built into Rittal chillers) ship their Linux console with known passwords for the 'root' account, reachable over Telnet (CVE-2019-13553). The check requires the pCOWeb login greeting, then logs in as root with the passwords froot and frootSX4jfH. 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 root is refused. The login is reported with a lower confidence when the root prompt appears but the command output is not captured, or when the random-password login gives no clear answer.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Opens a persistent TCP/TLS socket
  3. Sends a binary frame 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 15 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/carel-pcoweb/CVE-2019-13553.yaml
# CAREL pCOWeb HVAC controller card — default passwords of the 'root' Linux
# account reachable over Telnet (CVE-2019-13553: hard-coded credentials in
# pCOWeb firmware A1.5.3 – B1.2.4, also shipped in Rittal SK 3232 chillers).
#
# Ported from OpenVAS/Greenbone NVT
# 2013/gb_pcoweb_root_user_telnet_default_passwords.nasl
# (OID 1.3.6.1.4.1.25623.1.0.103717, GPL-2.0-only): require
# "pCOWeb[^ ]* login:" in the greeting, then for each password froot and
# frootSX4jfH send "root", require "Password:", send the password, reject
# "Login incorrect", require a "[root@pCOWeb ...]#" prompt or the
# "Executing profile ... /bin" login banner, run `id` and report on
# "uid=0(root) gid=0(root)". The NASL itself notes that the record does not
# name the hard-coded credentials; the CVE is kept as the tracking ID.
#
# Deviations from the NASL (stronger detection, documented in the PR):
#   * Proof: the shell must evaluate `echo NOCTIS$((a+b))U$(id -u)Z` with two
#     random integers and print the sum (never in what we send) — QoD 97. The
#     same line prints the uid, quoted in the evidence. When only the root
#     prompt / login banner comes back (commands print nothing), the finding
#     is reported at QoD 75.
#   * The proof does not depend on the prompt text: a device whose prompt was
#     renamed still gets the arithmetic check (the NASL skips it).
#   * Accept-any-password guard: after a successful login, a second login as
#     root with a random password is made; when it also reaches the shell
#     (honeypot, broken login), the feed reports nothing. Fail-closed: QoD 97
#     needs the device to actually refuse it ("Login incorrect" or a new
#     "pCOWeb login:" prompt); an inconclusive control gives QoD 75.
#   * The greeting gate is case-insensitive, and a greeting that misses the
#     first read is read again.
#
# 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: 9929be3c-c163-4b7b-ba09-eb5d6dc1435a
name: "CAREL pCOWeb Default Root Passwords (Telnet)"
description: |
  CAREL pCOWeb network cards for HVAC controllers (also built into Rittal
  chillers) ship their Linux console with known passwords for the 'root'
  account, reachable over Telnet (CVE-2019-13553). The check requires the
  pCOWeb login greeting, then logs in as root with the passwords froot and
  frootSX4jfH. 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 root is refused. The login is reported with a lower confidence when the
  root prompt appears but the command output is not captured, or when the
  random-password login gives no clear answer.
cves: [CVE-2019-13553]
cvss: 9.8
severity: critical
category: default-credentials
confidence_base: 0.30
tags: [carel, pcoweb, rittal, hvac, ics, scada, telnet, default-credentials, hardcoded-credentials, intrusive]
services: [telnet]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2019-13553"
  - "https://www.us-cert.gov/ics/advisories/icsa-19-297-01"
  - "http://seclists.org/fulldisclosure/2019/Oct/45"
  - "https://www.redteam-pentesting.de/en/advisories/rt-sa-2019-013/-unsafe-storage-of-credentials-in-carel-pcoweb-hvac"

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 password
  # The whole group below runs once per password; a finding (stop: true)
  # ends it.
  - id: init-gate
    action: set_var
    loop:
      over:
        - {user: "root", pass: "froot"}
        - {user: "root", pass: "frootSX4jfH"}
      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-ctl-rej
    action: set_var
    var_name: ctl_rej
    var_value: false

  - 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-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-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: open
    action: tcp_open
    handle: tn
    port: "{{port}}"
    read_banner: true
    timeout_secs: 10
    store_as: conn

  # No "login:" in the first read: wait, refuse the usual telnetd option
  # requests (IAC WONT TERMINAL-TYPE / TSPEED / XDISPLOC / NEW-ENVIRON — a
  # telnetd that waits for those answers only then starts login) and read
  # again.
  - 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_hex: "fffc18fffc20fffc23fffc27"
    timeout_secs: 10
    store_as: late

  # Product gate: the card's console greets with "pCOWeb 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; }
      egrep("pcoweb[^ ]* login:", tolower(g)) != ""

  - 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 password is only sent 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: 5000

  - 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

  # Root prompt "[root@pCOWeb root]#" or the login banner "Executing profile
  # ... /bin" (the device's own markers).
  - id: check-shell
    action: script
    condition: "gate == true"
    store_as: shell
    code: |
      let o = tolower(tn_out);
      strstr(o, "incorrect") == "" && (egrep("\\[root@pcoweb.*\\]#", o) != "" || egrep("executing profile.+/s?bin", o) != "")

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

  - id: close
    action: tcp_close
    handle: tn

  # ---------------------------------- control: root, 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_hex: "fffc18fffc20fffc23fffc27"
    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) == \"\" && egrep(\"\\\\[root@pcoweb.*\\\\]#|executing profile\", tolower(ctl_out)) == \"\" && 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) == \"\" && egrep(\"\\\\[root@pcoweb.*\\\\]#|executing profile\", tolower(ctl_out)) == \"\" && 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: |
      let o = tolower(ctl_out);
      strstr(ctl_out, proof.marker) != "" || (strstr(o, "incorrect") == "" && (egrep("\\[root@pcoweb.*\\]#", o) != "" || strstr(o, "executing profile") != ""))

  # Fail-closed: the random password counts as rejected only when the device
  # said so ("Login incorrect", or a new "pCOWeb 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("pcoweb[^ ]* 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: "CAREL pCOWeb Telnet default root password '{{acct.pass}}'"
        description: "The Linux console of the CAREL pCOWeb card logged in the 'root' account 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-2019-13553)."
        remediation: "Change the passwords of the root and other system accounts of the pCOWeb card (from its Telnet console or web interface), update the pCOWeb firmware, disable Telnet when it is not needed, and keep the card on an isolated building-management 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). 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: "CAREL pCOWeb Telnet default root password '{{acct.pass}}'"
        description: "The Linux console of the CAREL pCOWeb card logged in the 'root' account 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-2019-13553)."
        remediation: "Change the passwords of the root and other system accounts of the pCOWeb card (from its Telnet console or web interface), update the pCOWeb firmware, disable Telnet when it is not needed, and keep the card on an isolated building-management 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. Output: {{tn_out}}"
      stop: true

  - id: finding-prompt
    action: match
    source: tn_out
    pattern: "(?i)root@pcoweb|executing profile"
    condition: "proof_ok == false && shell == true && ctl_rej == true"
    on_match:
      finding:
        title: "CAREL pCOWeb Telnet default root password '{{acct.pass}}'"
        description: "The Linux console of the CAREL pCOWeb card logged in the 'root' account over Telnet with the default password '{{acct.pass}}' and showed the root shell prompt, while a random password was rejected. The output of the arithmetic `echo` was not captured (CVE-2019-13553)."
        remediation: "Change the passwords of the root and other system accounts of the pCOWeb card (from its Telnet console or web interface), update the pCOWeb firmware, disable Telnet when it is not needed, and keep the card on an isolated building-management network that untrusted hosts cannot reach."
        confidence_delta: 0.50
        qod: 75
        evidence: "Telnet login {{acct.user}}:{{acct.pass}} accepted, root shell prompt shown (random password rejected): {{tn_out}}"
      stop: true

View these feeds on GitHub