httpdx — 3 vulnerability checks

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

← All products · Feeds on GitHub

httpdx < 1.4.4 h_handlepeer() Remote Buffer Overflow

CVECVE-2009-3711
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 70
Feedtests/vulnerabilities/httpdx/CVE-2009-3711.yaml

httpdx (a small Win32 web/FTP server) up to 1.4.3 overflows a stack buffer in h_handlepeer() (http.cpp) when it parses an overly long request URI, which lets a remote unauthenticated attacker run code (Metasploit exploit/windows/http/httpdx_handlepeer, EDB-9886 / EDB-16799). Fixed in 1.4.4.

This is a version check, on purpose: the only way to trigger the bug is the overflow itself, which crashes the httpdx process (or runs shellcode), so there is no benign exploitation proof and a destructive probe is never sent. The feed reads the HTTP `Server:` header of one GET / (`httpdx/<version> (Win32)`, the fingerprint the Metasploit `check` also uses) and compares the version numerically (1.4 / 1.4.3 / 0.5b flagged, 1.4.4 and 1.5.x not). It is passive and not tagged `intrusive`; `category: rce` classifies the bug so operators filtering RCE issues see it.

How noctis detects it

  1. HTTP(S) request GET /
  2. Parses / computes the next value with a Rhai script
  3. Checks ver.version for ^[0-9] → finding QoD 70: Server header '…': httpdx … is below the fixed release 1.4.4 (h_handlepeer() stack overflow on a long request URI; not triggered, it would …

References:

Feed source — tests/vulnerabilities/httpdx/CVE-2009-3711.yaml
uid: b4301b1b-06a4-4dec-b130-8d093b5ff28f
name: "httpdx < 1.4.4 h_handlepeer() Remote Buffer Overflow (CVE-2009-3711)"
description: |
  httpdx (a small Win32 web/FTP server) up to 1.4.3 overflows a stack buffer in
  h_handlepeer() (http.cpp) when it parses an overly long request URI, which lets a
  remote unauthenticated attacker run code (Metasploit exploit/windows/http/httpdx_handlepeer,
  EDB-9886 / EDB-16799). Fixed in 1.4.4.

  This is a version check, on purpose: the only way to trigger the bug is the
  overflow itself, which crashes the httpdx process (or runs shellcode), so there is
  no benign exploitation proof and a destructive probe is never sent. The feed reads
  the HTTP `Server:` header of one GET / (`httpdx/<version> (Win32)`, the fingerprint
  the Metasploit `check` also uses) and compares the version numerically (1.4 / 1.4.3
  / 0.5b flagged, 1.4.4 and 1.5.x not). It is passive and not tagged `intrusive`;
  `category: rce` classifies the bug so operators filtering RCE issues see it.
cves: [CVE-2009-3711]
cvss: 10.0
severity: critical
confidence_base: 0.30
category: rce
tags: [httpdx, buffer-overflow, stack-overflow, windows, version-check, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-3711"
  - "https://www.exploit-db.com/exploits/9886"
  - "https://www.exploit-db.com/exploits/16799"
  - "https://www.rapid7.com/db/modules/exploit/windows/http/httpdx_handlepeer/"

steps:
  # Pre-initialise everything a later script or condition reads, so a failed
  # request never leaves an undefined variable (that would abort the test).
  - id: init_root
    action: set_var
    var_name: root
    var_value: {status: 0, body: "", headers: {}}

  - id: init_ver
    action: set_var
    var_name: ver
    var_value: {vulnerable: false, version: "", server: ""}

  - id: root
    action: http_request
    method: GET
    path: "/"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    store_as: root

  # Server: httpdx/1.4 (Win32) — compare the dotted version with 1.4.4, part by part.
  # A trailing letter (0.5b) is dropped from each part.
  - id: version
    action: script
    store_as: ver
    code: |
      let server = if "server" in root.headers { root.headers["server"] } else { "" };
      if type_of(server) != "string" { server = ""; }
      let m = eregmatch("httpdx/([0-9]+(\\.[0-9]+[a-z]?)*[a-z]?)", server, true);
      if m.len() < 2 {
        #{ vulnerable: false, version: "", server: server }
      } else {
        let parts = split(m[1], ".");
        let fixed = [1, 4, 4];
        let vuln = false;
        let decided = false;
        for i in 0..3 {
          if !decided {
            let p = if i < parts.len() { ereg_replace("[^0-9]", "", parts[i]) } else { "0" };
            let n = if p == "" { 0 } else { int(p) };
            if n < fixed[i] { vuln = true; decided = true; }
            else if n > fixed[i] { decided = true; }
          }
        }
        #{ vulnerable: vuln, version: m[1], server: server }
      }

  - id: vulnerable_version
    action: match
    source: ver.version
    pattern: "^[0-9]"
    condition: "ver.vulnerable == true"
    on_match:
      stop: true
      finding:
        confidence_delta: 0.45
        qod: 70
        evidence: "Server header '{{ver.server}}': httpdx {{ver.version}} is below the fixed release 1.4.4 (h_handlepeer() stack overflow on a long request URI; not triggered, it would crash the server)."

httpdx tolog() Format String Remote Code Execution

CVECVE-2009-4769
Severitycritical · CVSS 9.3
Categoryrce — Remote code execution
Serviceshttp, https, ftp
Detectionset_var, http_request, tcp_dialogue, script, match · highest QoD 70
Feedtests/vulnerabilities/httpdx/CVE-2009-4769.yaml

httpdx 1.4 to 1.5 (a small Win32 web and FTP server) passes request data as the format string of its tolog() logging function: a GET request to the HTTP server when logging is on, or a PWD command from a logged-in FTP user, lets a remote attacker write memory and run code. The check reads the httpdx version from the HTTP `Server:` header of a GET / (`httpdx/<version> (Win32)`) or, on an FTP port, from the greeting (`220 httpdx/<version> (Win32)`) and flags versions from 1.4 up to 1.5 (1.4, 1.4.x, 1.4.6b, 1.5). It is a version check: the flaw is only triggered by a memory write, so no exploit is sent.

How noctis detects it

  1. HTTP(S) request GET /
  2. TCP dialogue: QUIT
  3. Parses / computes the next value with a Rhai script
  4. Checks ver.version for ^[0-9] → finding QoD 70: …: httpdx … is in the affected range 1.4 - 1.5 (tolog() format string; not triggered, it would write server memory).

References:

Feed source — tests/vulnerabilities/httpdx/CVE-2009-4769.yaml
# httpdx tolog() format string (CVE-2009-4769). Covers part of backlog issue
# #1191 (httpdx multiple vulnerabilities, CVE-2009-4769 / CVE-2009-4770).
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_httpdx_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801236, GPL-2.0-only): report httpdx 1.4 - 1.5
# from the HTTP Server header version.
#
# Deviations from the NASL (stated in the PR):
#   * The FTP greeting ("220 httpdx/<version> (Win32)", the fingerprint of the
#     Metasploit httpdx_tolog_format FTP module) is read too, so an httpdx whose
#     FTP component is the only one exposed is still found — the FTP PWD vector
#     is half of this CVE.
#   * The default moderator / pass123 login (CVE-2009-4770) is proven by its
#     own feed, CVE-2009-4770.yaml, instead of being inferred from the version.
#
# Version check on purpose: the only trigger is a format string written to the
# server's log, which corrupts memory (Metasploit turns it into code execution)
# and is never reflected back, so there is no benign proof. Nothing but a
# GET / and an FTP greeting read is sent. Not tagged intrusive.
uid: 0ccf37b8-0d35-43b0-9885-79c71eadc54a
name: "httpdx tolog() Format String Remote Code Execution (CVE-2009-4769)"
description: |
  httpdx 1.4 to 1.5 (a small Win32 web and FTP server) passes request data as
  the format string of its tolog() logging function: a GET request to the HTTP
  server when logging is on, or a PWD command from a logged-in FTP user, lets a
  remote attacker write memory and run code. The check reads the httpdx version
  from the HTTP `Server:` header of a GET / (`httpdx/<version> (Win32)`) or,
  on an FTP port, from the greeting (`220 httpdx/<version> (Win32)`) and flags
  versions from 1.4 up to 1.5 (1.4, 1.4.x, 1.4.6b, 1.5). It is a version check:
  the flaw is only triggered by a memory write, so no exploit is sent.
cves: [CVE-2009-4769]
cvss: 9.3
severity: critical
confidence_base: 0.30
category: rce
tags: [httpdx, format-string, windows, ftp, version-check, unauthenticated]
services: [http, https, ftp]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4769"
  - "https://www.rapid7.com/db/modules/exploit/windows/http/httpdx_tolog_format/"
  - "https://www.rapid7.com/db/modules/exploit/windows/ftp/httpdx_tolog_format/"
  - "OpenVAS/Greenbone NASL 2010/gb_httpdx_mult_vuln.nasl (GPL-2.0-only)"

steps:
  # Pre-initialise everything a later script or condition reads, so a failed
  # request never leaves an undefined variable (that would abort the test).
  - id: init_root
    action: set_var
    var_name: root
    var_value: {status: 0, body: "", headers: {}}

  - id: init_greet
    action: set_var
    var_name: greet
    var_value: {transcript: ""}

  - id: init_ver
    action: set_var
    var_name: ver
    var_value: {vulnerable: false, version: "", source: ""}

  - id: root
    action: http_request
    method: GET
    path: "/"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    store_as: root

  # No HTTP answer: maybe the FTP component. Read its greeting (QUIT's read
  # also catches a late greeting).
  - id: ftp_greeting
    action: tcp_dialogue
    port: "{{port}}"
    condition: "root.status == 0"
    read_banner: true
    timeout_secs: 10
    commands:
      - "QUIT"
    store_as: greet

  # httpdx/1.4.6b (Win32) — vulnerable when 1.4 <= version <= 1.5, compared
  # part by part; a trailing letter (1.4.6b) is dropped from each part.
  - id: version
    action: script
    store_as: ver
    code: |
      let src = "";
      let server = if "server" in root.headers { root.headers["server"] } else { "" };
      if type_of(server) != "string" { server = ""; }
      let m = eregmatch("httpdx/([0-9]+(\\.[0-9]+[a-z]?)*[a-z]?)", server, true);
      if m.len() >= 2 {
        src = "HTTP Server header '" + server + "'";
      } else {
        let t = greet.transcript;
        if type_of(t) != "string" { t = ""; }
        m = eregmatch("(?m)^220[ -]httpdx/([0-9]+(\\.[0-9]+[a-z]?)*[a-z]?)", t, true);
        if m.len() >= 2 { src = "FTP greeting '220 httpdx/" + m[1] + "'"; }
      }
      if m.len() < 2 {
        #{ vulnerable: false, version: "", source: "" }
      } else {
        let parts = split(m[1], ".");
        let n = [];
        for i in 0..3 {
          let p = if i < parts.len() { ereg_replace("[^0-9]", "", parts[i]) } else { "0" };
          n.push(if p == "" { 0 } else { int(p) });
        }
        let v = n[0] * 1000000 + n[1] * 1000 + n[2];
        #{ vulnerable: v >= 1004000 && v <= 1005000, version: m[1], source: src }
      }

  - id: vulnerable_version
    action: match
    source: ver.version
    pattern: "^[0-9]"
    condition: "ver.vulnerable == true"
    on_match:
      stop: true
      finding:
        confidence_delta: 0.45
        qod: 70
        evidence: "{{ver.source}}: httpdx {{ver.version}} is in the affected range 1.4 - 1.5 (tolog() format string; not triggered, it would write server memory)."

httpdx FTP Server Default moderator Account

CVECVE-2009-4770
Severityhigh · CVSS 7.5
Categorydefault-credentials — Default credentials
Servicesftp
Detectionset_var, tcp_dialogue, script, match · highest QoD 97
Feedtests/vulnerabilities/httpdx/CVE-2009-4770.yaml

The FTP server built into httpdx 1.4 to 1.5 ships a "moderator" account with the password "pass123". On an FTP service whose greeting names httpdx ("220 httpdx/<version> (Win32)"), the check logs in as moderator / pass123 and sends only the read-only SYST and NOOP commands before QUIT. It is confirmed when the login is accepted (230) and a second login as moderator with a random password is rejected (530). When that second login cannot run, the login is reported with lower confidence; when the random password is accepted as well, nothing is reported. The account gives FTP access to the server's files, and logging is enabled for it by default, which exposes the authenticated format-string flaw of the FTP log function (CVE-2009-4769).

How noctis detects it

  1. TCP dialogue: QUIT
  2. Parses / computes the next value with a Rhai script
  3. Parses / computes the next value with a Rhai script
  4. TCP dialogue: USER moderator, PASS pass123, SYST, NOOP (+1 more)
  5. Parses / computes the next value with a Rhai script
  6. Parses / computes the next value with a Rhai script
  7. TCP dialogue: USER moderator, PASS {{ctl_pw}}, SYST, NOOP (+1 more)
  8. Parses / computes the next value with a Rhai script
  9. Checks ftp_ver for . → finding QoD 97: httpdx … FTP server accepted the default login moderator:pass123 (230). A login as moderator with a random password was rejected (530).
  10. Checks ftp_ver for . → finding QoD 75: httpdx … FTP server accepted the default login moderator:pass123 (230). The random-password control login could not be completed, so an acc…

References:

Feed source — tests/vulnerabilities/httpdx/CVE-2009-4770.yaml
# httpdx FTP server — default "moderator" account with password "pass123"
# (CVE-2009-4770). Covers part of backlog issue #1191 (httpdx multiple
# vulnerabilities, CVE-2009-4769 / CVE-2009-4770).
#
# The source check (OpenVAS/Greenbone NVT 2010/gb_httpdx_mult_vuln.nasl,
# OID 1.3.6.1.4.1.25623.1.0.801236, GPL-2.0-only) only compares the HTTP
# version (1.4 - 1.5) for both CVEs. This feed proves CVE-2009-4770 instead:
#   * Greeting gate: "220 httpdx/<version> (Win32)" — the FTP banner the
#     Metasploit httpdx_tolog_format FTP module fingerprints.
#   * Logs in as moderator / pass123 (the module's default FTPUSER / FTPPASS)
#     and sends only the read-only SYST, NOOP and QUIT commands.
#   * Accept-any-password control (fail-closed): the same user logs in again
#     with a random password. QoD 97 needs a clean 530 rejection; when the
#     control cannot run the login is kept at QoD 75; when the random password
#     is accepted too, nothing is reported.
# The moderator account has FTP logging on by default, which is the
# authenticated tolog() format-string vector of CVE-2009-4769 (PWD command);
# that write primitive is never sent. The version side of CVE-2009-4769 is
# covered by CVE-2009-4769.yaml.
uid: 8cef5222-8060-48ca-b9e5-2d02e52449bd
name: "httpdx FTP Server Default moderator Account (CVE-2009-4770)"
description: |
  The FTP server built into httpdx 1.4 to 1.5 ships a "moderator" account with
  the password "pass123". On an FTP service whose greeting names httpdx
  ("220 httpdx/<version> (Win32)"), the check logs in as moderator / pass123
  and sends only the read-only SYST and NOOP commands before QUIT. It is
  confirmed when the login is accepted (230) and a second login as moderator
  with a random password is rejected (530). When that second login cannot run,
  the login is reported with lower confidence; when the random password is
  accepted as well, nothing is reported. The account gives FTP access to the
  server's files, and logging is enabled for it by default, which exposes the
  authenticated format-string flaw of the FTP log function (CVE-2009-4769).
cves: [CVE-2009-4770]
cvss: 7.5
severity: high
category: default-credentials
confidence_base: 0.30
tags: [httpdx, ftp, default-credentials, windows, unauthenticated]
services: [ftp]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4770"
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4769"
  - "https://www.rapid7.com/db/modules/exploit/windows/ftp/httpdx_tolog_format/"
  - "OpenVAS/Greenbone NASL 2010/gb_httpdx_mult_vuln.nasl (GPL-2.0-only)"

steps:
  # Pre-init everything the scripts and conditions read.
  - id: init-gate
    action: set_var
    var_name: gate
    var_value: false
  - id: init-greet
    action: set_var
    var_name: greet
    var_value: {transcript: ""}
  - id: init-login
    action: set_var
    var_name: login
    var_value: {transcript: ""}
  - id: init-ctl
    action: set_var
    var_name: ctl
    var_value: {transcript: "", responses: []}
  - id: init-hit
    action: set_var
    var_name: hit
    var_value: false
  - id: init-ctl-state
    action: set_var
    var_name: ctl_state
    var_value: "none"
  - id: init-ver
    action: set_var
    var_name: ftp_ver
    var_value: ""

  # 1. Greeting gate. QUIT's reply read also catches a greeting that missed
  #    the first read window.
  - id: greeting
    action: tcp_dialogue
    port: "{{port}}"
    read_banner: true
    timeout_secs: 10
    commands:
      - "QUIT"
    store_as: greet
  - id: gate-check
    action: script
    store_as: gate
    code: |
      let t = greet.transcript;
      type_of(t) == "string" && ereg("(?m)^220[ -]httpdx/", t)
  - id: gate-version
    action: script
    store_as: ftp_ver
    condition: "gate == true"
    code: |
      let m = eregmatch("(?m)^220[ -]httpdx/([^ \r\n]+)", greet.transcript);
      if m.len() > 1 { m[1] } else { "?" }

  # 2. Default account login.
  - id: login
    action: tcp_dialogue
    port: "{{port}}"
    condition: "gate == true"
    read_banner: true
    timeout_secs: 10
    commands:
      - "USER moderator"
      - "PASS pass123"
      - "SYST"
      - "NOOP"
      - "QUIT"
    store_as: login
  - id: login-check
    action: script
    store_as: hit
    condition: "gate == true"
    code: |
      let t = login.transcript;
      type_of(t) == "string" && ereg("(?m)^230[ -]", t)

  # 3. Control — same user, random password.
  - id: ctl-password
    action: script
    store_as: ctl_pw
    condition: "hit == true"
    code: |
      "noctis" + rand_str(14)
  - id: ctl-login
    action: tcp_dialogue
    port: "{{port}}"
    condition: "hit == true"
    read_banner: true
    timeout_secs: 10
    commands:
      - "USER moderator"
      - "PASS {{ctl_pw}}"
      - "SYST"
      - "NOOP"
      - "QUIT"
    store_as: ctl
  # "rejected" only on a clean refusal: greeting seen, no 230, and the reply
  # to PASS itself is 530 (SYST after a failed login also answers 530, so the
  # transcript alone would count a 421/503 PASS reply as a rejection).
  # A 230 anywhere means the random password was accepted. Else = unknown.
  - id: ctl-check
    action: script
    store_as: ctl_state
    condition: "hit == true"
    code: |
      let t = ctl.transcript;
      let r = ctl.responses;
      let pass_reply = "";
      if type_of(r) == "array" && r.len() > 1 && type_of(r[1]) == "string" { pass_reply = r[1]; }
      if type_of(t) != "string" {
        "unknown"
      } else if ereg("(?m)^230[ -]", t) {
        "accepted"
      } else if ereg("(?m)^220[ -]", t) && ereg("^530[ -]", pass_reply) {
        "rejected"
      } else {
        "unknown"
      }

  # 4. Findings.
  - id: report-confirmed
    action: match
    source: ftp_ver
    pattern: '.'
    condition: "hit == true && ctl_state == \"rejected\""
    on_match:
      finding:
        confidence_delta: 0.65
        qod: 97
        evidence: "httpdx {{ftp_ver}} FTP server accepted the default login moderator:pass123 (230). A login as moderator with a random password was rejected (530)."
  - id: report-unconfirmed-control
    action: match
    source: ftp_ver
    pattern: '.'
    condition: "hit == true && ctl_state == \"unknown\""
    on_match:
      finding:
        confidence_delta: 0.45
        qod: 75
        evidence: "httpdx {{ftp_ver}} FTP server accepted the default login moderator:pass123 (230). The random-password control login could not be completed, so an accept-any FTP server is not ruled out."

View these feeds on GitHub