2014-03-28 23:47:49 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2014-03-28 23:47:49 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2014-03-28 23:47:49 +00:00
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2014-05-27 15:29:32 +00:00
|
|
|
'Name' => 'MyBB Database Fingerprint',
|
2014-03-28 23:47:49 +00:00
|
|
|
'Description' => %q{
|
2014-05-27 15:14:55 +00:00
|
|
|
This module checks if MyBB is running behind an URL. Also uses a malformed query to
|
2014-05-27 15:22:39 +00:00
|
|
|
force an error and fingerprint the backend database used by MyBB on version 1.6.12
|
|
|
|
and prior.
|
2014-03-28 23:47:49 +00:00
|
|
|
},
|
2014-05-27 15:14:55 +00:00
|
|
|
'Author' =>
|
2014-03-28 23:47:49 +00:00
|
|
|
[
|
2014-05-14 10:56:40 +00:00
|
|
|
#http://www.linkedin.com/pub/arthur-karmanovskii/82/923/812
|
2014-05-27 15:14:55 +00:00
|
|
|
'Arthur Karmanovskii <fnsnic[at]gmail.com>' # Discovery and Metasploit Module
|
2014-03-28 23:47:49 +00:00
|
|
|
],
|
2014-05-27 15:14:55 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2014-03-28 23:47:49 +00:00
|
|
|
'DisclosureDate' => 'Feb 13 2014'))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('TARGETURI', [ true, "MyBB forum directory path", '/forum'])
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
begin
|
2014-05-26 19:26:28 +00:00
|
|
|
uri = normalize_uri(target_uri.path, 'index.php')
|
2014-05-17 12:30:29 +00:00
|
|
|
res = send_request_cgi(
|
|
|
|
{
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => uri,
|
|
|
|
'vars_get' => {
|
2014-05-26 19:26:28 +00:00
|
|
|
'intcheck' => 1
|
2014-05-17 12:30:29 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2014-05-27 15:14:55 +00:00
|
|
|
if res.nil? || res.code != 200
|
2014-05-14 10:56:40 +00:00
|
|
|
return Exploit::CheckCode::Unknown
|
|
|
|
end
|
2014-03-28 23:47:49 +00:00
|
|
|
|
2015-04-03 11:12:23 +00:00
|
|
|
# Check PhP
|
2014-05-14 10:56:40 +00:00
|
|
|
php_version = res['X-Powered-By']
|
|
|
|
if php_version
|
2014-05-27 15:18:27 +00:00
|
|
|
php_version = "#{php_version}"
|
2014-05-14 10:56:40 +00:00
|
|
|
else
|
2014-05-27 15:14:55 +00:00
|
|
|
php_version = "PHP version unknown"
|
2014-05-14 10:56:40 +00:00
|
|
|
end
|
2014-03-28 23:47:49 +00:00
|
|
|
|
2015-04-03 11:12:23 +00:00
|
|
|
# Check Web-Server
|
2014-05-17 12:30:29 +00:00
|
|
|
web_server = res['Server']
|
|
|
|
if web_server
|
2014-05-27 15:14:55 +00:00
|
|
|
web_server = "#{web_server}"
|
2014-05-14 10:56:40 +00:00
|
|
|
else
|
2014-05-27 15:14:55 +00:00
|
|
|
web_server = "unknown web server"
|
2014-05-14 10:56:40 +00:00
|
|
|
end
|
2014-03-28 23:47:49 +00:00
|
|
|
|
2015-04-03 11:12:23 +00:00
|
|
|
# Check forum MyBB
|
2014-05-14 10:56:40 +00:00
|
|
|
if res.body.match("MYBB")
|
2016-02-01 22:06:34 +00:00
|
|
|
print_good("MyBB forum found running on #{web_server} / #{php_version}")
|
2014-05-14 10:56:40 +00:00
|
|
|
return Exploit::CheckCode::Detected
|
|
|
|
else
|
|
|
|
return Exploit::CheckCode::Unknown
|
|
|
|
end
|
2014-05-27 15:14:55 +00:00
|
|
|
rescue
|
|
|
|
return Exploit::CheckCode::Unknown
|
|
|
|
end
|
2014-03-28 23:47:49 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def run
|
2016-02-01 22:06:34 +00:00
|
|
|
print_status("Checking MyBB...")
|
2014-05-27 15:14:55 +00:00
|
|
|
unless check == Exploit::CheckCode::Detected
|
2016-02-01 22:06:34 +00:00
|
|
|
print_error("MyBB not found")
|
2014-05-27 15:14:55 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2016-02-01 22:06:34 +00:00
|
|
|
print_status("Checking database...")
|
2014-05-26 19:26:28 +00:00
|
|
|
uri = normalize_uri(target_uri.path, 'memberlist.php')
|
2014-05-14 10:56:40 +00:00
|
|
|
response = send_request_cgi(
|
|
|
|
{
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => uri,
|
|
|
|
'vars_get' => {
|
2014-05-26 19:26:28 +00:00
|
|
|
'letter' => -1
|
2014-05-14 10:56:40 +00:00
|
|
|
}
|
|
|
|
})
|
2014-03-28 23:47:49 +00:00
|
|
|
if response.nil?
|
2016-02-01 22:06:34 +00:00
|
|
|
print_error("Timeout...")
|
2014-05-14 10:56:40 +00:00
|
|
|
return
|
2014-03-28 23:47:49 +00:00
|
|
|
end
|
|
|
|
|
2015-04-03 11:12:23 +00:00
|
|
|
# Resolve response
|
2014-03-28 23:47:49 +00:00
|
|
|
if response.body.match(/SELECT COUNT\(\*\) AS users FROM mybb_users u WHERE 1=1 AND u.username NOT REGEXP\(\'\[a-zA-Z\]\'\)/)
|
2016-02-01 22:06:34 +00:00
|
|
|
print_good("Running PostgreSQL Database")
|
2014-03-28 23:47:49 +00:00
|
|
|
elsif response.body.match(/General error\: 1 no such function\: REGEXP/)
|
2016-02-01 22:06:34 +00:00
|
|
|
print_good("Running SQLite Database")
|
2014-03-28 23:47:49 +00:00
|
|
|
else
|
2016-02-01 22:06:34 +00:00
|
|
|
print_status("Running MySQL or unknown database")
|
2014-03-28 23:47:49 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|