Skip to content

Commit 1d17e9a

Browse files
author
HD Moore
committed
Remove the 256 byte limit for URLs
1 parent 5f382e5 commit 1d17e9a

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def initialize(*args)
2626
super
2727
register_advanced_options(
2828
[
29-
OptInt.new('HTTPStagerURILength', [false, 'The URI length for the stager (5 to 240ish bytes)'])
29+
OptInt.new('HTTPStagerURILength', [false, 'The URI length for the stager (at least 5 bytes)'])
3030
], self.class)
3131
end
3232

@@ -73,16 +73,12 @@ def generate_reverse_http(opts={})
7373
# Generate the URI for the initial stager
7474
#
7575
def generate_uri
76-
# Maximum URL is limited to https:// plus 256 bytes, figure out our maximum URI
77-
uri_max_len = 256 - "#{datastore['LHOST']}:#{datastore['LPORT']}/".length
76+
7877
uri_req_len = datastore['HTTPStagerURILength'].to_i
7978

79+
# Choose a random URI length between 30 and 255 bytes
8080
if uri_req_len == 0
81-
uri_req_len = 30 + rand(uri_max_len-30)
82-
end
83-
84-
if uri_req_len > uri_max_len
85-
raise ArgumentError, "Maximum HTTPStagerURILength is #{uri_max_len}"
81+
uri_req_len = 30 + rand(256-30)
8682
end
8783

8884
if uri_req_len < 5

0 commit comments

Comments
 (0)