From d230221999cc4cdca228c7c8f0b45f4ae6187854 Mon Sep 17 00:00:00 2001 From: ethicalhack3r Date: Tue, 2 Dec 2014 16:40:18 +0100 Subject: [PATCH] Prevent parent theme infinite loop --- lib/common/models/wp_theme/childtheme.rb | 4 ++++ wpscan.rb | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/common/models/wp_theme/childtheme.rb b/lib/common/models/wp_theme/childtheme.rb index 3e0944e8..0303db99 100644 --- a/lib/common/models/wp_theme/childtheme.rb +++ b/lib/common/models/wp_theme/childtheme.rb @@ -3,6 +3,10 @@ class WpTheme < WpItem module Childtheme + def parent_theme_limit + 3 + end + def is_child_theme? return true unless @theme_template.nil? false diff --git a/wpscan.rb b/wpscan.rb index 7596a077..c114d636 100755 --- a/wpscan.rb +++ b/wpscan.rb @@ -222,7 +222,10 @@ def main wp_theme.output(wpscan_options.verbose) # Check for parent Themes - while wp_theme.is_child_theme? + parent_theme_count = 0 + while wp_theme.is_child_theme? && parent_theme_count <= wp_theme.parent_theme_limit + parent_theme_count += 1 + parent = wp_theme.get_parent_theme puts puts "#{info('[+]')} Detected parent theme: #{parent}"