Skip to content

Commit c45481f

Browse files
committed
fix: guard get_sqli_object JSON extraction to avoid NoMethodError
1 parent 9aef758 commit c45481f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

modules/auxiliary/gather/wp_depicter_sqli_cve_2025_2011.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,20 @@ def get_sqli_object
7878

7979
next GET_SQLI_OBJECT_FAILED_ERROR_MSG unless res&.code == 200
8080

81-
extracted = res.get_json_document.dig('hits', 0, 'content', 'id')
82-
next GET_SQLI_OBJECT_FAILED_ERROR_MSG if extracted.to_s.empty?
81+
doc = begin
82+
res.get_json_document
83+
rescue StandardError
84+
nil
85+
end
86+
value = if doc.respond_to?(:dig)
87+
doc.dig('hits', 0, 'content', 'id')
88+
else
89+
GET_SQLI_OBJECT_FAILED_ERROR_MSG
90+
end
8391

84-
extracted
92+
next GET_SQLI_OBJECT_FAILED_ERROR_MSG if value.to_s.empty?
93+
94+
value
8595
end
8696
end
8797

0 commit comments

Comments
 (0)