Skip to content

Commit b6e7f4f

Browse files
committed
Land rapid7#5663 : Avoid generating small URIs by default
Fixes rapid7#5662
2 parents 632bcda + aaaf680 commit b6e7f4f

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

lib/msf/core/payload/uuid/options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def generate_uri_uuid_mode(mode,len=nil)
3636
# The URI length may not have room for an embedded UUID
3737
if len && len < URI_CHECKSUM_UUID_MIN_LEN
3838
# Throw an error if the user set a seed, but there is no room for it
39-
if datastore['PayloadUUIDSeed'].to_s.length > 0 ||datastore['PayloadUUIDRaw'].to_s.length > 0
39+
if datastore['PayloadUUIDSeed'].to_s.length > 0 || datastore['PayloadUUIDRaw'].to_s.length > 0
4040
raise ArgumentError, "A PayloadUUIDSeed or PayloadUUIDRaw value was specified, but this payload doesn't have enough room for a UUID"
4141
end
4242
return "/" + generate_uri_checksum(sum, len, prefix="")

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,21 @@ def generate(opts={})
4646
ssl: opts[:ssl] || false,
4747
host: datastore['LHOST'],
4848
port: datastore['LPORT'],
49-
url: generate_small_uri,
5049
retry_count: datastore['StagerRetryCount']
5150
}
5251

5352
# Add extra options if we have enough space
5453
unless self.available_space.nil? || required_space > self.available_space
55-
conf[:url] = generate_uri
5654
conf[:exitfunk] = datastore['EXITFUNC']
5755
conf[:ua] = datastore['MeterpreterUserAgent']
5856
conf[:proxy_host] = datastore['PayloadProxyHost']
5957
conf[:proxy_port] = datastore['PayloadProxyPort']
6058
conf[:proxy_user] = datastore['PayloadProxyUser']
6159
conf[:proxy_pass] = datastore['PayloadProxyPass']
6260
conf[:proxy_type] = datastore['PayloadProxyType']
61+
else
62+
# Otherwise default to small URIs
63+
conf[:url] = generate_small_uri
6364
end
6465

6566
generate_reverse_http(conf)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def generate(opts={})
2727
ssl: opts[:ssl] || false,
2828
host: datastore['LHOST'],
2929
port: datastore['LPORT'],
30-
url: generate_small_uri,
3130
retry_count: datastore['StagerRetryCount']
3231
}
3332

@@ -42,6 +41,9 @@ def generate(opts={})
4241
conf[:proxy_pass] = datastore['PayloadProxyPass']
4342
conf[:proxy_type] = datastore['PayloadProxyType']
4443
conf[:retry_count] = datastore['StagerRetryCount']
44+
else
45+
# Otherwise default to small URIs
46+
conf[:url] = generate_small_uri
4547
end
4648

4749
generate_reverse_winhttp(conf)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def generate(opts={})
5050
ssl: opts[:ssl] || false,
5151
host: datastore['LHOST'],
5252
port: datastore['LPORT'],
53-
url: generate_small_uri,
5453
retry_count: datastore['StagerRetryCount']
5554
}
5655

@@ -64,6 +63,9 @@ def generate(opts={})
6463
conf[:proxy_user] = datastore['PayloadProxyUser']
6564
conf[:proxy_pass] = datastore['PayloadProxyPass']
6665
conf[:proxy_type] = datastore['PayloadProxyType']
66+
else
67+
# Otherwise default to small URIs
68+
conf[:url] = generate_small_uri
6769
end
6870

6971
generate_reverse_http(conf)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def generate(opts={})
2424
ssl: opts[:ssl] || false,
2525
host: datastore['LHOST'],
2626
port: datastore['LPORT'],
27-
url: generate_small_uri,
2827
retry_count: datastore['StagerRetryCount']
2928
}
3029

@@ -38,6 +37,9 @@ def generate(opts={})
3837
conf[:proxy_user] = datastore['PayloadProxyUser']
3938
conf[:proxy_pass] = datastore['PayloadProxyPass']
4039
conf[:proxy_type] = datastore['PayloadProxyType']
40+
else
41+
# Otherwise default to small URIs
42+
conf[:url] = generate_small_uri
4143
end
4244

4345
generate_reverse_winhttp(conf)

0 commit comments

Comments
 (0)