Skip to content

YARA · ditekSHen detection

DITEKSHEN_MALWARE_Win_Commonmagic

Detects CommonMagic and Modules

MalwareCommon MagicditekSHen 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 CommonMagic and Modules

Associated malware family: Common Magic.

Targets: Windows PE.

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

Summary generated from the rule's metadata and condition.

Rule source

malware-win-commonmagic.yarBSD 2-Clause License
rule DITEKSHEN_MALWARE_Win_Commonmagic : FILE
{
	meta:
		description = "Detects CommonMagic and Modules"
		author = "ditekSHen"
		id = "cbebe334-9b66-5931-8f92-25d080f7fd6a"
		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#L9645-L9660"
		license_url = "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/LICENSE.txt"
		logic_hash = "e94ba53f31f3effe12b1fbaca19fea59c0e12f742f6fc0af2a0a679bf4299cbe"
		score = 75
		quality = 75
		tags = "FILE"

	strings:
		$p1 = "\\\\.\\pipe\\PipeMd" wide
		$p2 = "\\\\.\\pipe\\PipeCrDtMd" wide
		$p3 = "\\\\.\\pipe\\PipeDtMd" wide
		$s1 = "graph.microsoft.com" fullword wide
		$s2 = "CreateNamedPipe" ascii
		$s3 = "\\CommonCommand\\" wide
		$ua1 = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36" wide
		$ua2 = "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136" wide

	condition:
		uint16( 0 ) == 0x5a4d and ( 2 of ( $p* ) and 1 of ( $s* ) ) or ( 1 of ( $ua* ) and 1 of ( $s* ) and 1 of ( $p* ) )
}

Strings (8 patterns)

IdentifierTypeValueModifiers
$p1text"\\\\.\\pipe\\PipeMd"wide
$p2text"\\\\.\\pipe\\PipeCrDtMd"wide
$p3text"\\\\.\\pipe\\PipeDtMd"wide
$s1text"graph.microsoft.com"fullword wide
$s2text"CreateNamedPipe"ascii
$s3text"\\CommonCommand\\"wide
$ua1text"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36"wide
$ua2text"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136"wide

Condition

uint16( 0 ) == 0x5a4d and ( 2 of ( $p* ) and 1 of ( $s* ) ) or ( 1 of ( $ua* ) and 1 of ( $s* ) and 1 of ( $p* ) )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • At least 2 patterns in ( $p* ) must match.
  • At least 1 patterns in ( $s* ) must match.
  • At least 1 patterns in ( $ua* ) must match.
  • At least 1 patterns in ( $p* ) 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: cbebe334-9b66-5931-8f92-25d080f7fd6a

Tags:FILE

More Common Magic rules