Contec Smart Home — 1 vulnerability check
noctis ships 1 vulnerability check for Contec Smart Home, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Contec Smart Home User Management Authentication Bypass
| CVE | CVE-2018-9162 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | auth-bypass — Auth bypass |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/contec-smart-home/CVE-2018-9162.yaml |
Tests whether the Contec Smart Home controller serves its user list, /content/user.php, without logging in. The feed requests the page without any session cookie and without following redirects. The finding is reported when the reply is a 200 page carrying the controller's `class="list home"` page layout that is the user-management page itself rather than a login form (no password field, or a password field next to links to the user creation, edit or delete scripts), and when a request for a random, non-existent script in the same /content/ directory does not return that layout, so a site that answers every path with it is not reported. On an affected controller the same scripts let anyone create users or reset the administrator password. The probe only reads the user list and never calls the scripts that create, change or delete users.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET /content/user.php - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET /content/{{ctl_name}} - Parses / computes the next value with a Rhai script
- Checks
prooffor^Contec Smart Home user list served without authentication$→ finding QoD 75: Contec Smart Home User Management Authentication Bypass (CVE-2018-9162)
References:
Feed source — tests/vulnerabilities/contec-smart-home/CVE-2018-9162.yaml
# Contec Smart Home user management authentication bypass — CVE-2018-9162
#
# Contec Smart Home 4.15 (Israeli home-automation controller, web UI under
# /content/) serves its user-management scripts — user.php (user list),
# new_user.php, edit_user.php, delete_user.php — without checking for a
# session (EDB-44295: an unauthenticated new_user.php?user_name=ADMIN&
# password=...&group_id=1 resets the admin password, then doors, lamps and
# air conditioners can be driven). The firmware is not public; the
# `class="list home"` marker of the controller's page layout is the one the
# public source check relies on.
#
# Detection (read-only — user.php only lists users; new_user.php /
# edit_user.php / delete_user.php WRITE and are never requested):
# 1. GET /content/user.php without cookies, redirects not followed:
# 200 + `class="list home"`, and not a login form: no password field,
# or a password field next to a link to the user-management scripts
# (new_user.php / edit_user.php / delete_user.php).
# 2. Control: GET /content/noctis<random>.php must NOT answer 200 with the
# same marker (a front end that serves the layout for any path is not
# reported).
# QoD 75 (response analysis: the protected user list served without login).
#
# Improvements over the source NASL (200 + marker only):
# - A login page sharing the controller layout is not reported.
# - Redirects to a login page are not followed.
# - Catch-all control on a random sibling script.
#
# CVSS: NVD v3.0 9.8 (the issue's 7.5 is the v2 score).
#
# Ported from OpenVAS/Greenbone NVT 2018/contec/gb_contec_smart_home_auth_bypass_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.140937, GPL-2.0-only).
uid: 51d42777-5d0b-4aa7-bd73-f71545787fde
name: "Contec Smart Home User Management Authentication Bypass (CVE-2018-9162)"
description: |
Tests whether the Contec Smart Home controller serves its user list,
/content/user.php, without logging in. The feed requests the page without
any session cookie and without following redirects. The finding is
reported when the reply is a 200 page carrying the controller's
`class="list home"` page layout that is the user-management page itself
rather than a login form (no password field, or a password field next to
links to the user creation, edit or delete scripts), and when a request for
a random, non-existent script in the same /content/ directory does not
return that layout, so a site that answers every path with it is not
reported. On an affected controller the same scripts let anyone create
users or reset the administrator password. The probe only reads the user
list and never calls the scripts that create, change or delete users.
cves: [CVE-2018-9162]
cvss: 9.8
severity: critical
category: auth-bypass
confidence_base: 0.30
tags: [contec, smart-home, iot, auth-bypass, user-management]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2018-9162"
- "https://www.exploit-db.com/exploits/44295"
# OpenVAS/Greenbone NASL 2018/contec/gb_contec_smart_home_auth_bypass_vuln.nasl (GPL-2.0-only)
steps:
- id: mint
action: script
code: '"noctis" + rand_hex(6) + ".php"'
store_as: ctl_name
- id: init-users
action: set_var
var_name: users
var_value: {status: 0, body: ""}
- id: init-ctl
action: set_var
var_name: ctl
var_value: {status: 0, body: ""}
- id: fetch-users
action: http_request
method: GET
path: "/content/user.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: users
# The user list itself: 200 and the controller layout marker, and not a
# login form. A page with a password field counts as a login form unless it
# also links to the user-management scripts (a user page that carries an
# add-user form). ereg, not egrep: egrep tests line by line and would miss
# an <input> tag split over two lines.
- id: page
action: script
store_as: is_list
code: |
users.status == 200 && type_of(users.body) == "string"
&& ereg("class\\s*=\\s*[\"']list home[\"']", users.body)
&& (!ereg("(?i)<input[^>]*type\\s*=\\s*[\"']?password", users.body)
|| ereg("(?i)(new|edit|delete)_user\\.php", users.body))
- id: fetch-control
action: http_request
method: GET
path: "/content/{{ctl_name}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'is_list == true'
store_as: ctl
- id: verdict
action: script
store_as: proof
code: |
let ctl_hit = ctl.status == 200 && type_of(ctl.body) == "string"
&& ereg("class\\s*=\\s*[\"']list home[\"']", ctl.body);
if is_list == true && !ctl_hit { "Contec Smart Home user list served without authentication" } else { "" }
- id: report
action: match
source: proof
pattern: "^Contec Smart Home user list served without authentication$"
on_match:
finding:
title: "Contec Smart Home User Management Authentication Bypass (CVE-2018-9162)"
description: "The Contec Smart Home controller serves its user-management page (/content/user.php) to a request that carries no session: the page came back with the controller layout and no login form. On an affected controller the sibling scripts new_user.php, edit_user.php and delete_user.php are equally unprotected, so anyone who can reach the web interface can create an administrator, reset the administrator password and then operate the connected doors, lamps and appliances."
remediation: "Do not expose the Contec Smart Home web interface to untrusted networks: restrict access to the /content/ scripts to trusted addresses (firewall or reverse proxy with authentication) and apply a vendor firmware update that requires a session for user.php, new_user.php, edit_user.php and delete_user.php. Review the controller's user list for accounts you did not create and change the administrator password."
confidence_delta: 0.50
qod: 75
evidence: "GET /content/user.php without a session returned HTTP 200 with the Contec Smart Home user-management page rather than a login form; the control request /content/{{ctl_name}} did not return that page."
stop: true