Open-FTPD — 1 vulnerability check

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

← All products · Feeds on GitHub

Open&Compact FTP Server (Open-FTPD) Authentication Bypass

CVECVE-2010-2620
Severitycritical · CVSS 9.3
Categoryauth-bypass — Auth bypass
Servicesftp
Detectionset_var, tcp_open, sleep, tcp_send, script, tcp_close, match · highest QoD 75
Feedtests/vulnerabilities/open-ftpd/CVE-2010-2620.yaml

Detects the authentication bypass in Open&Compact FTP Server (Open-FTPD, "Gabriel's FTP Server") 1.2 and earlier, whose FTP commands run without a login. On a server whose greeting identifies Open-FTPD, the test never sends USER or PASS: it requests a passive data connection with PASV and lists the FTP root with LIST. It is confirmed when the directory listing arrives on the data connection and the server reports the transfer as complete instead of replying 530 (login required). When PASV is refused, its data port cannot be reached or the listing is empty, a bare LIST answered with "226 Transfer Complete" before login is reported with lower confidence. The flaw gives unauthenticated read and write access to the files of the FTP users and leads to code execution on Windows hosts. The test only lists a directory.

How noctis detects it

  1. Opens a persistent TCP/TLS socket
  2. Sends … on the open socket
  3. Parses / computes the next value with a Rhai script
  4. Sends PASV on the open socket
  5. Sends … on the open socket
  6. Parses / computes the next value with a Rhai script
  7. Opens a persistent TCP/TLS socket
  8. Parses / computes the next value with a Rhai script
  9. Opens a persistent TCP/TLS socket
  10. Sends … on the open socket
  11. Sends LIST on the open socket
  12. Sends … on the open socket
  13. Sends … on the open socket
  14. Sends … on the open socket
  15. … and 7 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/open-ftpd/CVE-2010-2620.yaml
# Open&Compact FTP Server (Open-FTPD, "Gabriel's FTP Server") <= 1.2 —
# authentication bypass — CVE-2010-2620 (EDB-13932, Metasploit
# exploit/windows/ftp/open_ftpd_wbem).
#
# The server never checks that a session has logged in: LIST, RETR, STOR and
# the other commands run right after the greeting, with the rights of the
# configured users (the Metasploit module writes a MOF file with STOR for code
# execution). No fixed release was published.
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_open_ftpd_auth_bypass_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801228, GPL-2.0-only): greeting must contain
# "Gabriel's FTP Server", then a bare "LIST" without USER/PASS; report when the
# control reply holds "226 Transfer Complete".
#
# Deviations from the NVT (stronger detection, stated in the PR):
#   * Real proof first: PASV without a login, a passive data connection, then
#     LIST — the finding (QoD 75) requires the directory listing to arrive on
#     the data connection, framed by a 1xx / 226 reply and no 530. The NVT's
#     bare LIST (no PORT/PASV, so no data can flow) only shows the server
#     accepting the command; it is kept as the QoD 70 fallback when PASV is
#     refused or the FTP root is empty.
#   * Any 530 reply to the pre-login PASV/LIST means the login is enforced:
#     no finding, whatever else the reply contains.
#   * The PASV address is ignored (NATed servers): the data connection goes to
#     the scanned host. When the announced data port cannot be reached
#     (firewall forwarding only port 21), the bare LIST runs on a fresh
#     session instead, so the test never does worse than the NVT.
#   * Late greeting / replies are re-read instead of shifting the dialogue.
#
# Read-only: only PASV, LIST and QUIT are sent; USER/PASS are never sent.
uid: c277466d-40bb-49b8-9a44-19814c1d0e67
name: "Open&Compact FTP Server (Open-FTPD) Authentication Bypass (CVE-2010-2620)"
description: |
  Detects the authentication bypass in Open&Compact FTP Server (Open-FTPD,
  "Gabriel's FTP Server") 1.2 and earlier, whose FTP commands run without a
  login. On a server whose greeting identifies Open-FTPD, the test never sends
  USER or PASS: it requests a passive data connection with PASV and lists the
  FTP root with LIST. It is confirmed when the directory listing arrives on the
  data connection and the server reports the transfer as complete instead of
  replying 530 (login required). When PASV is refused, its data port cannot be reached or the listing
  is empty,
  a bare LIST answered with "226 Transfer Complete" before login is reported
  with lower confidence. The flaw gives unauthenticated read and write access
  to the files of the FTP users and leads to code execution on Windows hosts.
  The test only lists a directory.
cves: [CVE-2010-2620]
cvss: 9.3
severity: critical
category: auth-bypass
confidence_base: 0.30
tags: [open-ftpd, open-compact-ftp, gabriels-ftp-server, ftp, auth-bypass, windows]
services: [ftp]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-2620"
  - "https://www.exploit-db.com/exploits/13932"
  - "https://www.exploit-db.com/exploits/27556"
  - "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/windows/ftp/open_ftpd_wbem.rb"

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-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-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-dopen
    action: set_var
    var_name: dopen
    var_value: {connected: false}
  - id: init-ftpo2
    action: set_var
    var_name: ftpo2
    var_value: {banner: "", connected: false}
  - id: init-regreet-late
    action: set_var
    var_name: regreet_late
    var_value: {response: ""}
  - id: init-mode
    action: set_var
    var_name: mode
    var_value: "none"
  - id: init-proof
    action: set_var
    var_name: proof
    var_value: ""
  - id: init-accepted
    action: set_var
    var_name: accepted
    var_value: ""

  # ── 1. Greeting: Open-FTPD only ──────────────────────────────────────────
  - id: open
    action: tcp_open
    handle: ftp
    port: "{{port}}"
    read_banner: true
    timeout_secs: 10
    store_as: ftpo

  # The multi-line greeting ends with a "220 " line; read it if it came late.
  - 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 = "";
      if ereg("Gabriel's FTP Server", g) {
        v = "Open-FTPD";
        let m = eregmatch("\\*\\*\\s+([\\w./-]+) Release", g);
        if m.len() > 1 { v += " " + m[1]; }
      }
      v
    store_as: product

  # ── 2. Passive data connection without a login ───────────────────────────
  - id: pasv
    action: tcp_send
    condition: 'product != ""'
    handle: ftp
    send: "PASV\r\n"
    store_as: pasv

  - id: pasv-wait
    action: sleep
    condition: 'product != "" && (type_of(pasv.response) != "string" || !ereg("(^|\\n)[1-5][0-9][0-9] ", pasv.response))'
    duration_ms: 3000

  - id: pasv-late
    action: tcp_send
    condition: 'product != "" && (type_of(pasv.response) != "string" || !ereg("(^|\\n)[1-5][0-9][0-9] ", pasv.response))'
    handle: ftp
    send: ""
    store_as: pasv_late

  # Port from the 227 reply; -1 when the login is enforced (530).
  - id: pasv-port
    action: script
    condition: 'product != ""'
    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;
      if ereg("(^|\n)530[ -]", t) { p = -1; }
      else {
        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

  # "pasv": data connection open. "bare": PASV refused, bare LIST as the
  # original check. "reopen": 227 but its data port is not reachable
  # (firewall / NAT forwarding only port 21) — bare LIST on a new session,
  # since a pending PASV would make the server wait for the data connection.
  - id: mode
    action: script
    condition: 'product != ""'
    code: |
      if dport < 0 { "none" }
      else if dport == 0 { "bare" }
      else if dopen.connected == true { "pasv" }
      else { "reopen" }
    store_as: mode

  - id: reopen-close
    action: tcp_close
    condition: 'mode == "reopen"'
    handle: ftp

  - id: reopen
    action: tcp_open
    condition: 'mode == "reopen"'
    handle: ftp
    port: "{{port}}"
    read_banner: true
    timeout_secs: 10
    store_as: ftpo2

  - id: regreet-wait
    action: sleep
    condition: 'mode == "reopen" && (type_of(ftpo2.banner) != "string" || !ereg("(^|\\n)220 ", ftpo2.banner))'
    duration_ms: 4000

  - id: regreet-late
    action: tcp_send
    condition: 'mode == "reopen" && (type_of(ftpo2.banner) != "string" || !ereg("(^|\\n)220 ", ftpo2.banner))'
    handle: ftp
    send: ""
    store_as: regreet_late

  # ── 3. LIST without a login ──────────────────────────────────────────────
  - id: list
    action: tcp_send
    condition: 'mode != "none"'
    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: 'mode == "pasv"'
    handle: data
    send: ""
    store_as: dat

  - id: data-wait
    action: sleep
    condition: 'mode == "pasv" && type_of(dat.response) != "string"'
    duration_ms: 3000

  - id: data-read-late
    action: tcp_send
    condition: 'mode == "pasv" && 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: 'mode != "none" && (type_of(list.response) != "string" || !ereg("(^|\\n)([2-5][0-9][0-9]) ", list.response))'
    duration_ms: 3000

  - id: list-late
    action: tcp_send
    condition: 'mode != "none" && (type_of(list.response) != "string" || !ereg("(^|\\n)([2-5][0-9][0-9]) ", list.response))'
    handle: ftp
    send: ""
    store_as: list_late

  - id: list-wait-2
    action: sleep
    condition: 'mode != "none" && (type_of(list.response) != "string" || !ereg("(^|\\n)([2-5][0-9][0-9]) ", list.response)) && (type_of(list_late.response) != "string" || !ereg("(^|\\n)([2-5][0-9][0-9]) ", list_late.response))'
    duration_ms: 3000

  - id: list-late-2
    action: tcp_send
    condition: 'mode != "none" && (type_of(list.response) != "string" || !ereg("(^|\\n)([2-5][0-9][0-9]) ", list.response)) && (type_of(list_late.response) != "string" || !ereg("(^|\\n)([2-5][0-9][0-9]) ", list_late.response))'
    handle: ftp
    send: ""
    store_as: list_late2

  - id: quit
    action: tcp_send
    condition: 'mode != "none"'
    handle: ftp
    send: "QUIT\r\n"

  - id: close
    action: tcp_close
    handle: ftp

  # "accepted": the LIST got a transfer-complete reply and no 530.
  # "proof": first entry of the listing received on the data connection.
  - id: verdict
    action: script
    condition: 'mode != "none"'
    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 ok = !ereg("(^|\n)530[ -]", r) && ereg("(^|\n)(226|250)[ -]", r);
      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 out = #{ accepted: "", proof: "" };
      if ok {
        out.accepted = "yes";
        if first != "" && ereg("(^|\n)1[0-9][0-9][ -]", r) { out.proof = first; }
      }
      out
    store_as: v

  - id: set-proof
    action: script
    condition: 'mode != "none"'
    code: "v.proof"
    store_as: proof

  - id: set-accepted
    action: script
    condition: 'mode != "none"'
    code: "v.accepted"
    store_as: accepted

  # ── 4. Report ────────────────────────────────────────────────────────────
  - id: report
    action: match
    source: proof
    pattern: "\\S"
    condition: 'proof != ""'
    on_match:
      finding:
        title: "Open&Compact FTP Server (Open-FTPD) Authentication Bypass (CVE-2010-2620)"
        description: "Without any USER/PASS, PASV and LIST returned the directory listing of the FTP root on the data connection and the server reported the transfer as complete: FTP commands run without authentication."
        remediation: "No fixed Open-FTPD release is available: replace Open&Compact FTP Server with a maintained FTP server, or block access to its FTP port from untrusted networks."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{product}}: unauthenticated PASV + LIST returned the FTP root listing (first entry: {{proof}})"
      stop: true

  - id: report-accepted
    action: match
    source: accepted
    pattern: "^yes$"
    condition: 'proof == "" && accepted == "yes"'
    on_match:
      finding:
        title: "Open&Compact FTP Server (Open-FTPD) Authentication Bypass (CVE-2010-2620)"
        description: "Without any USER/PASS, the server answered LIST with a transfer-complete reply instead of requiring a login. No directory listing could be retrieved (passive mode refused, data port unreachable or empty directory), so the result is reported with lower confidence."
        remediation: "No fixed Open-FTPD release is available: replace Open&Compact FTP Server with a maintained FTP server, or block access to its FTP port from untrusted networks."
        confidence_delta: 0.40
        qod: 70
        evidence: "{{product}}: unauthenticated LIST was answered with a transfer-complete reply, without a 530 login-required reply"
      stop: true

View these feeds on GitHub