diff --git a/modules/generators/content/database/sql_table_setup/secgen_local/local.rb b/modules/generators/content/database/sql_table_setup/secgen_local/local.rb
index 3bbf8b09e..ab2aedd09 100644
--- a/modules/generators/content/database/sql_table_setup/secgen_local/local.rb
+++ b/modules/generators/content/database/sql_table_setup/secgen_local/local.rb
@@ -18,7 +18,7 @@ class TableCreateGenerator < StringEncoder
product_headings = "#{self.product_table_headings}".split(',')
$i = 0
- $num = 6
+ $num = 7
last_record = false
product_table_records = []
diff --git a/modules/generators/html/vuln_snippets/idor_product_template/idor_product_template.pp b/modules/generators/html/vuln_snippets/idor_product_template/idor_product_template.pp
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/html/vuln_snippets/idor_product_template/manifests/.no_puppet b/modules/generators/html/vuln_snippets/idor_product_template/manifests/.no_puppet
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/html/vuln_snippets/idor_product_template/manifests/_no_puppet b/modules/generators/html/vuln_snippets/idor_product_template/manifests/_no_puppet
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/html/vuln_snippets/idor_product_template/secgen_local/local.rb b/modules/generators/html/vuln_snippets/idor_product_template/secgen_local/local.rb
new file mode 100644
index 000000000..baf6bae0b
--- /dev/null
+++ b/modules/generators/html/vuln_snippets/idor_product_template/secgen_local/local.rb
@@ -0,0 +1,89 @@
+#!/usr/bin/ruby
+require_relative '../../../../../../lib/objects/local_string_encoder.rb'
+class IdorProductTemplateGenerator < StringEncoder
+ attr_accessor :strings_to_leak
+ attr_accessor :table_headings
+
+ def initialize
+ super
+ self.module_name = 'IDOR Product Snippet Generator'
+ self.strings_to_leak = ''
+ self.table_headings = ''
+ end
+
+ def encode_all
+ headings = "#{self.table_headings}"
+ headings_array = headings.split(',')
+ table_name = headings_array[0]
+ name = headings_array[1]
+ price = headings_array[2]
+ img = headings_array[3]
+
+ flag_statement = "
+ Well done, you have successfully exploited an insecure direct object reference vulnerability!
+ Here is a flag: #{strings_to_leak}
+
"
+
+ flag_check = " #{flag_statement}
+ "
+
+ layout = "
+
+

\" alt=\"image\" class=\"img-fluid\" />
+
(Low Stock)
+
£
+
+ #{flag_check}
"
+
+ snippet = layout
+
+ self.outputs << snippet
+ end
+
+ def get_options_array
+ super + [['--table_headings', GetoptLong::REQUIRED_ARGUMENT],
+ ['--strings_to_leak', GetoptLong::REQUIRED_ARGUMENT]]
+ end
+
+ def process_options(opt, arg)
+ super
+ case opt
+ when '--table_headings'
+ self.table_headings << arg;
+ when '--strings_to_leak'
+ self.strings_to_leak << arg;
+ end
+ end
+
+ def encoding_print_string
+ 'table_headings: ' + self.table_headings.to_s + print_string_padding +
+ 'strings_to_leak: ' + self.strings_to_leak.to_s + print_string_padding
+ end
+end
+
+IdorProductTemplateGenerator.new.run
diff --git a/modules/generators/html/vuln_snippets/idor_product_template/secgen_metadata.xml b/modules/generators/html/vuln_snippets/idor_product_template/secgen_metadata.xml
new file mode 100644
index 000000000..7cd3492e0
--- /dev/null
+++ b/modules/generators/html/vuln_snippets/idor_product_template/secgen_metadata.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ IDOR Product Vulnerability Generator
+ Thalita Vergilio
+ MIT
+ Generates a php template with a vector that is vulnerable to insecure direct object reference attacks
+
+ idor_snippet
+ unix
+
+
+
+
+
+
+
+
+ generated_attack_template
+
diff --git a/modules/generators/html/vuln_snippets/xss_search_template/secgen_local/local.rb b/modules/generators/html/vuln_snippets/xss_search_template/secgen_local/local.rb
index b8455f9a1..15cc0faa2 100644
--- a/modules/generators/html/vuln_snippets/xss_search_template/secgen_local/local.rb
+++ b/modules/generators/html/vuln_snippets/xss_search_template/secgen_local/local.rb
@@ -61,38 +61,42 @@ class XSSsearchTemplateGenerator < StringEncoder
query ="if(isset($_POST['submit'])){
$search=mysqli_real_escape_string($conn2, $_POST['search']);
- $statement=\"SELECT * FROM #{table_name} WHERE #{name} LIKE '%\" .$search .\"%'\"; "
+ $statement=\"SELECT * FROM #{table_name} WHERE #{name} LIKE '%\" .$search .\"%' "
elsif difficulty.eql? 'medium'
query = "if(isset($_POST['submit'])){
$blacklist = array(#{medium_blacklist_insert});
$search=str_replace($blacklist, \"\", $_POST['search']);
- $statement=\"SELECT * FROM #{table_name} WHERE #{name} LIKE '%\" .$search .\"%'\"; "
+ $statement=\"SELECT * FROM #{table_name} WHERE #{name} LIKE '%\" .$search .\"%' "
elsif difficulty.eql? 'hard'
query = "if(isset($_POST['submit'])){
$blacklist = array(#{blacklist_insert});
$search=str_replace($blacklist, \"\", $_POST['search']);
- $statement=\"SELECT * FROM #{table_name} WHERE #{name} LIKE '%\" .$search .\"%'\"; "
+ $statement=\"SELECT * FROM #{table_name} WHERE #{name} LIKE '%\" .$search .\"%' "
else
query = "if(isset($_POST['submit'])){
$search=htmlspecialchars(mysqli_real_escape_string($conn2, $_POST['search']));
- $statement=\"SELECT * FROM #{table_name} WHERE #{name} LIKE '%\" .$search .\"%'\";"
+ $statement=\"SELECT * FROM #{table_name} WHERE #{name} LIKE '%\" .$search .\"%' "
end
+ query << "ORDER BY ID LIMIT 6 \";"
+
submit = "You searched for: '.$search.'
';
while ($row=mysqli_fetch_assoc($result)){
?>