Grandstream — 1 vulnerability check
noctis ships 1 vulnerability check for Grandstream, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Grandstream GXV camera Telnet backdoor account '!#/'
| CVE | CVE-2013-3542 |
|---|---|
| Severity | critical · CVSS 10.0 |
| Category | default-credentials — Default credentials |
| Services | telnet |
| Detection | script, set_var, tcp_open, sleep, tcp_send, tcp_close, match · highest QoD 97 |
| Feed | tests/vulnerabilities/grandstream/CVE-2013-3542.yaml |
Logs in to the Telnet service of a Grandstream GXV IP camera or video server with the hardcoded account "!#/" (user name and password), then types the read-only `help` command. The finding is confirmed when the "Grandstream>" management shell answers with its command list while a second login with a random password is rejected. Anyone on the network can then restart, factory-reset or re-flash the device.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Opens a persistent TCP/TLS socket
- Sends
…on the open socket - Parses / computes the next value with a Rhai script
- Sends
!#/on the open socket - Sends
…on the open socket - Parses / computes the next value with a Rhai script
- Sends
!#/on the open socket - Parses / computes the next value with a Rhai script
- Sends
helpon the open socket - Sends
…on the open socket - Parses / computes the next value with a Rhai script
- Sends
…on the open socket - Parses / computes the next value with a Rhai script
- … and 14 more steps — see the feed source below
References:
- https://nvd.nist.gov/vuln/detail/CVE-2013-3542
- https://packetstormsecurity.com/files/122004/Grandstream-Backdoor-Cross-Site-Request-Forgery-Cross-Site-Scripting.html
Feed source — tests/vulnerabilities/grandstream/CVE-2013-3542.yaml
# Grandstream GXV IP cameras / video servers — hardcoded Telnet backdoor
# account "!#/" (CVE-2013-3542).
#
# GXV3501, GXV3504, GXV3601, GXV3601HD/LL, GXV3611HD/LL, GXV3615W/P, GXV3651FHD,
# GXV3662HD, GXV3615WP_HD and GXV3500 firmware ships a Telnet service (open by
# default) where the string "!#/" is accepted as both user name and password.
# It drops into the device's "Grandstream>" management shell (help, status,
# restart, restore, upgrade, tty_test…): anyone on the network can reboot,
# factory-reset or re-flash the camera.
#
# Ported from OpenVAS/Greenbone NVT
# 2013/gb_grandstream_hardcoded_telnet_account.nasl
# (OID 1.3.6.1.4.1.25623.1.0.103737, GPL-2.0-only): require "grandstream" and
# "Username" in the greeting, send "!#/", require "Password", send "!#/",
# report on the "Grandstream>" prompt.
#
# Deviations from the NASL (stronger detection, documented in the PR):
# * Two levels of proof. QoD 97: the logged-in shell answered the read-only
# `help` command with its command list (tty_test / restore / upgrade),
# which never appears in what we send. QoD 75: only the "Grandstream>"
# prompt came back (the NASL's evidence).
# * Accept-any-password guard: after the backdoor login worked, 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.
# The control is fail-closed: QoD 97 needs a control that demonstrably ran
# (user-name and password prompts seen) and was rejected; a control that
# could not run (single-session device) leaves the finding at QoD 75.
# * Late greeting / slow device: a "Username:" or "Password:" prompt that
# misses the first read is still seen (wait, then read again) instead of
# the target being skipped; the greeting / prompt match ignores case.
# * cves: only CVE-2013-3542 (the Telnet backdoor) is tested. The NVT also
# lists CVE-2013-3962 (web UI XSS) and CVE-2013-3963 (web UI CSRF), which
# this Telnet login does not prove.
#
# Read-only: only `help` is typed in the shell (never restart / restore /
# upgrade), then the socket is closed. One wrong-password attempt (the control)
# is made only after the backdoor login already worked. category:
# default-credentials so operators can exclude credential logins.
uid: 599c43c1-3fe4-47a8-9d4c-b63775a6cd10
name: "Grandstream GXV camera Telnet backdoor account '!#/' (CVE-2013-3542)"
description: |
Logs in to the Telnet service of a Grandstream GXV IP camera or video server
with the hardcoded account "!#/" (user name and password), then types the
read-only `help` command. The finding is confirmed when the "Grandstream>"
management shell answers with its command list while a second login with a
random password is rejected. Anyone on the network can then restart,
factory-reset or re-flash the device.
cves: [CVE-2013-3542]
cvss: 10.0
severity: critical
category: default-credentials
confidence_base: 0.30
tags: [grandstream, gxv, ip-camera, iot, telnet, backdoor, default-credentials, hardcoded-credentials, intrusive]
services: [telnet]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2013-3542"
- "https://packetstormsecurity.com/files/122004/Grandstream-Backdoor-Cross-Site-Request-Forgery-Cross-Site-Scripting.html"
steps:
# Random control password — never the backdoor one.
- id: control-password
action: script
store_as: ctl_pw
code: |
"noctis" + rand_str(14)
- id: init-gate
action: set_var
var_name: gate
var_value: false
- id: init-logged-in
action: set_var
var_name: logged_in
var_value: false
- id: init-help-proof
action: set_var
var_name: help_proof
var_value: false
- id: init-ctl-ok
action: set_var
var_name: ctl_ok
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: open
action: tcp_open
handle: tn
port: "{{port}}"
read_banner: true
timeout_secs: 10
store_as: conn
# No "username" 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), \"username\") == \"\")"
duration_ms: 2000
- id: late-banner
action: tcp_send
handle: tn
condition: "conn.connected == true && (type_of(conn.banner) != \"string\" || strstr(tolower(conn.banner), \"username\") == \"\")"
send: ""
timeout_secs: 10
store_as: late
# Grandstream greeting asking for a user name.
- 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 l = tolower(g);
strstr(l, "grandstream") != "" && strstr(l, "username") != ""
- id: send-user
action: tcp_send
handle: tn
condition: "gate == true"
send: "!#/\r\n"
timeout_secs: 10
store_as: r_user
- 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
# Only send the password once it 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: "!#/\r\n"
timeout_secs: 10
store_as: r_pass
# Backdoor rejected at once ("incorrect" / a new user-name prompt): don't
# type `help` into the next login prompt (it would be a 2nd failed login).
- id: pass-rejected
action: script
condition: "gate == true && type_of(r_pass.response) == \"string\""
store_as: gate
code: |
let l = tolower(r_pass.response);
!(strstr(l, "incorrect") != "" || strstr(l, "username") != "")
- id: send-help
action: tcp_send
handle: tn
condition: "gate == true"
send: "help\r\n"
timeout_secs: 10
store_as: r_help
- 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_help, r_tail] {
if type_of(r.response) == "string" { out += r.response + "\n"; }
}
out
# Command list not there yet (slow device): wait longer and read again.
- id: late-output-wait
action: sleep
condition: "gate == true && strstr(tolower(tn_out), \"tty_test\") == \"\""
duration_ms: 2500
- id: late-output
action: tcp_send
handle: tn
condition: "gate == true && strstr(tolower(tn_out), \"tty_test\") == \"\""
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 + "\n" + r_tail_late.response
- id: close
action: tcp_close
handle: tn
- id: check-prompt
action: script
condition: "gate == true"
store_as: logged_in
code: |
strstr(tolower(tn_out), "grandstream>") != ""
# Shell command list: tty_test, or restore + upgrade together. None of these
# words is in anything we send.
- id: check-help
action: script
condition: "gate == true"
store_as: help_proof
code: |
let l = tolower(tn_out);
strstr(l, "tty_test") != "" || (strstr(l, "restore") != "" && strstr(l, "upgrade") != "")
# ---------------------------------- control: same user, random password
# Fail-closed: the control only counts as "random password rejected" when it
# demonstrably ran (greeting with "username", then a "password" prompt). A
# control that could not run (single-session device, refused 2nd connection)
# is inconclusive → the finding drops to QoD 75.
- id: init-ctl-ran
action: set_var
var_name: ctl_ran
var_value: false
- id: init-ctl-late
action: set_var
var_name: c_late
var_value: {response: ""}
- id: init-ctl-user-late
action: set_var
var_name: c_user_late
var_value: {response: ""}
- id: init-ctl-tail-late
action: set_var
var_name: c_tail_late
var_value: {response: ""}
- id: ctl-open
action: tcp_open
handle: ctl
port: "{{port}}"
condition: "logged_in == true || help_proof == true"
read_banner: true
timeout_secs: 10
store_as: ctl_conn
- id: ctl-late-wait
action: sleep
condition: "(logged_in == true || help_proof == true) && ctl_conn.connected == true && (type_of(ctl_conn.banner) != \"string\" || strstr(tolower(ctl_conn.banner), \"username\") == \"\")"
duration_ms: 2000
- id: ctl-late
action: tcp_send
handle: ctl
condition: "(logged_in == true || help_proof == true) && ctl_conn.connected == true && (type_of(ctl_conn.banner) != \"string\" || strstr(tolower(ctl_conn.banner), \"username\") == \"\")"
send: ""
timeout_secs: 10
store_as: c_late
- id: ctl-user
action: tcp_send
handle: ctl
condition: "(logged_in == true || help_proof == true) && ctl_conn.connected == true"
send: "!#/\r\n"
timeout_secs: 10
store_as: c_user
- id: ctl-late-password-wait
action: sleep
condition: "(logged_in == true || help_proof == true) && ctl_conn.connected == true && (type_of(c_user.response) != \"string\" || strstr(tolower(c_user.response), \"password\") == \"\")"
duration_ms: 2000
- id: ctl-late-password
action: tcp_send
handle: ctl
condition: "(logged_in == true || help_proof == true) && ctl_conn.connected == true && (type_of(c_user.response) != \"string\" || strstr(tolower(c_user.response), \"password\") == \"\")"
send: ""
timeout_secs: 10
store_as: c_user_late
- id: ctl-ran-check
action: script
condition: "(logged_in == true || help_proof == true) && ctl_conn.connected == true"
store_as: ctl_ran
code: |
let g = "";
if type_of(ctl_conn.banner) == "string" { g += ctl_conn.banner; }
if type_of(c_late.response) == "string" { g += c_late.response; }
let p = "";
if type_of(c_user.response) == "string" { p += c_user.response; }
if type_of(c_user_late.response) == "string" { p += c_user_late.response; }
strstr(tolower(g), "username") != "" && strstr(tolower(p), "password") != ""
- id: ctl-pass
action: tcp_send
handle: ctl
condition: "ctl_ran == true"
send: "{{ctl_pw}}\r\n"
timeout_secs: 10
store_as: c_pass
- id: ctl-help
action: tcp_send
handle: ctl
condition: "ctl_ran == true"
send: "help\r\n"
timeout_secs: 10
store_as: c_help
- id: ctl-wait-output
action: sleep
condition: "ctl_ran == true"
duration_ms: 1000
- id: ctl-flush
action: tcp_send
handle: ctl
condition: "ctl_ran == 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
# Same extra wait as the backdoor login: a slow accept-any login must not
# look like a rejection.
- id: ctl-late-output-wait
action: sleep
condition: "ctl_ran == true"
duration_ms: 2500
- id: ctl-late-output
action: tcp_send
handle: ctl
condition: "ctl_ran == true"
send: ""
timeout_secs: 10
store_as: c_tail_late
- id: ctl-close
action: tcp_close
handle: ctl
- id: ctl-check
action: script
condition: "ctl_ran == true"
store_as: ctl_ok
code: |
let out = "";
for r in [c_pass, c_help, c_tail, c_tail_late] {
if type_of(r.response) == "string" { out += r.response + "\n"; }
}
let l = tolower(out);
strstr(l, "grandstream>") != "" || strstr(l, "tty_test") != "" || (strstr(l, "restore") != "" && strstr(l, "upgrade") != "")
# ------------------------------------------------------------- findings
- id: finding-help
action: match
source: tn_out
pattern: "(?i)tty_test|restore|upgrade"
condition: "help_proof == true && ctl_ran == true && ctl_ok == false"
on_match:
finding:
title: "Grandstream GXV Telnet backdoor account '!#/'"
description: "The Telnet service accepted the hardcoded Grandstream account '!#/' (as user name and password) and the management shell answered the read-only `help` command with its command list, while a random password was rejected. Anyone on the network can restart, factory-reset or re-flash the device (CVE-2013-3542)."
remediation: "Update the camera / video server to the latest Grandstream firmware, which removes the hardcoded Telnet account, disable Telnet where the firmware allows it, and block TCP/23 from untrusted networks."
confidence_delta: 0.65
qod: 97
evidence: "Telnet login !#/:!#/ accepted, `help` answered (random password rejected): {{tn_out}}"
stop: true
# Prompt only, or the random-password control could not run (only one
# Telnet session allowed, 2nd connection refused): QoD 75.
- id: finding-prompt
action: match
source: tn_out
pattern: "(?i)grandstream>|tty_test|restore|upgrade"
condition: "(logged_in == true || help_proof == true) && ctl_ok == false && (help_proof == false || ctl_ran == false)"
on_match:
finding:
title: "Grandstream GXV Telnet backdoor account '!#/'"
description: "The Telnet service accepted the hardcoded Grandstream account '!#/' (as user name and password) and showed the 'Grandstream>' management shell. Either the answer to the read-only `help` command was not captured, or the check that a random password is rejected could not run (CVE-2013-3542)."
remediation: "Update the camera / video server to the latest Grandstream firmware, which removes the hardcoded Telnet account, disable Telnet where the firmware allows it, and block TCP/23 from untrusted networks."
confidence_delta: 0.50
qod: 75
evidence: "Telnet login !#/:!#/ accepted, Grandstream shell reached (random-password control ran and was rejected: {{ctl_ran}}): {{tn_out}}"
stop: true