What is Path Traversal in Exchange?
Path traversal (CWE-22) vulnerabilities occur when a web application uses attacker-controlled input to construct a filesystem path without properly sanitizing directory traversal sequences (e.g., ../). In Microsoft Exchange Server, authenticated API endpoints that write files as part of Exchange's operations — such as virtual directory configuration, OAB (Offline Address Book) generation, or configuration export — can be vulnerable if they incorporate user-supplied path components without validation. An attacker who can write arbitrary files to IIS-accessible directories via path traversal can deploy ASP.NET web shells, gaining persistent HTTP-accessible code execution on the Exchange server.
Overview
CVE-2021-27065 is a path traversal file write vulnerability (CWE-22) in Microsoft Exchange Server. It is the second post-authentication file write in the ProxyLogon cluster (alongside CVE-2021-26858), exploitable after authentication is obtained via the CVE-2021-26855 SSRF authentication bypass. A path traversal vulnerability in an Exchange endpoint that writes configuration or data files allows an authenticated attacker to specify a target file path outside the intended directory — writing ASPX web shell content to IIS-accessible paths on the Exchange server. CVE-2021-27065 was used alongside CVE-2021-26858 by HAFNIUM and subsequent threat actors to achieve persistent backdoor access. CISA Emergency Directive 21-02 required immediate patching of federal Exchange servers.
Affected Versions
| Product | Vulnerable | Fixed |
|---|---|---|
| Exchange Server 2013 CU23 | Yes | March 2021 Security Update |
| Exchange Server 2016 CU18, CU19 | Yes | March 2021 Security Update |
| Exchange Server 2019 CU7, CU8 | Yes | March 2021 Security Update |
| Exchange Online (Microsoft 365) | Not affected | Managed service, patched by Microsoft |
Technical Details
- Root cause: Path traversal (CWE-22) — an authenticated Exchange endpoint (related to OAB virtual directory configuration or similar Exchange management functionality) writes files using a path derived from attacker-controlled input; sequences like
../../../../inetpub/wwwroot/aspnet_client/shell.aspxtraverse outside the intended directory and land in an IIS-accessible location, where a.aspxfile becomes an executable web shell - ProxyLogon chain: (1) CVE-2021-26855 (pre-auth SSRF) → authenticate as any Exchange user/admin; (2) CVE-2021-27065 (path traversal file write) → write web shell to IIS web root → persistent remote code execution via HTTP
- Relationship to CVE-2021-26858: Both CVE-2021-26858 and CVE-2021-27065 achieve the same outcome (arbitrary file write → web shell deployment) but through different vulnerable Exchange endpoints; threat actors used both, and defenders needed to patch both to close the persistent access path
- Web shell persistence: ASPX web shells deployed via CVE-2021-27065 persist on the Exchange server filesystem; patching Exchange after exploitation does not remove already-deployed web shells — post-patch forensic investigation is essential
- Ransomware use: LockFile, BlackKingdom, DearCry, and other ransomware families used ProxyLogon web shells (deployed via CVE-2021-26858 and CVE-2021-27065) as the initial foothold for deploying ransomware across enterprise networks
Discovery
Part of the four-vulnerability ProxyLogon chain reported by Orange Tsai of DEVCORE to Microsoft on January 5, 2021. HAFNIUM exploited all four ProxyLogon vulnerabilities as zero-days beginning in late February 2021. The specific path traversal mechanism in CVE-2021-27065 was detailed in technical analyses by Volexity, Microsoft MSTIC, and DEVCORE following the March 2 patch release.
Exploitation Context
CVE-2021-27065 was one of the primary web shell deployment mechanisms in the ProxyLogon exploitation wave. The pattern: CVE-2021-26855 → CVE-2021-27065 (or CVE-2021-26858) → web shell was executed at extraordinary scale by dozens of threat actors in the two weeks following the March 2, 2021 patch. The path traversal mechanism was particularly efficient because it required only two HTTP requests (one for authentication via the SSRF, one for the file write) to deploy a persistent backdoor. Security firms estimated that tens of thousands of Exchange servers worldwide were backdoored before organizations could apply the emergency patches. The ransomwareUse flag reflects that criminal actors leveraged this web shell access to stage and deploy ransomware across compromised networks.
Remediation
- Apply Microsoft Exchange March 2021 Security Updates — patches the path traversal vulnerability in Exchange 2013, 2016, and 2019
- Assume compromise and hunt for web shells — any Exchange server internet-accessible before March 8, 2021 without the patch should be treated as backdoored:
- Enumerate all
.aspxand related files in Exchange IIS directories and compare against known-good file lists - Check specifically:
C:\inetpub\wwwroot\aspnet_client\, OAB virtual directory paths, and Exchange OWA directories
- Enumerate all
- Run Microsoft's
Test-ProxyLogon.ps1detection script to identify exploitation artifacts in Exchange logs - Review IIS logs for the specific CVE-2021-27065 exploitation pattern: POST requests to Exchange ECP/OAB endpoints followed by GET requests to newly created ASPX files in unusual paths
- Apply CVE-2021-26855 mitigations first if patching is delayed — blocking the SSRF prevents the attacker from obtaining the authenticated session required for CVE-2021-27065
- After remediation, perform full credential rotation for all accounts accessible from the Exchange server and review for additional persistence mechanisms (new admin accounts, scheduled tasks, registry keys)
Key Details
| Property | Value |
|---|---|
| CVE ID | CVE-2021-27065 |
| Vendor / Product | Microsoft — Exchange Server |
| NVD Published | 2021-03-03 |
| NVD Last Modified | 2025-12-18 |
| CVSS 3.1 Score | 7.8 |
| CVSS 3.1 Vector | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| Severity | HIGH |
| CWE | CWE-22 find similar ↗ |
| CISA KEV Added | 2021-11-03 |
| CISA KEV Deadline | 2022-05-03 |
| Known Ransomware Use | ⚠️ Yes |
CVSS 3.1 Breakdown
Required Action
Timeline
| Date | Event |
|---|---|
| 2021-01-03 | DEVCORE's Orange Tsai reports ProxyLogon chain (including CVE-2021-27065) to Microsoft |
| 2021-02-28 | Microsoft detects HAFNIUM actively exploiting ProxyLogon zero-days before patch availability |
| 2021-03-02 | Microsoft releases out-of-band emergency patches for all four ProxyLogon CVEs |
| 2021-03-03 | CISA issues Emergency Directive 21-02; CVE published |
| 2021-11-03 | Added to CISA Known Exploited Vulnerabilities catalog |
| 2022-05-03 | CISA BOD 22-01 remediation deadline |
References
| Resource | Type |
|---|---|
| Microsoft Security Advisory — CVE-2021-27065 | Vendor Advisory |
| Microsoft MSTIC — HAFNIUM Targeting Exchange Servers with 0-Days | Security Research |
| CISA Emergency Directive 21-02 | US Government |
| NVD — CVE-2021-27065 | Vulnerability Database |
| CISA KEV Catalog Entry | US Government |