diff --git a/lib/wpscan/target/platform/wordpress/custom_directories.rb b/lib/wpscan/target/platform/wordpress/custom_directories.rb index f8989c898..834991803 100644 --- a/lib/wpscan/target/platform/wordpress/custom_directories.rb +++ b/lib/wpscan/target/platform/wordpress/custom_directories.rb @@ -17,7 +17,7 @@ def plugins_dir=(dir) def content_dir unless @content_dir # scope_url_pattern is from CMSScanner::Target - pattern = %r{#{scope_url_pattern}([\w\s\-/]+)\\?/(?:themes|plugins|uploads|cache)\\?/}i + pattern = %r{#{scope_url_pattern}([\w\s\-/]+?)\\?/(?:themes|plugins|uploads|cache)\\?/}i in_scope_uris(homepage_res) do |uri| return @content_dir = Regexp.last_match[1] if uri.to_s.match(pattern) diff --git a/spec/fixtures/target/platform/wordpress/custom_directories/themes_path_plugin_folder.html b/spec/fixtures/target/platform/wordpress/custom_directories/themes_path_plugin_folder.html new file mode 100644 index 000000000..653a3ed30 --- /dev/null +++ b/spec/fixtures/target/platform/wordpress/custom_directories/themes_path_plugin_folder.html @@ -0,0 +1,5 @@ + + + diff --git a/spec/shared_examples/target/platform/wordpress/custom_directories.rb b/spec/shared_examples/target/platform/wordpress/custom_directories.rb index ec124d39f..2cda36dca 100644 --- a/spec/shared_examples/target/platform/wordpress/custom_directories.rb +++ b/spec/shared_examples/target/platform/wordpress/custom_directories.rb @@ -8,7 +8,8 @@ default: 'wp-content', https: 'wp-content', custom_w_spaces: 'custom content spaces', relative_one: 'wp-content', relative_two: 'wp-content', cache: 'wp-content', in_raw_js: 'wp-content', in_raw_js_escaped: 'wp-content', with_sub_dir: 'app', - relative_two_sub_dir: 'cms/wp-content', in_meta_content: 'wp-content' + relative_two_sub_dir: 'cms/wp-content', in_meta_content: 'wp-content', + themes_path_plugin_folder: 'wp-content' }.each do |file, expected| it "returns #{expected} for #{file}.html" do stub_request(:get, target.url).to_return(body: File.read(fixtures.join("#{file}.html")))