Skip to content

Commit 5331c34

Browse files
committed
Use the encoder in all the #test_vulnerable methods from the common class
1 parent e79161c commit 5331c34

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

lib/msf/core/exploit/sqli/mssqli/common.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ def dump_table_fields(table, columns, condition = '', num_limit = 0)
182182
def test_vulnerable
183183
random_string_len = @truncation_length ? [rand(2..10), @truncation_length].min : rand(2..10)
184184
random_string = Rex::Text.rand_text_alphanumeric(random_string_len)
185-
run_sql("select '#{random_string}'") == random_string
185+
query_string = "'#{random_string}'"
186+
query_string = @encoder[:encode].sub(/\^DATA\^/, query_string) if @encoder
187+
output = run_sql("select #{query_string}")
188+
(@encoder ? @encoder[:decode].call(output) : output) == random_string
186189
end
187190

188191
#

lib/msf/core/exploit/sqli/mysqli/common.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ def dump_table_fields(table, columns, condition = '', num_limit = 0)
197197
def test_vulnerable
198198
random_string_len = @truncation_length ? [rand(2..10), @truncation_length].min : rand(2..10)
199199
random_string = Rex::Text.rand_text_alphanumeric(random_string_len)
200-
run_sql("select '#{random_string}'") == random_string
200+
query_string = "'#{random_string}'"
201+
query_string = @encoder[:encode].sub(/\^DATA\^/, query_string) if @encoder
202+
output = run_sql("select #{query_string}")
203+
(@encoder ? @encoder[:decode].call(output) : output) == random_string
201204
end
202205

203206
#

lib/msf/core/exploit/sqli/postgresqli/common.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ def dump_table_fields(table, columns, condition = '', num_limit = 0)
189189
def test_vulnerable
190190
random_string_len = @truncation_length ? [rand(2..10), @truncation_length].min : rand(2..10)
191191
random_string = Rex::Text.rand_text_alphanumeric(random_string_len)
192-
run_sql("select '#{random_string}'") == random_string
192+
query_string = "'#{random_string}'"
193+
query_string = @encoder[:encode].sub(/\^DATA\^/, query_string) if @encoder
194+
output = run_sql("select #{query_string}")
195+
(@encoder ? @encoder[:decode].call(output) : output) == random_string
193196
end
194197

195198
#

0 commit comments

Comments
 (0)