Attack Simulation & Response

Red TeamEnd-to-end simulation using real adversary tradecraft Blue TeamThreat hunting, monitoring and incident response Purple TeamGrow your offensive and defensive teams together Ransomware Response24/7 emergency response for encrypted systems

Security Testing

Penetration TestingFinding flaws in web, network and mobile applications Enterprise Penetration TestingRegulation-aligned testing for finance and large enterprises Vulnerability ScanningContinuous scanning, prioritised with CVSS
A free scoping call tailored to your organisation.
All services Get a quote

Forensic Threat Hunting

PotreX VestigeHidden threat scanning across disk, memory and forensic traces

Threat Intelligence

PotreX ArgosDark web and leak-focused threat intelligence

Penetration Testing

PotreX BallistaEnterprise penetration testing platform with finding management
Every product can be deployed on-premises or in the cloud.
All products Request a demo
Services
Products
Blog Contact Us Sign In
Home / Blog / ProxyShell
Threat Research

Exchange ProxyShell: Three Bugs, One Unauthenticated Takeover

Summary

ProxyShell is an attack chain across three separate vulnerabilities in Microsoft Exchange Server that reaches remote code execution without authentication. Demonstrated at Pwn2Own 2021, it was mass-exploited after the patches shipped, leading to web shells on thousands of servers and acting as the initial access for ransomware operations.

The value of the chain also shows in vendor economics: findings that produce unauthenticated RCE on products like Exchange sit in the six-figure band of Microsoft's bounty programme.

Chain details

CVEsCVE-2021-34473 · CVE-2021-34523 · CVE-2021-31207
ComponentExchange Server — Client Access Service (Autodiscover / PowerShell backend)
ClassSSRF → privilege escalation → write-enabled code execution
SeverityCRITICAL · CVSS 9.8
Affected versionsExchange 2013 / 2016 / 2019 at CU and SU levels before May 2021
PrerequisiteNone — an internet-facing OWA/Autodiscover endpoint is enough

Root cause: path confusion and trust in the backend

In Exchange, the front end (Client Access) proxies incoming requests to the back end. CVE-2021-34473 relies on the @ character in a URL being interpreted differently by each side, so a request on an unauthenticated path can be carried to back end endpoints that are normally protected.

The second bug (CVE-2021-34523) lets the PowerShell back end process that carried request in a privileged context, because it does not sufficiently verify the identity behind it. The third (CVE-2021-31207) abuses mailbox export to write arbitrary content to a path of the attacker's choosing.

Exposure verification

Start with the version. OWA response headers state the patch level plainly.

analyst@ubuntu: ~/labs/exchange –□✕
analyst@ubuntu:~/labs/exchange$ curl -sk -D - -o /dev/null https://mail.lab.local/owa/ | grep -iE 'x-owa-version|x-feserver'
X-OWA-Version: 15.2.792.3
X-FEServer: LAB-EXCH01

#  15.2.792.3 = Exchange 2019 CU9, before the July 2021 SU — in scope

Figure 1 — Reading the patch level from response headers

The entry point of the chain is the Autodiscover endpoint in its @ form. A patched server answers with authentication; an unpatched one produces a response.

analyst@ubuntu: ~/labs/exchange –□✕
analyst@ubuntu:~/labs/exchange$ curl -sk -o /dev/null -w 'status: %{http_code}\n' 'https://mail.lab.local/autodiscover/autodiscover.json?@lab.local/owa/?&Email=autodiscover/autodiscover.json%3f@lab.local'
status: 200

#  401 was expected — the front end carries the request unauthenticated
#  exposure confirmed; no exploitation steps were run

Figure 2 — Checking exposure at the entry point of the chain

Method note

Only exposure verification and defensive steps are published here. The exploitation details of the mailbox export step that writes a web shell are deliberately omitted.

IIS log hunting and artefacts

Attempts leave a distinctive pattern in IIS logs: an @ character on the Autodiscover path and unusual volumes of traffic to the PowerShell back end.

analyst@ubuntu: /mnt/exch/W3SVC1 –□✕
analyst@ubuntu:/mnt/exch/W3SVC1$ grep -hoE 'autodiscover\.json\?@[^ ]+' u_ex21*.log | sort | uniq -c | sort -rn | head -n 5
    612 autodiscover.json?@lab.local/powershell
    118 autodiscover.json?@lab.local/mapi/nspi
     23 autodiscover.json?@lab.local/owa

#  753 attempts — first record 2021-08-12 03:41, three source IPs

Figure 3 — Detecting chain attempts in IIS logs

The lasting trace of successful exploitation is an unexpected .aspx file in the web directories. Filtering by date removes the legitimate ones.

analyst@ubuntu: /mnt/exch –□✕
analyst@ubuntu:/mnt/exch$ find FrontEnd/HttpProxy/owa/auth -name '*.aspx' -newermt '2021-08-01' -printf '%TY-%Tm-%Td %Ts %p\n'
2021-08-12 3122 FrontEnd/HttpProxy/owa/auth/Xr1.aspx
2021-08-12 1844 FrontEnd/HttpProxy/owa/auth/tmp_up.aspx

#  two web shells — server isolated, image taken, IR engaged

Figure 4 — Finding web shell artefacts in the web directory

Remediation

  • Bring Exchange servers to a current CU plus SU level; for ProxyShell the July 2021 and later updates are required.
  • Do not expose Autodiscover and PowerShell endpoints directly; place an authenticating layer (for example an application proxy) in front of them.
  • If the server was internet-facing before patching, treat it as breached rather than patched and hunt for artefacts.
  • Restrict the mailbox export permission (Export-MailboxExportRequest) and alert on its use.
analyst@ubuntu: ~/labs/exchange –□✕
analyst@ubuntu:~/labs/exchange$ curl -sk -D - -o /dev/null https://mail.lab.local/owa/ | grep -i x-owa-version && curl -sk -o /dev/null -w 'status: %{http_code}\n' 'https://mail.lab.local/autodiscover/autodiscover.json?@lab.local/powershell'
X-OWA-Version: 15.2.1118.21
status: 401

#  after the update the entry point demands authentication

Figure 5 — Verifying the exposure is closed after updating

Conclusion

ProxyShell is one of the clearest examples of individually moderate bugs combining into a critical chain. For organisations the real lesson is how short the patch window is: mass scanning began within days of the technical details becoming public. Internet-facing identity and mail infrastructure deserves its own risk class in the asset inventory.

Sources

Test it in your own environment

We assess your internet-facing identity and mail infrastructure the way an attacker sees it.

Call now · 0850 551 01 01 WhatsApp · Send a message Email · info@potrex.com