Skip to content

Commit b810a96

Browse files
committed
Add Module for Enum on InfluxDB database.
1 parent 4ffffa5 commit b810a96

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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 Metasploit3 < Msf::Auxiliary
9+
10+
include Msf::Exploit::Remote::HttpClient
11+
include Msf::Auxiliary::Report
12+
13+
def initialize(info = {})
14+
super(update_info(info,
15+
'Name' => 'InfluxDB Enum Utility',
16+
'Description' => %q{
17+
This module enumerates databases on InfluxDB using the REST API
18+
(using default authentication - root:root).
19+
},
20+
'References' =>
21+
[
22+
['URL', 'http://influxdb.com/docs/v0.9/concepts/reading_and_writing_data.html']
23+
],
24+
'Author' => [ 'Roberto Soares Espreto <robertoespreto[at]gmail.com>' ],
25+
'License' => MSF_LICENSE
26+
))
27+
28+
register_options(
29+
[
30+
Opt::RPORT(8086),
31+
OptString.new('TARGETURI', [true, 'Path to list all the databases', '/db']),
32+
OptString.new('USERNAME', [true, 'The username to login as', 'root']),
33+
OptString.new('PASSWORD', [true, 'The password to login with', 'root'])
34+
], self.class)
35+
end
36+
37+
def run
38+
username = datastore['USERNAME']
39+
password = datastore['PASSWORD']
40+
41+
res = send_request_cgi(
42+
'uri' => normalize_uri(target_uri.path),
43+
'method' => 'GET',
44+
'authorization' => basic_auth(username, password)
45+
)
46+
47+
if res && res.code == 401
48+
print_error("#{peer} - Failed to authenticate. Invalid username/password.")
49+
return
50+
end
51+
52+
if res.code == 200 && res.headers['X-Influxdb-Version'].include?('InfluxDB') && res.body.length > 0
53+
print_status('Enumerating...')
54+
begin
55+
temp = JSON.parse(res.body)
56+
results = JSON.pretty_generate(temp)
57+
rescue JSON::ParserError
58+
print_error('Unable to parse JSON data for the response.')
59+
end
60+
61+
print_good("Found:\n\n#{results}\n")
62+
63+
path = store_loot(
64+
'influxdb.enum',
65+
'text/plain',
66+
rhost,
67+
results,
68+
'InfluxDB Enum'
69+
)
70+
71+
print_good("#{peer} - File saved in: #{path}")
72+
else
73+
print_error("#{peer} - Unable to enum, received \"#{res.code}\".")
74+
end
75+
rescue => e
76+
print_error("#{peer} - The following Error was encountered: #{e.class}")
77+
end
78+
end

0 commit comments

Comments
 (0)