Skip to content

Commit abe1d6f

Browse files
committed
Land rapid7#3190, @Karmanovskii's module to fingerprint MyBB database
2 parents 704e4d7 + 86221de commit abe1d6f

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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+
class Metasploit3 < Msf::Auxiliary
8+
9+
include Msf::Exploit::Remote::HttpClient
10+
11+
def initialize(info = {})
12+
super(update_info(info,
13+
'Name' => 'Determinant Databases MyBB ',
14+
'Description' => %q{
15+
This module checks if MyBB is running behind an URL. Also uses a malformed query to
16+
force an error and fingerprint the backend database used by MyBB.
17+
},
18+
'Author' =>
19+
[
20+
#http://www.linkedin.com/pub/arthur-karmanovskii/82/923/812
21+
'Arthur Karmanovskii <fnsnic[at]gmail.com>' # Discovery and Metasploit Module
22+
],
23+
'License' => MSF_LICENSE,
24+
'DisclosureDate' => 'Feb 13 2014'))
25+
26+
register_options(
27+
[
28+
OptString.new('TARGETURI', [ true, "MyBB forum directory path", '/forum'])
29+
], self.class)
30+
end
31+
32+
def check
33+
begin
34+
uri = normalize_uri(target_uri.path, 'index.php')
35+
res = send_request_cgi(
36+
{
37+
'method' => 'GET',
38+
'uri' => uri,
39+
'vars_get' => {
40+
'intcheck' => 1
41+
}
42+
})
43+
44+
if res.nil? || res.code != 200
45+
return Exploit::CheckCode::Unknown
46+
end
47+
48+
#Check PhP
49+
php_version = res['X-Powered-By']
50+
if php_version
51+
php_version = "#{php_version}"
52+
else
53+
php_version = "PHP version unknown"
54+
end
55+
56+
#Check Web-Server
57+
web_server = res['Server']
58+
if web_server
59+
web_server = "#{web_server}"
60+
else
61+
web_server = "unknown web server"
62+
end
63+
64+
#Check forum MyBB
65+
if res.body.match("&#077;&#089;&#066;&#066;")
66+
print_good("#{peer} - MyBB forum found running on #{web_server} / #{php_version}")
67+
return Exploit::CheckCode::Detected
68+
else
69+
return Exploit::CheckCode::Unknown
70+
end
71+
rescue
72+
return Exploit::CheckCode::Unknown
73+
end
74+
75+
end
76+
77+
78+
def run
79+
print_status("#{peer} - Checking MyBB...")
80+
unless check == Exploit::CheckCode::Detected
81+
print_error("#{peer} - MyBB not found")
82+
return
83+
end
84+
85+
print_status("#{peer} - Checking database...")
86+
uri = normalize_uri(target_uri.path, 'memberlist.php')
87+
response = send_request_cgi(
88+
{
89+
'method' => 'GET',
90+
'uri' => uri,
91+
'vars_get' => {
92+
'letter' => -1
93+
}
94+
})
95+
if response.nil?
96+
print_error("#{peer} - Timeout...")
97+
return
98+
end
99+
100+
#Resolve response
101+
if response.body.match(/SELECT COUNT\(\*\) AS users FROM mybb_users u WHERE 1=1 AND u.username NOT REGEXP\(\'\[a-zA-Z\]\'\)/)
102+
print_good("#{peer} - Running PostgreSQL Database")
103+
elsif response.body.match(/General error\: 1 no such function\: REGEXP/)
104+
print_good("#{peer} - Running SQLite Database")
105+
else
106+
print_status("#{peer} - Running MySQL or unknown database")
107+
end
108+
end
109+
end

0 commit comments

Comments
 (0)