EFTP — 2 vulnerability checks

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

← All products · Feeds on GitHub

EFTP Server .lnk File Buffer Overflow

CVECVE-2001-1112
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Servicesftp
Detectionset_var, tcp_dialogue, script, match · highest QoD 70
Feedtests/vulnerabilities/eftp/CVE-2001-1112.yaml

EFTP 2.0.7.337 and earlier parse the Windows shortcut (.lnk) files of a directory when it is listed, and copy their content into a fixed-size stack buffer without checking its length. A user allowed to upload files can store an overlong .lnk file; listing that directory then overwrites the saved return address, which lets the attacker run code on the Windows host or crash the FTP service. The check reads the FTP greeting and reports an EFTP server announcing a version before 2.0.8 ("EFTP Version x.y.z"). It is a version check: the flaw is only triggered by overwriting server memory, so no exploit is sent and nothing is uploaded.

How noctis detects it

  1. TCP dialogue: QUIT
  2. Parses / computes the next value with a Rhai script
  3. Checks eftpver for ^[0-9] → finding QoD 70: FTP greeting: EFTP Version … (before 2.0.8; overflow not triggered).

References:

Feed source — tests/vulnerabilities/eftp/CVE-2001-1112.yaml
# EFTP 2.0.7.337 — .lnk file buffer overflow (CVE-2001-1112, ByteRage,
# bugtraq 2001-09-12 "EFTP Version 2.0.7.337 vulnerabilities", section 3).
# A user allowed to upload stores a *.lnk file holding ("A" x 1744) . "CCCC";
# a later LS makes the server parse it and overwrites EIP with 0x43434343.
#
# Ported from OpenVAS/Greenbone NVT pre2008/eftp_bufferoverflow.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10928, GPL-2.0-only). The NVT's active branch
# uploads that .lnk file, lists the directory and reports the service when it
# no longer accepts connections; in safe-checks mode (and without credentials
# plus a writable directory) it matches the greeting against
# ".*EFTP Version 2\.0\.[0-7]\.*". Solution: "Upgrade EFTP to 2.0.8.x".
#
# Version check only: the sole observable effect of the flaw is the server
# crash (or code execution), and the advisory describes no .lnk behaviour
# short of it, so no exploit is sent and nothing is uploaded.
#
# Deviations from the NVT (stronger detection, stated in the PR):
#   * The NVT regex is an unanchored prefix test: "2\.0\.[0-7]" also matches
#     fixed builds such as 2.0.10.x or 2.0.12.x. Here the version components
#     are parsed as integers and compared with 2.0.8.
#   * Releases before 2.0 (0.x / 1.x) are reported too (same code base, no
#     fix released before 2.0.8), as the sibling CVE-2001-1109 feed does.
#   * "EFTP Version" and "EFTP version" are both accepted, right after a
#     case-sensitive "EFTP", so a host name such as eftp.example.com in
#     another server's greeting does not count.
uid: 4e44cf80-b130-420a-b193-456fd2400981
name: "EFTP Server .lnk File Buffer Overflow (CVE-2001-1112)"
description: |
  EFTP 2.0.7.337 and earlier parse the Windows shortcut (.lnk) files of a
  directory when it is listed, and copy their content into a fixed-size stack
  buffer without checking its length. A user allowed to upload files can store
  an overlong .lnk file; listing that directory then overwrites the saved
  return address, which lets the attacker run code on the Windows host or
  crash the FTP service. The check reads the FTP greeting and reports an EFTP
  server announcing a version before 2.0.8 ("EFTP Version x.y.z"). It is a
  version check: the flaw is only triggered by overwriting server memory, so
  no exploit is sent and nothing is uploaded.
cves: [CVE-2001-1112]
cvss: 7.5  # NVD publishes only a CVSS v2 base score (7.5) for this CVE
severity: high
category: rce
confidence_base: 0.30
tags: [eftp, ftp, buffer-overflow, windows, version-check, unauthenticated]
services: [ftp]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2001-1112"
  - "https://seclists.org/bugtraq/2001/Sep/135"

steps:
  - id: init-greet
    action: set_var
    var_name: greet
    var_value: {banner: "", transcript: ""}

  # The greeting, then QUIT (its read also catches a late greeting).
  - id: greeting
    action: tcp_dialogue
    port: "{{port}}"
    read_banner: true
    timeout_secs: 10
    commands:
      - "QUIT"
    store_as: greet

  - id: version
    action: script
    code: |
      let t = "";
      if type_of(greet.banner) == "string" { t += greet.banner; }
      if type_of(greet.transcript) == "string" { t += "\n" + greet.transcript; }
      let m = eregmatch("(?m)^220[ -].*\\bEFTP [Vv]ersion\\s+([0-9]+(?:\\.[0-9]+)*)", t);
      if m.len() < 2 { "" } else {
        let p = split(m[1], ".");
        let major = int(p[0]);
        let minor = if p.len() > 1 { int(p[1]) } else { 0 };
        let patch = if p.len() > 2 { int(p[2]) } else { 0 };
        if major < 2 || (major == 2 && minor == 0 && patch < 8) { m[1] } else { "" }
      }
    store_as: eftpver

  - id: vulnerable-version
    action: match
    source: eftpver
    pattern: "^[0-9]"
    on_match:
      stop: true
      finding:
        confidence_delta: 0.45
        qod: 70
        evidence: "FTP greeting: EFTP Version {{eftpver}} (before 2.0.8; overflow not triggered)."
        remediation: "Upgrade EFTP to 2.0.8 or later, or replace it with a maintained FTP server; do not grant upload rights to untrusted FTP users and restrict FTP access to trusted networks."

EFTP Server Directory Traversal File Existence Disclosure

CVECVE-2001-1109
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Servicesftp
Detectionset_var, script, tcp_open, tcp_send, tcp_close, match · highest QoD 75
Feedtests/vulnerabilities/eftp/CVE-2001-1109.yaml

EFTP 2.0.7.337 and earlier do not filter ".." segments in the paths given to the SIZE, MDTM and LIST commands, so any FTP user can leave the home directory and learn whether any file of the drive exists, its size and date, list directories, and read the installation directory from error replies. The test reads the FTP greeting and goes on only for an EFTP server. It logs in with the scan credentials when supplied, otherwise anonymously, then sends SIZE (and MDTM when SIZE is not answered) for ../../../../../../autoexec.bat, boot.ini, windows/win.ini and winnt/win.ini. It is confirmed when a traversal path answers 213 (size or date of the file) while the same command for a random absent directory in front of that file is refused and the same file named without ".." is not found, which shows that the ".." segments are what reach it. It is also confirmed when MDTM of a random absent ../ file is answered by a "no such file" error quoting the drive path the server looked up, ".." included ('c:\…\..\name'). When no login is possible, an EFTP greeting announcing a version before 2.0.8 is reported with lower confidence. Nothing is written and no file content is transferred.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. Opens a persistent TCP/TLS socket
  4. Parses / computes the next value with a Rhai script
  5. Sends USER {{cred_username}} on the open socket
  6. Sends PASS {{cred_password}} on the open socket
  7. Parses / computes the next value with a Rhai script
  8. Opens a persistent TCP/TLS socket
  9. Sends USER anonymous on the open socket
  10. Sends PASS noctis@example.com on the open socket
  11. Parses / computes the next value with a Rhai script
  12. Sends SIZE ../../../../../../{{probe}} on the open socket
  13. Sends MDTM ../../../../../../{{probe}} on the open socket
  14. Parses / computes the next value with a Rhai script
  15. … and 10 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/eftp/CVE-2001-1109.yaml
# EFTP 2.0.7.337 — ".." (dot dot) directory traversal in SIZE / MDTM / LIST
# (CVE-2001-1109, ByteRage, bugtraq 2001-09-12 "EFTP Version 2.0.7.337
# vulnerabilities", BID 3331 / 3333). Fixed in 2.0.8.348.
#
# Advisory session (account home c:\restricted):
#   QUOTE SIZE ../autoexec.bat -> 213 900
#   QUOTE MDTM ../autoexec.bat -> 213 20010901063342.000
#   QUOTE SIZE ../notthere     -> 550 Command failed: File not found.
#   QUOTE MDTM ../notthere     -> 550 'c:\restricted\..\notthere':no such file or directory
#
# Ported from OpenVAS/Greenbone NVT pre2008/eftp_directory_traversal.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10933, GPL-2.0-only): EFTP greeting gate, FTP
# login (scan credentials, default anonymous), SIZE and MDTM of
# ../../../../../../autoexec.bat; without a login, greeting version
# "EFTP version 0.x / 1.x / 2.0.0–2.0.7". The installation-directory variant of
# the same CVE comes from pre2008/eftp_root_disclosure.nasl
# (OID 1.3.6.1.4.1.25623.1.0.11093): an error reply quoting "'C:\…".
#
# Deviations from the NVTs (stronger detection, stated in the PR):
#   * The NVT counts a "230 " reply to SIZE/MDTM as a hit — EFTP answers 213
#     (advisory), so its authenticated branch never fires. A hit here is a
#     213 reply to SIZE (else MDTM) of a traversal path.
#   * Four Windows files are tried (autoexec.bat, boot.ini, windows/win.ini,
#     winnt/win.ini), not only autoexec.bat, absent on most NT systems.
#   * Absent-file control: the same command on a random absent directory in
#     front of the same file must be refused (4xx/5xx), so a server answering
#     213 to everything gives no finding.
#   * Baseline control: the same file named without ".." must NOT answer 213,
#     otherwise the account home is the drive root and ".." proves nothing.
#   * Path-disclosure branch: MDTM of a random absent ../ file answered by a
#     "no such file or directory" error quoting the joined drive path
#     ("'c:\home\..\noctisXXXX'") — the server looked the ".." path up on
#     its file system (advisory reply); a refusal quoting the path is not enough.
#   * The NVT's greeting regex uses lowercase "version" (case-sensitive egrep),
#     while EFTP prints "EFTP Version"; both spellings accepted here (right
#     after a case-sensitive "EFTP", so a host name such as eftp.example.com
#     does not count), and
#     only as a fallback when the active probes did not prove anything.
#   * Refused scan credentials (request-wide, often meant for another
#     service) fall back to an anonymous login on a fresh connection.
#
# Read-only: after login only SIZE, MDTM and QUIT are sent — no file content
# is transferred.
uid: b5f16722-3ed3-4972-90ed-847330e9a516
name: "EFTP Server Directory Traversal File Existence Disclosure (CVE-2001-1109)"
description: |
  EFTP 2.0.7.337 and earlier do not filter ".." segments in the paths given to
  the SIZE, MDTM and LIST commands, so any FTP user can leave the home
  directory and learn whether any file of the drive exists, its size and date,
  list directories, and read the installation directory from error replies.
  The test reads the FTP greeting and goes on only for an EFTP server. It logs
  in with the scan credentials when supplied, otherwise anonymously, then sends
  SIZE (and MDTM when SIZE is not answered) for
  ../../../../../../autoexec.bat, boot.ini, windows/win.ini and winnt/win.ini.
  It is confirmed when a traversal path answers 213 (size or date of the file)
  while the same command for a random absent directory in front of that file
  is refused and the same file named without ".." is not found, which shows
  that the ".." segments are what reach it. It is also confirmed when MDTM of a
  random absent ../ file is answered by a "no such file" error quoting the
  drive path the server looked up, ".." included ('c:\…\..\name'). When no login is possible, an EFTP
  greeting announcing a version before 2.0.8 is reported with lower
  confidence. Nothing is written and no file content is transferred.
cves: [CVE-2001-1109]
cvss: 7.5  # NVD publishes only a CVSS v2 base score (7.5) for this CVE
severity: high
category: file-read
confidence_base: 0.30
tags: [eftp, ftp, path-traversal, information-disclosure, windows]
services: [ftp]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2001-1109"
  - "https://seclists.org/bugtraq/2001/Sep/135"
  - "https://www.exploit-db.com/exploits/21110"
  - "https://www.securityfocus.com/bid/3333"

steps:
  # Pre-init everything the scripts and conditions read: a failed step stores
  # nothing, and an undefined variable aborts the test.
  - id: init-ftpo
    action: set_var
    var_name: ftpo
    var_value: {banner: "", connected: false}
  - id: init-cpass
    action: set_var
    var_name: cpass
    var_value: {response: ""}
  - id: init-apass
    action: set_var
    var_name: apass
    var_value: {response: ""}

  # ── 1. Greeting gate + login ─────────────────────────────────────────────
  - id: pick-login
    action: script
    code: |
      cred_enabled && is_def_var("cred_username") && is_def_var("cred_password")
    store_as: use_cred

  - id: control-name
    action: script
    code: |
      "noctis" + rand_hex(4)
    store_as: ctl

  - id: open
    action: tcp_open
    handle: ftp
    port: "{{port}}"
    read_banner: true
    timeout_secs: 10
    store_as: ftpo

  - id: product
    action: script
    code: |
      type_of(ftpo.banner) == "string" && ereg("(?m)^220[ -].*\\bEFTP\\b", ftpo.banner)
    store_as: is_eftp

  - id: cred-user
    action: tcp_send
    condition: "is_eftp == true && use_cred == true"
    handle: ftp
    send: "USER {{cred_username}}\r\n"
    store_as: cuser

  - id: cred-pass
    action: tcp_send
    condition: "is_eftp == true && use_cred == true"
    handle: ftp
    send: "PASS {{cred_password}}\r\n"
    store_as: cpass

  - id: cred-state
    action: script
    code: |
      is_eftp && use_cred && type_of(cpass.response) == "string"
        && ereg("(^|\n)230[ -]", cpass.response)
    store_as: cred_ok

  # Credentials refused: anonymous login on a fresh connection.
  - id: reopen-close
    action: tcp_close
    condition: "is_eftp == true && cred_ok == false && use_cred == true"
    handle: ftp

  - id: reopen
    action: tcp_open
    condition: "is_eftp == true && cred_ok == false && use_cred == true"
    handle: ftp
    port: "{{port}}"
    read_banner: true
    timeout_secs: 10
    store_as: ftpo2

  - id: anon-user
    action: tcp_send
    condition: "is_eftp == true && cred_ok == false"
    handle: ftp
    send: "USER anonymous\r\n"
    store_as: auser

  - id: anon-pass
    action: tcp_send
    condition: "is_eftp == true && cred_ok == false"
    handle: ftp
    send: "PASS noctis@example.com\r\n"
    store_as: apass

  - id: logged-in
    action: script
    code: |
      is_eftp && (cred_ok || (type_of(apass.response) == "string"
        && ereg("(^|\n)230[ -]", apass.response)))
    store_as: logged_in

  # ── 2. SIZE / MDTM of each traversal file (loop group) ───────────────────
  # The loop step and the set_var steps after it reset every per-iteration
  # result, so nothing from the previous file is read again.
  - id: reset-tsz
    action: set_var
    loop:
      var: probe
      over:
        - "autoexec.bat"
        - "boot.ini"
        - "windows/win.ini"
        - "winnt/win.ini"
    var_name: tsz
    var_value: {response: ""}
  - id: reset-tmd
    action: set_var
    var_name: tmd
    var_value: {response: ""}
  - id: reset-csz
    action: set_var
    var_name: cres
    var_value: {response: ""}
  - id: reset-bres
    action: set_var
    var_name: bres
    var_value: {response: ""}

  - id: trav-size
    action: tcp_send
    condition: "logged_in == true"
    handle: ftp
    send: "SIZE ../../../../../../{{probe}}\r\n"
    store_as: tsz

  - id: trav-mdtm
    action: tcp_send
    condition: 'logged_in == true && !(type_of(tsz.response) == "string" && ereg("(^|\\n)213 ", tsz.response))'
    handle: ftp
    send: "MDTM ../../../../../../{{probe}}\r\n"
    store_as: tmd

  - id: hit-command
    action: script
    code: |
      if !logged_in { "" }
      else if type_of(tsz.response) == "string" && ereg("(^|\n)213 ", tsz.response) { "SIZE" }
      else if type_of(tmd.response) == "string" && ereg("(^|\n)213 ", tmd.response) { "MDTM" }
      else { "" }
    store_as: hitcmd

  # Absent-file control: a random absent directory in front of the same file.
  - id: control
    action: tcp_send
    condition: 'hitcmd != ""'
    handle: ftp
    send: "{{hitcmd}} ../../../../../../{{ctl}}/{{probe}}\r\n"
    store_as: cres

  # Baseline control: the same file without "..".
  - id: baseline
    action: tcp_send
    condition: 'hitcmd != ""'
    handle: ftp
    send: "{{hitcmd}} {{probe}}\r\n"
    store_as: bres

  - id: verdict
    action: script
    code: |
      if hitcmd == "" { "" } else {
        let hit = if hitcmd == "SIZE" { tsz.response } else { tmd.response };
        let c = if type_of(cres.response) == "string" { cres.response } else { "" };
        let b = if type_of(bres.response) == "string" { bres.response } else { "" };
        let refused = ereg("(^|\n)(45[0-9]|5[0-9][0-9]) ", c) && !ereg("(^|\n)213 ", c);
        let base_found = ereg("(^|\n)213 ", b);
        let base_answered = ereg("(^|\n)[1-5][0-9][0-9] ", b);
        if refused && base_answered && !base_found {
          let m = eregmatch("(?m)^213 [^\r\n]*", hit);
          let line = if m.len() > 0 { m[0] } else { "213" };
          hitcmd + " ../../../../../../" + probe + " -> \"" + line
            + "\"; absent " + ctl + "/" + probe + " refused; " + probe + " without \"..\" not found"
        } else { "" }
      }
    store_as: proof

  - id: traversal-proof
    action: match
    source: proof
    pattern: "^(SIZE|MDTM) "
    on_match:
      stop: true
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "EFTP answered a traversal path outside the FTP home: {{proof}}."
        remediation: "Upgrade EFTP to 2.0.8.348 or later, or replace it with a maintained FTP server, and restrict FTP access to trusted users and networks."

  # ── 3. Error reply quoting the joined drive path (one pass) ──────────────
  - id: reset-pd
    action: set_var
    loop:
      var: once
      count: 1
    var_name: pd
    var_value: {response: ""}

  - id: path-mdtm
    action: tcp_send
    condition: "logged_in == true"
    handle: ftp
    send: "MDTM ../{{ctl}}.txt\r\n"
    store_as: pd

  - id: path-verdict
    action: script
    code: |
      let r = if type_of(pd.response) == "string" { pd.response } else { "" };
      let m = eregmatch("(?im)^(5[0-9][0-9] '[a-z]:\\\\[^'\r\n]*\\.\\.\\\\" + ctl + "\\.txt'\\s*:\\s*no such file[^\r\n]*)", r);
      if logged_in && m.len() > 1 { m[1] } else { "" }
    store_as: pdline

  - id: path-proof
    action: match
    source: pdline
    pattern: "^5[0-9][0-9] '"
    on_match:
      stop: true
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "MDTM ../{{ctl}}.txt (absent) was looked up as a drive path still holding \"..\" (not-found error quoting the joined path): \"{{pdline}}\"."
        remediation: "Upgrade EFTP to 2.0.8.348 or later, or replace it with a maintained FTP server, and restrict FTP access to trusted users and networks."

  - id: quit
    action: tcp_send
    condition: "logged_in == true"
    handle: ftp
    send: "QUIT\r\n"
    store_as: quit

  - id: close
    action: tcp_close
    handle: ftp

  # ── 4. Fallback: greeting version before 2.0.8 ───────────────────────────
  - id: version
    action: script
    code: |
      let g = if type_of(ftpo.banner) == "string" { ftpo.banner } else { "" };
      let m = eregmatch("(?m)^220[ -].*\\bEFTP [Vv]ersion\\s+([0-9]+(?:\\.[0-9]+)*)", g);
      if !is_eftp || m.len() < 2 { "" } else {
        let p = split(m[1], ".");
        let major = int(p[0]);
        let minor = if p.len() > 1 { int(p[1]) } else { 0 };
        let patch = if p.len() > 2 { int(p[2]) } else { 0 };
        if major < 2 || (major == 2 && minor == 0 && patch < 8) { m[1] } else { "" }
      }
    store_as: eftpver

  - id: vulnerable-version
    action: match
    source: eftpver
    pattern: "^[0-9]"
    on_match:
      stop: true
      finding:
        confidence_delta: 0.40
        qod: 70
        evidence: "FTP greeting: EFTP Version {{eftpver}} (before 2.0.8); traversal not confirmed (no usable login or no probed file found)."
        remediation: "Upgrade EFTP to 2.0.8.348 or later, or replace it with a maintained FTP server, and restrict FTP access to trusted users and networks."

View these feeds on GitHub