Microsoft Exchange — 3 vulnerability checks
noctis ships 3 vulnerability checks for Microsoft Exchange, covering 3 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Microsoft Exchange ProxyLogon SSRF
| CVE | CVE-2021-26855 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | ssrf — SSRF |
| Services | http, https |
| Detection | http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/exchange/CVE-2021-26855.yaml |
Tests Exchange Server for the ProxyLogon SSRF vulnerability by sending crafted cookies that trigger backend routing. Vulnerable servers expose internal routing headers (X-CalculatedBETarget, X-FEServer) in the response.
How noctis detects it
- HTTP(S) request
GET /owa/auth/logon.aspx - Checks
owa_resp.bodyfor(Outlook Web App|OWA|Exchange Server|Microsoft.Exchange) - HTTP(S) request
GET /owa/auth/x.js - Checks
ssrf_resp.headersfor(?i)"x-calculatedbetarget":"[^"]+"→ finding QoD 75: ProxyLogon SSRF — X-CalculatedBETarget exposed: … - Checks
ssrf_resp.headersfor(?i)"x-feserver":"[^"]+"→ finding QoD 75: ProxyLogon SSRF — X-FEServer internal hostname exposed: … - HTTP(S) request
GET /ecp/default.aspx - Checks
ecp_resp.bodyfor(Exchange Control Panel|ECP|msExchEcpCanary)→ finding QoD 97: ProxyLogon confirmed — ECP accessible without auth: …
References:
- https://nvd.nist.gov/vuln/detail/CVE-2021-26855
- https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-26855
- https://www.microsoft.com/en-us/security/blog/2021/03/02/hafnium-targeting-exchange-servers/
Feed source — tests/vulnerabilities/exchange/CVE-2021-26855.yaml
# Microsoft Exchange ProxyLogon SSRF — CVE-2021-26855
#
# Exchange Server 2013/2016/2019 (pre-March 2021) accepts an
# X-AnonResource-Backend cookie that forces the frontend to proxy the
# request to an arbitrary backend without authentication checks.
# This pre-auth SSRF allows access to any mailbox and, chained with
# CVE-2021-27065, enables writing a webshell (ProxyLogon chain).
#
# Vulnerability indicators:
# - X-CalculatedBETarget header present in the response
# - X-FEServer header leaks the internal server name
# - SSRF cookie is not rejected (no 400)
uid: 2a7f4e8b-1c3d-4a6f-9b5e-7d0c3f2a1e8b
name: "Microsoft Exchange ProxyLogon SSRF (CVE-2021-26855)"
description: |
Tests Exchange Server for the ProxyLogon SSRF vulnerability by sending
crafted cookies that trigger backend routing. Vulnerable servers expose
internal routing headers (X-CalculatedBETarget, X-FEServer) in the response.
cves: [CVE-2021-26855]
cvss: 9.8
severity: critical
category: ssrf
confidence_base: 0.20
tags: [exchange, microsoft, ssrf, email, proxylogon]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2021-26855"
- "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-26855"
- "https://www.microsoft.com/en-us/security/blog/2021/03/02/hafnium-targeting-exchange-servers/"
steps:
# ── Exchange service detection ────────────────────────────────────────────
- id: exchange-detect
action: http_request
method: GET
path: "/owa/auth/logon.aspx"
port: "{{port}}"
tls_insecure: true
follow_redirects: true
timeout_secs: 10
store_as: owa_resp
- id: exchange-banner
action: match
source: owa_resp.body
pattern: "(Outlook Web App|OWA|Exchange Server|Microsoft.Exchange)"
case_insensitive: true
on_match:
set_vars:
is_exchange: true
# ── SSRF probe with X-AnonResource-Backend cookie ────────────────────────
- id: ssrf-probe
action: http_request
method: GET
path: "/owa/auth/x.js"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
headers:
Cookie: >-
X-AnonResource=true;
X-AnonResource-Backend=localhost/ecp/default.flt?~3;
X-BEResource=localhost/owa/auth/logon.aspx?~3;
store_as: ssrf_resp
condition: "is_exchange == true"
# X-CalculatedBETarget header leaks internal routing.
# Headers are serialized as JSON ("key":"value") — match that format.
- id: ssrf-header-match
action: match
source: ssrf_resp.headers
pattern: "(?i)\"x-calculatedbetarget\":\"[^\"]+\""
condition: "is_exchange == true"
on_match:
finding:
confidence_delta: 0.55
qod: 75
evidence: "ProxyLogon SSRF — X-CalculatedBETarget exposed: {{ssrf_resp.headers}}"
set_vars:
proxylogon_ssrf: true
# X-FEServer leaks the internal frontend server name
- id: ssrf-feserver-match
action: match
source: ssrf_resp.headers
pattern: "(?i)\"x-feserver\":\"[^\"]+\""
condition: "is_exchange == true"
on_match:
finding:
confidence_delta: 0.50
qod: 75
evidence: "ProxyLogon SSRF — X-FEServer internal hostname exposed: {{ssrf_resp.headers}}"
set_vars:
proxylogon_ssrf: true
# ── ECP endpoint probe (unauthenticated access) ───────────────────────────
# The ECP (Exchange Control Panel) is normally auth-protected.
# If reachable via the SSRF cookie, the vulnerability is confirmed.
- id: ecp-probe
action: http_request
method: GET
path: "/ecp/default.aspx"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
headers:
Cookie: >-
X-AnonResource=true;
X-AnonResource-Backend=localhost/ecp/default.flt?~3;
X-BEResource=localhost/ecp/default.aspx?~3;
msExchEcpCanary: "noctis-probe"
store_as: ecp_resp
condition: "proxylogon_ssrf == true"
- id: ecp-access-match
action: match
source: ecp_resp.body
pattern: "(Exchange Control Panel|ECP|msExchEcpCanary)"
case_insensitive: true
condition: "proxylogon_ssrf == true"
on_match:
finding:
confidence_delta: 0.75
qod: 97
evidence: "ProxyLogon confirmed — ECP accessible without auth: {{ecp_resp.body}}"
stop: trueMicrosoft Exchange ProxyShell pre-auth path confusion
| CVE | CVE-2021-34473 |
|---|---|
| Severity | critical · CVSS 9.1 |
| Category | auth-bypass — Auth bypass |
| Services | http, https |
| Detection | script, set_var, tcp_connect, match · highest QoD 75 |
| Feed | tests/vulnerabilities/exchange/CVE-2021-34473.yaml |
Detects the CVE-2021-34473 Autodiscover path-confusion / pre-auth SSRF that is the entry point of the ProxyShell chain. A per-run marker is sent through the "@"-confused Autodiscover URL; a vulnerable frontend fails open to the backend and reflects the marker, while a control request on the normal path does not. Fully inert — no exploitation of the downstream chain.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /autodiscover/autodiscover.json?@noctis.local&Email=autodiscover/autodiscover.json%3F… - Raw TCP (TLS on HTTPS), sent verbatim:
GET /autodiscover/autodiscover.json?Email={{marker}} HTTP/1.0 - Parses / computes the next value with a Rhai script
- Checks
conf.bannerforNOCTIS[0-9a-f]{32}→ finding QoD 75: ProxyShell pre-auth path confusion (CVE-2021-34473): per-run marker … reflected through the '@'-confused Autodiscover backend but absent on…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2021-34473
- https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-34473
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2021/CVE-2021-34473.yaml
Feed source — tests/vulnerabilities/exchange/CVE-2021-34473.yaml
# Microsoft Exchange ProxyShell pre-auth path confusion — CVE-2021-34473
#
# CVE-2021-34473 is the entry point of the ProxyShell chain: the Exchange
# frontend (Client Access Services) mishandles the Autodiscover URL when it
# carries an embedded "@" and a trailing "?@" suffix, e.g.
# /autodiscover/autodiscover.json?@<host>&Email=autodiscover/autodiscover.json%3F@<x>
# The explicit "Email" suffix makes the frontend strip the real path and route
# the request to a backend endpoint that should require authentication, so the
# request "fails open" — the classic pre-auth SSRF / path-confusion primitive
# that the rest of the chain (CVE-2021-34523, CVE-2021-31207) builds RCE on.
#
# Detection is inert and does NOT exploit the chain — no PowerShell, no mailbox
# export, no file write. It is a per-run reflection differential:
# 1. mint a per-run marker NOCTIS<32-hex> (fresh every scan)
# 2. send the path-confusion request carrying that marker — a vulnerable
# frontend fails open to the backend and echoes the marker back
# 3. send a CONTROL request on the normal (non-confused) Autodiscover path
# carrying the same marker — a server that is actually confused by the "@"
# suffix must NOT echo it here
# A finding fires only when the marker is reflected on the confusion path AND
# absent from the control path, which rules out a static banner, a constant
# marker, or a page that echoes every input.
#
# The "@" / "%3F" payload is URL-encoded in the request target, so reqwest would
# normalise it away — the probes use tcp_connect with verbatim HTTP/1.0 and read
# resp.banner (never resp.data).
uid: d6717b0b-e971-4b65-a69e-51b9b64d6baf
name: "Microsoft Exchange ProxyShell pre-auth path confusion (CVE-2021-34473)"
description: |
Detects the CVE-2021-34473 Autodiscover path-confusion / pre-auth SSRF that is
the entry point of the ProxyShell chain. A per-run marker is sent through the
"@"-confused Autodiscover URL; a vulnerable frontend fails open to the backend
and reflects the marker, while a control request on the normal path does not.
Fully inert — no exploitation of the downstream chain.
cves: [CVE-2021-34473]
cvss: 9.1
severity: critical
confidence_base: 0.25
category: auth-bypass
tags: [exchange, microsoft, proxyshell, ssrf, auth-bypass, path-confusion]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2021-34473"
- "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-34473"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2021/CVE-2021-34473.yaml"
steps:
# ── Mint a fresh per-run marker: NOCTIS followed by 32 hex chars ──────────
- id: mint-marker
action: script
code: |
"NOCTIS" + rand_hex(16)
store_as: marker
# Initialise the gate var referenced in the final match condition.
- id: init-gate
action: set_var
var_name: gate_ok
var_value: false
# ── Path-confusion probe ─────────────────────────────────────────────────
# The embedded "@" plus the "Email=autodiscover/autodiscover.json%3F@" suffix
# is the ProxyShell path confusion. %3F and the raw "@" must survive verbatim,
# so tcp_connect (not http_request) is required. The per-run marker rides in
# the Email value; a vulnerable frontend fails open and echoes it back.
- id: confusion-probe
action: tcp_connect
port: "{{port}}"
send: "GET /autodiscover/autodiscover.json?@noctis.local&Email=autodiscover/autodiscover.json%3F@{{marker}} HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
timeout_secs: 10
store_as: conf
# ── Control probe ────────────────────────────────────────────────────────
# Same marker, but the normal Autodiscover path with NO "@" confusion. A
# genuinely path-confused server must NOT reflect the marker here; a page that
# simply echoes every input WILL, and is thereby excluded by the gate.
- id: control-probe
action: tcp_connect
port: "{{port}}"
send: "GET /autodiscover/autodiscover.json?Email={{marker}} HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
timeout_secs: 10
store_as: ctrl
# ── Differential gate ────────────────────────────────────────────────────
# confusion 2xx AND marker reflected on confusion AND marker absent on control.
# Null banners are coerced to "" so stridx never throws.
- id: differential-gate
action: script
store_as: gate_ok
code: |
let cb = if type_of(conf.banner) == "string" { conf.banner } else { "" };
let xb = if type_of(ctrl.banner) == "string" { ctrl.banner } else { "" };
let ok_status = ereg("^HTTP/1\\.[01] 200", cb);
let reflected = stridx(cb, marker) >= 0;
let control_clean = stridx(xb, marker) < 0;
ok_status && reflected && control_clean
# ── Finding ──────────────────────────────────────────────────────────────
# The regex confirms the reflected value is a well-formed per-run marker; the
# gate confirms the reflection is specific to the confused path.
- id: confirm-path-confusion
action: match
source: conf.banner
pattern: "NOCTIS[0-9a-f]{32}"
condition: "gate_ok == true"
on_match:
finding:
confidence_delta: 0.55
qod: 75
evidence: "ProxyShell pre-auth path confusion (CVE-2021-34473): per-run marker {{marker}} reflected through the '@'-confused Autodiscover backend but absent on the control path"
stop: trueMicrosoft Exchange XEXCH50 unauthenticated heap overflow (CVE-2003-0714, MS03-046)
| CVE | CVE-2003-0714 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | smtp |
| Detection | tcp_open, tcp_send, set_var, tcp_close, match · highest QoD 75 |
| Feed | tests/vulnerabilities/exchange/CVE-2003-0714.yaml |
Checks whether a Microsoft Exchange SMTP service accepts the XEXCH50 command from an unauthenticated client. Exchange 5.5 and 2000 without MS03-046 process the binary data announced by XEXCH50 before any authentication, and a crafted length crashes the service or overflows its heap. The test checks that EHLO advertises XEXCH50, opens a mail transaction to postmaster and announces a two-byte blob with "XEXCH50 2 2". A vulnerable server answers "354 Send binary data"; a patched one requires authentication first. The connection is closed before any data is sent, so nothing reaches the vulnerable parser.
How noctis detects it
- Opens a persistent TCP/TLS socket
- Sends
EHLO noctis.teston the open socket - Sends
MAIL FROM:<noctis@noctis.test>on the open socket - Sends
RCPT TO:<postmaster>on the open socket - Sends
XEXCH50 2 2on the open socket - Checks
xexch.responsefor(?i)(^|\n)354[ -][^\n]*send binary data→ finding QoD 75: Exchange accepts XEXCH50 from an unauthenticated client (MS03-046 missing)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2003-0714
- https://learn.microsoft.com/en-us/security-updates/securitybulletins/2003/ms03-046
- https://www.rapid7.com/db/modules/exploit/windows/smtp/ms03_046_exchange2000_xexch50/
Feed source — tests/vulnerabilities/exchange/CVE-2003-0714.yaml
# Microsoft Exchange 2000 / 5.5 XEXCH50 heap overflow (CVE-2003-0714, MS03-046)
#
# The Exchange SMTP service implements the proprietary XEXCH50 verb, used
# between Exchange servers to pass message properties as a raw binary blob.
# Before MS03-046 it accepted the verb from any unauthenticated client and
# mishandled the announced blob length (a negative or oversized length leads
# to memory exhaustion on 5.5 and a heap overflow on 2000). Patched servers
# (and Exchange 2003) only accept XEXCH50 on an authenticated session and
# answer "504 Need to authenticate first".
#
# Detection (QoD 75, inert): EHLO must advertise XEXCH50, then MAIL FROM /
# RCPT TO and "XEXCH50 2 2" — a benign two-byte announcement. A vulnerable
# server answers "354 Send binary data", i.e. it is ready to read the blob
# from an unauthenticated client, which is the vulnerable code path. The scan
# closes the connection right there: no blob byte and no overflow is ever sent.
#
# Credit: detection logic adapted from the GPL-2.0 plugin
# pre2008/exchange_xexch50_overflow.nasl (OID 1.3.6.1.4.1.25623.1.0.11889).
# Beyond it: the greeting no longer has to say "Microsoft" (the SMTP virtual
# server's banner is often customised; XEXCH50 in EHLO is Exchange's own), and
# the recipient is <postmaster>, which every SMTP server must accept, instead
# of an "Administrator" mailbox that may not exist.
uid: 3db582d2-c489-4672-be08-710716cf9174
name: "Microsoft Exchange XEXCH50 unauthenticated heap overflow (CVE-2003-0714, MS03-046)"
description: |
Checks whether a Microsoft Exchange SMTP service accepts the XEXCH50 command
from an unauthenticated client. Exchange 5.5 and 2000 without MS03-046 process
the binary data announced by XEXCH50 before any authentication, and a crafted
length crashes the service or overflows its heap. The test checks that EHLO
advertises XEXCH50, opens a mail transaction to postmaster and announces a
two-byte blob with "XEXCH50 2 2". A vulnerable server answers
"354 Send binary data"; a patched one requires authentication first. The
connection is closed before any data is sent, so nothing reaches the
vulnerable parser.
cves: [CVE-2003-0714]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [exchange, microsoft, smtp, xexch50, ms03-046, heap-overflow, windows, unauthenticated]
services: [smtp]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2003-0714"
- "https://learn.microsoft.com/en-us/security-updates/securitybulletins/2003/ms03-046"
- "https://www.rapid7.com/db/modules/exploit/windows/smtp/ms03_046_exchange2000_xexch50/"
steps:
- id: open-smtp
action: tcp_open
handle: smtp
port: "{{port}}"
read_banner: true
timeout_secs: 10
store_as: conn
- id: ehlo
action: tcp_send
handle: smtp
condition: "conn.connected == true && type_of(conn.banner) == \"string\" && conn.banner.starts_with(\"220\")"
send: "EHLO noctis.test\r\n"
timeout_secs: 10
store_as: ehlo
- id: xexch50-init
action: set_var
var_name: xexch50_offered
var_value: false
- id: xexch50-offered
action: set_var
condition: "type_of(ehlo.response) == \"string\" && ereg(\"(?im)^250[ -]XEXCH50[ \\r]*$\", ehlo.response)"
var_name: xexch50_offered
var_value: true
- id: mail-from
action: tcp_send
handle: smtp
condition: "xexch50_offered == true"
send: "MAIL FROM:<noctis@noctis.test>\r\n"
timeout_secs: 10
store_as: mail
- id: rcpt
action: tcp_send
handle: smtp
condition: "xexch50_offered == true && type_of(mail.response) == \"string\" && mail.response.starts_with(\"250\")"
send: "RCPT TO:<postmaster>\r\n"
timeout_secs: 10
store_as: rcpt
# Any RCPT reply is enough to go on (as for a mailbox that does not exist, the
# server then refuses XEXCH50 with 503 and the test stays silent).
- id: xexch50
action: tcp_send
handle: smtp
condition: "xexch50_offered == true && type_of(rcpt.response) == \"string\""
send: "XEXCH50 2 2\r\n"
timeout_secs: 10
store_as: xexch
# Close without sending the two announced bytes: the blob parser never runs.
- id: close-smtp
action: tcp_close
handle: smtp
- id: report
action: match
source: xexch.response
pattern: "(?i)(^|\\n)354[ -][^\\n]*send binary data"
condition: "xexch50_offered == true && type_of(xexch.response) == \"string\""
on_match:
finding:
title: "Exchange accepts XEXCH50 from an unauthenticated client (MS03-046 missing)"
confidence_delta: 0.50 # 0.30 + 0.50 = 0.80
qod: 75
evidence: "Greeting: {{conn.banner}} | EHLO advertises XEXCH50 | XEXCH50 2 2 (no AUTH) → {{xexch.response}}"