Skip to content

YARA · ditekSHen detection

DITEKSHEN_MALWARE_Win_PWSH_Poshkeylogger

Detects PowerShell PoshKeylogger

MalwarePWSHditekSHen detectionBSD 2-Clause LicenseCompiles with YARA-X
Author
ditekSHen
Date
2020-11-06
Modified
2024-11-01
Score / Quality
75 / 75

What this rule detects

Detects PowerShell PoshKeylogger

Associated malware family: PWSH.

It defines 8 patterns (8 text, 0 hex, 0 regex).

Summary generated from the rule's metadata and condition.

Rule source

malware-win-pwsh-poshkeylogger.yarBSD 2-Clause License
rule DITEKSHEN_MALWARE_Win_PWSH_Poshkeylogger
{
	meta:
		description = "Detects PowerShell PoshKeylogger"
		author = "ditekSHen"
		id = "a816d716-caeb-5f08-9043-29db531f9e7c"
		date = "2020-11-06"
		modified = "2024-11-01"
		reference = "https://github.com/ditekshen/detection"
		source_url = "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/yara/malware.yar#L4612-L4627"
		license_url = "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/LICENSE.txt"
		logic_hash = "20bde87ded7e3b68bc554c4b9a6c2ef08514f0d47b6b144763927bede81ea540"
		score = 75
		quality = 75
		tags = ""

	strings:
		$s1 = "::GetKeyboardState" ascii
		$s2 = "GetAsyncKeyState(" ascii
		$s3 = "::MapVirtualKey(" ascii
		$s4 = "::GetAsyncKeyState" ascii
		$s5 = "Start-Sleep" ascii
		$s6 = "send-mailmessage" ascii
		$s7 = "[System.IO.File]::AppendAllText($" ascii
		$s8 = "new-object Management.Automation.PSCredential $" ascii

	condition:
		6 of them
}

Strings (8 patterns)

IdentifierTypeValueModifiers
$s1text"::GetKeyboardState"ascii
$s2text"GetAsyncKeyState("ascii
$s3text"::MapVirtualKey("ascii
$s4text"::GetAsyncKeyState"ascii
$s5text"Start-Sleep"ascii
$s6text"send-mailmessage"ascii
$s7text"[System.IO.File]::AppendAllText($"ascii
$s8text"new-object Management.Automation.PSCredential $"ascii

Condition

6 of them

In plain words (Heuristic)

  • At least 6 patterns in the rule must match.

Test this rule in your browser

Drop a file to scan it with this rule using YARA-X compiled to WebAssembly. Nothing is uploaded.

Drop a file here or click to chooseScanned locally with YARA-X. Files up to 200 MB.

Open in editor

References

Licence & attribution

Author: ditekSHen

Source repository: ditekSHen detection @ e76c93dcde

Licence: BSD 2-Clause License (repository licence)

Copyright notice: Copyright 2021 by ditekSHen (https://github.com/ditekshen/detection).

Original rule

Mirrored via YARA Forge 20260927, which prefixes rule names with the source and adds normalised meta fields.

Rule id: a816d716-caeb-5f08-9043-29db531f9e7c

More PWSH rules