MERCUR — 1 vulnerability check

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

← All products · Feeds on GitHub

MERCUR Mailserver/Messaging IMAP4 LOGIN buffer overflow (vulnerable version)

CVECVE-2006-1255
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Servicesimap
Detectiontcp_connect, match · highest QoD 70
Feedtests/vulnerabilities/mercur/CVE-2006-1255.yaml

Detects an IMAP4 service from MERCUR Mailserver / MERCUR Messaging 5.0 SP3 or earlier, whose IMAP service has a stack-based buffer overflow: a long argument to the LOGIN command (before authentication) or to SELECT (after authentication) crashes the service and can let an unauthenticated attacker run code. The feed connects to the IMAP port, reads the greeting and reports when it names the MERCUR IMAP4-Server with a version up to v5.00. No command is sent and the service is not disturbed. All 5.0 service packs announce the same v5.00 version, so a fixed 5.0 service pack is reported as well.

How noctis detects it

  1. TCP connect and banner grab
  2. Checks imap.banner for MERCUR[^\r\n]*IMAP4.Server[^\r\n]*\(v(?:[0-4]\.\d{1,2}|5\.00)\b → finding QoD 70: MERCUR IMAP4 service vulnerable to LOGIN buffer overflow

References:

Feed source — tests/vulnerabilities/mercur/CVE-2006-1255.yaml
# MERCUR Mailserver / Messaging IMAP4 service — pre-authentication stack
# overflow in LOGIN (and post-authentication in SELECT), CVE-2006-1255.
#
# Credit: detection logic adapted from Greenbone's
# `2008/mercur_imap_buffer_overflow.nasl` (GPL-2.0-only). That check either
# matches the IMAP greeting for "MERCUR … IMAP4-Server … (v4.03|v5.00)" (safe
# checks), or sends "a0 LOGIN " + 300 x "A" and reports when a second
# connection gets no CAPABILITY reply. The crash probe is a denial of service
# (the IMAP service stays down until restarted by hand) and is NOT ported.
#
# Why no exploit proof: the bug is a stack overflow whose only observable,
# non-destructive outcome would be the service dying. There is no benign
# in-band or OOB proof, so this is a version check (QoD 70), which the project
# accepts when no better method exists.
#
# Improvements over the source check:
#   - NVD lists "MERCUR Messaging 5.0 SP3 and earlier"; the source check only
#     accepts v4.03 and v5.00 and so misses every other 4.x release (e.g. 4.02,
#     also vulnerable — the same LOGIN overflow was reported for 4.2) and older
#     builds. This feed flags every release up to v5.00.
#   - the version must sit in the "(vX.YY" product token of the greeting, so a
#     "v5.001"-style build or a version string elsewhere in a custom greeting
#     cannot match by accident.
# Limitation: MERCUR 5.0 service packs all announce "v5.00.<build>", and the
# build that fixes the bug is not documented, so a fixed 5.0 SP is reported too
# (same behaviour as the source check). Remediation: upgrade past 5.0.
#
# Greeting shape (nmap-service-probes): "* OK MERCUR IMAP4-Server (v4.03.12 MT) for Windows ready"
uid: 9b0d0920-6e2d-4330-80a8-8d699ac77372
name: "MERCUR Mailserver/Messaging IMAP4 LOGIN buffer overflow (vulnerable version)"
description: |
  Detects an IMAP4 service from MERCUR Mailserver / MERCUR Messaging 5.0 SP3
  or earlier, whose IMAP service has a stack-based buffer overflow: a long
  argument to the LOGIN command (before authentication) or to SELECT (after
  authentication) crashes the service and can let an unauthenticated attacker
  run code. The feed connects to the IMAP port, reads the greeting and reports
  when it names the MERCUR IMAP4-Server with a version up to v5.00. No command
  is sent and the service is not disturbed. All 5.0 service packs announce the
  same v5.00 version, so a fixed 5.0 service pack is reported as well.
category: rce
cves: [CVE-2006-1255]
cvss: 10.0
severity: critical
confidence_base: 0.30
tags: [mercur, atrium, imap, mail, buffer-overflow, stack-overflow, version-check]
services: [imap]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2006-1255"
  - "http://seclists.org/fulldisclosure/2006/Mar/1111"
  - "http://www.securityfocus.com/bid/17138"
  - "http://secunia.com/advisories/19267"

steps:
  # Read the greeting only — nothing is sent.
  - id: greeting
    action: tcp_connect
    port: "{{port}}"
    timeout_secs: 10
    store_as: imap

  # "(v4.03.12 MT)", "(v5.00.14 Win32)", "(v4.02 …)": any 0.x–4.x release, or
  # 5.00 (5.0 up to SP3). "\b" after 5.00 rejects "v5.001"; 5.01+ is not matched.
  - id: vulnerable-version
    action: match
    condition: "imap.connected == true"
    source: imap.banner
    pattern: 'MERCUR[^\r\n]*IMAP4.Server[^\r\n]*\(v(?:[0-4]\.\d{1,2}|5\.00)\b'
    on_match:
      finding:
        title: "MERCUR IMAP4 service vulnerable to LOGIN buffer overflow"
        description: "The IMAP greeting names a MERCUR IMAP4-Server version up to v5.00 (MERCUR Messaging 5.0 SP3 or earlier), whose LOGIN and SELECT commands have a stack-based buffer overflow that allows denial of service and possibly remote code execution."
        remediation: "Upgrade MERCUR Messaging to a release later than 5.0 SP3, or block access to the IMAP port from untrusted networks."
        confidence_delta: 0.45
        qod: 70
        evidence: "IMAP greeting: {{imap.banner}}"

View these feeds on GitHub