Cisco IOS — 1 vulnerability check
noctis ships 1 vulnerability check for Cisco IOS, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Cisco IOS FTP Server Authentication Bypass
| CVE | CVE-2007-2586 |
|---|---|
| Severity | critical · CVSS 9.3 |
| Category | auth-bypass — Auth bypass |
| Services | ftp |
| Detection | set_var, script, tcp_open, sleep, tcp_send, tcp_close, match · highest QoD 75 |
| Feed | tests/vulnerabilities/cisco-ios/CVE-2007-2586.yaml |
Detects the authentication bypass in the FTP server of Cisco IOS 11.3 through 12.4, which accepts any user name and password. On an FTP service whose greeting identifies the Cisco IOS FTP server, the test logs in with a user name and password generated at random for the scan, opens a passive data connection with PASV and lists the FTP root with LIST. It is confirmed when the random login is accepted (230) and the directory listing arrives on the data connection. When the random login is accepted but no listing can be retrieved, the finding is reported with lower confidence. The flaw gives read and write access to the router file systems, including the startup configuration. The test only lists a directory: no file is read or written.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Opens a persistent TCP/TLS socket
- Sends
…on the open socket - Parses / computes the next value with a Rhai script
- Sends
USER {{fuser}}on the open socket - Sends
…on the open socket - Sends
PASS {{fpass}}on the open socket - Sends
…on the open socket - Parses / computes the next value with a Rhai script
- Sends
PASVon the open socket - Sends
…on the open socket - Parses / computes the next value with a Rhai script
- Opens a persistent TCP/TLS socket
- … and 10 more steps — see the feed source below
References:
- https://nvd.nist.gov/vuln/detail/CVE-2007-2586
- https://www.cisco.com/en/US/products/products_security_advisory09186a00808399d0.shtml
- https://www.securityfocus.com/bid/23885
Feed source — tests/vulnerabilities/cisco-ios/CVE-2007-2586.yaml
# Cisco IOS FTP server — authentication bypass — CVE-2007-2586
# (cisco-sa-20070509-iosftp, CSCek55259, BID 23885).
#
# The FTP server of Cisco IOS 11.3 through 12.4 does not properly check user
# authorization: any user name / password is accepted, which gives read and
# write access to the router file systems (flash:, nvram:startup-config). The
# advisory lists fixed releases per IOS train; the workaround is to disable the
# FTP server ("no ftp-server enable").
#
# Ported from OpenVAS/Greenbone NVT 2008/cisco_ios_ftp_server_auth_bypass.nasl
# (OID 1.3.6.1.4.1.25623.1.0.9999996, GPL-2.0-only): greeting must contain
# "IOS-FTP server", log in as blah/blah, PASV + LIST; then CWD nvram: and
# RETR startup-config, reporting the partial configuration.
#
# Deviations from the NVT (stronger / safer detection, stated in the PR):
# * A random user name and password are sent for each scan instead of the
# fixed blah/blah, so a real account that happens to exist can never be
# taken for the bypass.
# * The startup configuration is NOT downloaded: it holds secrets (enable
# secret, SNMP communities, keys). The proof is the directory listing of
# the FTP root received on a passive data connection after the bogus
# login (QoD 75). A bogus login accepted with 230 but no listing
# (passive mode refused, data port unreachable, empty root) is reported
# at QoD 70; the NVT reports nothing in that case.
# * The greeting form listed for Cisco IOS ftpd in nmap-service-probes
# ("220 Cisco (<ver>) FTP server ready") is accepted as well.
# * The PASV address is ignored (NAT): the data connection goes to the
# scanned host. Late greeting / replies are re-read.
#
# Read-only: USER, PASS, PASV, LIST and QUIT only.
uid: 3f0b9c4e-7a52-4d1e-b8c6-2e5a91d04f73
name: "Cisco IOS FTP Server Authentication Bypass (CVE-2007-2586)"
description: |
Detects the authentication bypass in the FTP server of Cisco IOS 11.3
through 12.4, which accepts any user name and password. On an FTP service
whose greeting identifies the Cisco IOS FTP server, the test logs in with a
user name and password generated at random for the scan, opens a passive
data connection with PASV and lists the FTP root with LIST. It is confirmed
when the random login is accepted (230) and the directory listing arrives on
the data connection. When the random login is accepted but no listing can be
retrieved, the finding is reported with lower confidence. The flaw gives
read and write access to the router file systems, including the startup
configuration. The test only lists a directory: no file is read or written.
cves: [CVE-2007-2586]
cvss: 9.3
severity: critical
category: auth-bypass
confidence_base: 0.30
tags: [cisco, cisco-ios, ftp, auth-bypass, router]
services: [ftp]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2007-2586"
- "https://www.cisco.com/en/US/products/products_security_advisory09186a00808399d0.shtml"
- "https://www.securityfocus.com/bid/23885"
steps:
# Pre-init everything the scripts and conditions read: a failed step stores
# nothing, and an undefined variable would abort the test.
- id: init-ftpo
action: set_var
var_name: ftpo
var_value: {banner: "", connected: false}
- id: init-greet-late
action: set_var
var_name: greet_late
var_value: {response: ""}
- id: init-ur
action: set_var
var_name: ur
var_value: {response: ""}
- id: init-ur-late
action: set_var
var_name: ur_late
var_value: {response: ""}
- id: init-pr
action: set_var
var_name: pr
var_value: {response: ""}
- id: init-pr-late
action: set_var
var_name: pr_late
var_value: {response: ""}
- id: init-login
action: set_var
var_name: login
var_value: ""
- id: init-pasv
action: set_var
var_name: pasv
var_value: {response: ""}
- id: init-pasv-late
action: set_var
var_name: pasv_late
var_value: {response: ""}
- id: init-dport
action: set_var
var_name: dport
var_value: 0
- id: init-dopen
action: set_var
var_name: dopen
var_value: {connected: false}
- id: init-list
action: set_var
var_name: list
var_value: {response: ""}
- id: init-list-late
action: set_var
var_name: list_late
var_value: {response: ""}
- id: init-list-late2
action: set_var
var_name: list_late2
var_value: {response: ""}
- id: init-dat
action: set_var
var_name: dat
var_value: {response: ""}
- id: init-dat-late
action: set_var
var_name: dat_late
var_value: {response: ""}
- id: init-denied
action: set_var
var_name: denied
var_value: ""
- id: init-proof
action: set_var
var_name: proof
var_value: ""
# Random credentials for this scan.
- id: rand-user
action: script
code: '"noctis" + rand_hex(5)'
store_as: fuser
- id: rand-pass
action: script
code: 'rand_hex(12)'
store_as: fpass
# ── 1. Greeting: Cisco IOS FTP server only ───────────────────────────────
- id: open
action: tcp_open
handle: ftp
port: "{{port}}"
read_banner: true
timeout_secs: 10
store_as: ftpo
- id: greet-wait
action: sleep
condition: 'ftpo.connected == true && (type_of(ftpo.banner) != "string" || !ereg("(^|\\n)220 ", ftpo.banner))'
duration_ms: 4000
- id: greet-late
action: tcp_send
condition: 'ftpo.connected == true && (type_of(ftpo.banner) != "string" || !ereg("(^|\\n)220 ", ftpo.banner))'
handle: ftp
send: ""
store_as: greet_late
- id: product
action: script
code: |
let g = "";
if type_of(ftpo.banner) == "string" { g += ftpo.banner; }
if type_of(greet_late.response) == "string" { g += "\n" + greet_late.response; }
let v = "";
let m = eregmatch("IOS-FTP server(?: \\(version ([\\w.()-]+)\\))?", g);
if m.len() > 0 {
v = "Cisco IOS FTP server";
if m.len() > 1 && type_of(m[1]) == "string" && m[1] != "" { v += " " + m[1]; }
} else {
let n = eregmatch("(?m)^220 Cisco \\(([\\d.]+)\\) FTP server ready", g);
if n.len() > 1 { v = "Cisco IOS FTP server (IOS " + n[1] + ")"; }
}
v
store_as: product
# ── 2. Login with random credentials ─────────────────────────────────────
- id: user
action: tcp_send
condition: 'product != ""'
handle: ftp
send: "USER {{fuser}}\r\n"
store_as: ur
- id: user-wait
action: sleep
condition: 'product != "" && (type_of(ur.response) != "string" || !ereg("(^|\\n)[2-5][0-9][0-9]([ \\r]|$)", ur.response))'
duration_ms: 3000
- id: user-late
action: tcp_send
condition: 'product != "" && (type_of(ur.response) != "string" || !ereg("(^|\\n)[2-5][0-9][0-9]([ \\r]|$)", ur.response))'
handle: ftp
send: ""
store_as: ur_late
- id: pass
action: tcp_send
condition: 'product != ""'
handle: ftp
send: "PASS {{fpass}}\r\n"
store_as: pr
- id: pass-wait
action: sleep
condition: 'product != "" && (type_of(pr.response) != "string" || !ereg("(^|\\n)[2-5][0-9][0-9]([ \\r]|$)", pr.response))'
duration_ms: 3000
- id: pass-late
action: tcp_send
condition: 'product != "" && (type_of(pr.response) != "string" || !ereg("(^|\\n)[2-5][0-9][0-9]([ \\r]|$)", pr.response))'
handle: ftp
send: ""
store_as: pr_late
# "yes" only when the random login got 230 and no 4xx/5xx refusal.
- id: login-ok
action: script
condition: 'product != ""'
code: |
let u = "";
if type_of(ur.response) == "string" { u += ur.response; }
if type_of(ur_late.response) == "string" { u += "\n" + ur_late.response; }
let p = "";
if type_of(pr.response) == "string" { p += pr.response; }
if type_of(pr_late.response) == "string" { p += "\n" + pr_late.response; }
let ok = "";
if !ereg("(^|\n)[45][0-9][0-9]([ \r-]|$)", u) {
if ereg("(^|\n)230([ \r-]|$)", p) && !ereg("(^|\n)[45][0-9][0-9]([ \r-]|$)", p) { ok = "yes"; }
else if ereg("(^|\n)230([ \r-]|$)", u) && !ereg("(^|\n)530([ \r-]|$)", p) { ok = "yes"; }
}
ok
store_as: login
# ── 3. Passive data connection + LIST ────────────────────────────────────
- id: pasv
action: tcp_send
condition: 'login == "yes"'
handle: ftp
send: "PASV\r\n"
store_as: pasv
- id: pasv-wait
action: sleep
condition: 'login == "yes" && (type_of(pasv.response) != "string" || !ereg("(^|\\n)[1-5][0-9][0-9]([ \\r]|$)", pasv.response))'
duration_ms: 3000
- id: pasv-late
action: tcp_send
condition: 'login == "yes" && (type_of(pasv.response) != "string" || !ereg("(^|\\n)[1-5][0-9][0-9]([ \\r]|$)", pasv.response))'
handle: ftp
send: ""
store_as: pasv_late
- id: pasv-port
action: script
condition: 'login == "yes"'
code: |
let t = "";
if type_of(pasv.response) == "string" { t += pasv.response; }
if type_of(pasv_late.response) == "string" { t += "\n" + pasv_late.response; }
let p = 0;
let m = eregmatch("(?m)^227 [^\r\n]*?\\d+,\\d+,\\d+,\\d+,(\\d+),(\\d+)", t);
if m.len() > 2 { p = int(m[1]) * 256 + int(m[2]); }
if p <= 0 || p >= 65536 { p = 0; }
p
store_as: dport
- id: data-open
action: tcp_open
condition: "dport > 0"
handle: data
port: "{{dport}}"
timeout_secs: 10
store_as: dopen
- id: list
action: tcp_send
condition: 'login == "yes" && dopen.connected == true'
handle: ftp
send: "LIST\r\n"
store_as: list
# Empty send = read what the server wrote on the data connection.
- id: data-read
action: tcp_send
condition: 'login == "yes" && dopen.connected == true'
handle: data
send: ""
store_as: dat
- id: data-wait
action: sleep
condition: 'login == "yes" && dopen.connected == true && type_of(dat.response) != "string"'
duration_ms: 3000
- id: data-read-late
action: tcp_send
condition: 'login == "yes" && dopen.connected == true && type_of(dat.response) != "string"'
handle: data
send: ""
store_as: dat_late
- id: data-close
action: tcp_close
handle: data
# Wait for the final reply (226 / 4xx / 5xx) after the 150.
- id: list-wait
action: sleep
condition: 'login == "yes" && dopen.connected == true && (type_of(list.response) != "string" || !ereg("(^|\\n)[2-5][0-9][0-9]([ \\r]|$)", list.response))'
duration_ms: 3000
- id: list-late
action: tcp_send
condition: 'login == "yes" && dopen.connected == true && (type_of(list.response) != "string" || !ereg("(^|\\n)[2-5][0-9][0-9]([ \\r]|$)", list.response))'
handle: ftp
send: ""
store_as: list_late
- id: list-wait-2
action: sleep
condition: 'login == "yes" && dopen.connected == true && (type_of(list.response) != "string" || !ereg("(^|\\n)[2-5][0-9][0-9]([ \\r]|$)", list.response)) && (type_of(list_late.response) != "string" || !ereg("(^|\\n)[2-5][0-9][0-9]([ \\r]|$)", list_late.response))'
duration_ms: 3000
- id: list-late-2
action: tcp_send
condition: 'login == "yes" && dopen.connected == true && (type_of(list.response) != "string" || !ereg("(^|\\n)[2-5][0-9][0-9]([ \\r]|$)", list.response)) && (type_of(list_late.response) != "string" || !ereg("(^|\\n)[2-5][0-9][0-9]([ \\r]|$)", list_late.response))'
handle: ftp
send: ""
store_as: list_late2
- id: quit
action: tcp_send
condition: 'product != ""'
handle: ftp
send: "QUIT\r\n"
- id: close
action: tcp_close
handle: ftp
# "proof": first entry of the listing received on the data connection,
# framed by a 1xx and a 226/250 reply with no 4xx/5xx.
- id: verdict
action: script
condition: 'login == "yes"'
code: |
let r = "";
if type_of(list.response) == "string" { r += list.response; }
if type_of(list_late.response) == "string" { r += "\n" + list_late.response; }
if type_of(list_late2.response) == "string" { r += "\n" + list_late2.response; }
let d = "";
if type_of(dat.response) == "string" { d += dat.response; }
if type_of(dat_late.response) == "string" { d += dat_late.response; }
let first = "";
let m = eregmatch("(?m)^([^\r\n]*\\S[^\r\n]*)", d);
if m.len() > 1 { first = m[1]; }
if strlen(first) > 120 { first = substr(first, 0, 119); }
let ok = ereg("(^|\n)1[0-9][0-9]([ \r-]|$)", r) && ereg("(^|\n)(226|250)([ \r-]|$)", r) && !ereg("(^|\n)[45][0-9][0-9]([ \r-]|$)", r);
if ok { first } else { "" }
store_as: proof
# A server that answers 230 to any PASS but then refuses PASV / LIST with
# 530 (deferred authentication) granted no access: no finding.
- id: denied
action: script
condition: 'login == "yes"'
code: |
let t = "";
for x in [pasv.response, pasv_late.response, list.response, list_late.response, list_late2.response] {
if type_of(x) == "string" { t += "\n" + x; }
}
if ereg("(^|\n)530([ \r-]|$)", t) { "yes" } else { "" }
store_as: denied
# ── 4. Report ────────────────────────────────────────────────────────────
- id: report
action: match
source: proof
pattern: "\\S"
condition: 'login == "yes" && denied != "yes" && proof != ""'
on_match:
finding:
title: "Cisco IOS FTP Server Authentication Bypass (CVE-2007-2586)"
description: "The Cisco IOS FTP server accepted a login with a user name and password generated at random for this scan, then returned the directory listing of the FTP root on a passive data connection: the FTP server does not check credentials, giving read and write access to the router file systems."
remediation: "Disable the IOS FTP server (no ftp-server enable) or upgrade to a Cisco IOS release that is not affected, as listed in Cisco advisory cisco-sa-20070509-iosftp. Restrict access to the router management services to trusted hosts."
confidence_delta: 0.55
qod: 75
evidence: "{{product}}: random login {{fuser}} accepted (230), PASV + LIST returned the FTP root listing (first entry: {{proof}})"
stop: true
- id: report-login
action: match
source: login
pattern: "^yes$"
condition: 'login == "yes" && denied != "yes" && proof == ""'
on_match:
finding:
title: "Cisco IOS FTP Server Authentication Bypass (CVE-2007-2586)"
description: "The Cisco IOS FTP server accepted a login with a user name and password generated at random for this scan (230). No directory listing could be retrieved (passive mode refused, data port unreachable or empty directory), so the result is reported with lower confidence."
remediation: "Disable the IOS FTP server (no ftp-server enable) or upgrade to a Cisco IOS release that is not affected, as listed in Cisco advisory cisco-sa-20070509-iosftp. Restrict access to the router management services to trusted hosts."
confidence_delta: 0.40
qod: 70
evidence: "{{product}}: random login {{fuser}} was accepted with 230"
stop: true