Threat Advisory: How to respond to ProxyShell, the latest exploit against Exchange

Aug 10, 2021
Written by Davinsi Labs

During Black Hat 2021, a well-known computer security conference, security researcher Orange Tsai showcased a new exploit dubbed “ProxyShell” to remotely attack on-premise Microsoft Exchange servers.

ProxyShell is a set of three security flaws (CVE-2021-34473, CVE-2021-34523, and CVE-2021-31207) which, when used together, could enable a threat actor to perform unauthenticated, remote code execution (RCE) on unpatched Microsoft Exchange servers.

Adversaries are actively scanning for vulnerable Microsoft Exchange servers through the use of Shodan, GreyNoise and Tenable since the technical details of the exploit were disclosed last week at the Black Hat 2021 conference.

As reported by SANS Internet Storm Center, over 30.000 vulnerable Microsoft Exchange Servers are detected by Shodan.

Scope of the vulnerability

On-premise, unpatched Microsoft Exchange Servers ranging from 2013 until 2019 are vulnerable to the ProxyShell exploit.

The following nmap script could be used to scan the corporate network for any vulnerable Microsoft Exchange servers: https://github.com/GossiTheDog/scanning/blob/main/http-vuln-exchange-proxyshell.nse

CVE Description Affected Versions
CVE-2021-34473 Pre-auth Path Confusion leads to ACL Bypass
  • Microsoft Exchange Server 2013
  • Microsoft Exchange Server 2016
  • Microsoft Exchange Server 2019
CVE-2021-34523 Elevation of Privilege on Exchange PowerShell Backend
  • Microsoft Exchange Server 2013
  • Microsoft Exchange Server 2016
  • Microsoft Exchange Server 2019
CVE-2021-31207 Post-auth Arbitrary-File-Write leads to RCE
  • Microsoft Exchange Server 2013
  • Microsoft Exchange Server 2016
  • Microsoft Exchange Server 2019

 

Remediation

Microsoft released patches for ProxyShell vulnerabilities in mid-April, however, the tech giant only published advisories for the flaws in May and July.

The following patches should be installed:

 

Mitigation

Block incoming, external traffic over port 443 to corporate Microsoft Exchange servers.

Detection

Successful ProxyShell exploitation can be detected through reverse proxy logs.

Monitor incoming web requests over port 443 against uri_path ‘ /autodiscover/autodiscover.json ‘ containing one of the following strings ‘ (“powershell”,”mapi/nspi”,”mapi/emsmdb”,”/EWS”,”X-Rps-CAT”) ‘ with resulting status code 200, 301 or 302.

Post-exploitation activity can be detected as well by monitoring:

  • PowerShell logs from the Exchange server
    • The ‘ New-ManagementRoleAssignment ‘ command is indicative of granting mailbox import/export privileges.
    • The ‘ New-MailboxExportRequest ‘ command is indicative of exporting a user’s mailbox into an UNC path.
  • Endpoint logs from the Exchange server
    • Process creation of ‘ MSExchangeMailboxReplication.exe ‘.
    • Process creation of ‘ powershell.exe ‘ or ‘ pwsh.exe ‘ containing ‘ New-MailboxExportRequest* ‘.

Hunting

We advise to query reverse proxy logs for indicators of scanning activity:

  • incoming web requests over port 443 against uri_path ‘ /autodiscover/autodiscover.json ‘ containing one of the following strings ‘ (“powershell”,”mapi/nspi”,”mapi/emsmdb”,”/EWS”,”X-Rps-CAT”) ‘ with resulting status code 400, 401 or 404.
  • YARA rules to hunt for ProxyShell, provided by Florian Roth: https://github.com/Neo23x0/signature-base/blob/master/yara/expl_proxyshell.yar

Reach out to info@davinsi.com if you need any assistance from our team of security experts.

We hope the following threat advisory assists to react quickly to ongoing threats and urges the need for patching and security monitoring.

References

Share this news