SUSP_PowerShell_String_K32_RemProcess
Description
Detects suspicious PowerShell code that uses Kernel32, RemoteProccess handles or shellcode
Query · yara
strings:
$x1 = "Throw \"Unable to allocate memory in the remote process for shellcode\"" fullword ascii
$x2 = "$Kernel32Handle = $Win32Functions.GetModuleHandle.Invoke(\"kernel32.dll\")" fullword ascii
$s3 = "$RSCAddr = $Win32Functions.VirtualAllocEx.Invoke($RemoteProcHandle, [IntPtr]::Zero, [UIntPtr][UInt64]$SCLength, $Win32Constants." ascii
$s7 = "if ($RemoteProcHandle -eq [IntPtr]::Zero)" fullword ascii
$s8 = "if (($Success -eq $false) -or ([UInt64]$NumBytesWritten -ne [UInt64]$SCLength))" fullword ascii
$s9 = "$Success = $Win32Functions.WriteProcessMemory.Invoke($RemoteProcHandle, $RSCAddr, $SCPSMemOriginal, [UIntPtr][UInt64]$SCLength, " ascii
$s15 = "$TypeBuilder.DefineField('Characteristics', [UInt32], 'Public') | Out-Null" fullword ascii
condition:
uint16(0) == 0x7566 and filesize < 6000KB and 1 of them