Skip to content

YARA · Cod3nym detection-rules

COD3NYM_SUSP_OBF_NET_Confuserex_Packer_Jan24

Detects binaries packed with ConfuserEx compression packer. This feature compresses and encrypts the actual image into a stub that unpacks and loads the original image on runtime.

Suspicious / huntingCod3nym detection-rulesDetection Rule License 1.1Compiles with YARA-X
Author
Jonathan Peters
Date
2024-01-09
Score / Quality
70 / 80

What this rule detects

Detects binaries packed with ConfuserEx compression packer. This feature compresses and encrypts the actual image into a stub that unpacks and loads the original image on runtime.

Targets: Windows PE.

It defines 5 patterns (2 text, 3 hex, 0 regex).

Summary generated from the rule's metadata and condition.

Rule source

susp-obf-net-confuserex-packer-jan24.yarDetection Rule License 1.1
rule COD3NYM_SUSP_OBF_NET_Confuserex_Packer_Jan24 : FILE
{
	meta:
		description = "Detects binaries packed with ConfuserEx compression packer. This feature compresses and encrypts the actual image into a stub that unpacks and loads the original image on runtime."
		author = "Jonathan Peters"
		id = "cd53a62f-62e3-58a1-8bc3-7f40949e3f00"
		date = "2024-01-09"
		modified = "2024-01-09"
		reference = "https://github.com/yck1509/ConfuserEx/tree/master"
		source_url = "https://github.com/cod3nym/detection-rules//blob/86a04c4594cb48895192aad4af164f21f568c136/yara/dotnet/obf_confuserex.yar#L23-L42"
		license_url = "https://github.com/cod3nym/detection-rules//blob/86a04c4594cb48895192aad4af164f21f568c136/LICENSE.md"
		hash = "2570bd4c3f564a61d6b3d589126e0940af27715e1e8d95de7863579fbe25f86f"
		logic_hash = "43aee4c01b47ca04ee516d418939ec3e90fd08566f2a4b501c4698b7f9e0225d"
		score = 70
		quality = 80
		tags = "FILE"

	strings:
		$s1 = "GCHandle" ascii
		$s2 = "GCHandleType" ascii
		$op1 = { 5A 20 89 C0 3F 14 6A 5E [8-20] 5A 20 FB 56 4D 44 6A 5E 6D 9E }
		$op2 = { 20 61 FF 6F 00 13 ?? 06 13 ?? 16 13 [10-20] 20 1F 3F 5E 00 5A}
		$op3 = { 16 91 7E [3] 04 17 91 1E 62 60 7E [3] 04 18 91 1F 10 62 60 7E [3] 04 19 91 1F 18 62 }

	condition:
		uint16( 0 ) == 0x5a4d and all of ( $s* ) and 2 of ( $op* )
}

Strings (5 patterns)

IdentifierTypeValueModifiers
$s1text"GCHandle"ascii
$s2text"GCHandleType"ascii
$op1hex{ 5A 20 89 C0 3F 14 6A 5E [8-20] 5A 20 FB 56 4D 44 6A 5E 6D 9E }
$op2hex{ 20 61 FF 6F 00 13 ?? 06 13 ?? 16 13 [10-20] 20 1F 3F 5E 00 5A}
$op3hex{ 16 91 7E [3] 04 17 91 1E 62 60 7E [3] 04 18 91 1F 10 62 60 7E [3] 04 19 91 1F 18 62 }

Condition

uint16( 0 ) == 0x5a4d and all of ( $s* ) and 2 of ( $op* )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • All patterns in ( $s* ) must match.
  • At least 2 patterns in ( $op* ) 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

Sample hashes

Hashes of samples the author lists in the rule's meta (look them up in your threat-intelligence platform).

  • 2570bd4c3f564a61d6b3d589126e0940af27715e1e8d95de7863579fbe25f86f

Licence & attribution

Author: Jonathan Peters

Source repository: Cod3nym detection-rules @ 86a04c4594

Licence: Detection Rule License 1.1 (repository licence)

Original rule

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

Rule id: cd53a62f-62e3-58a1-8bc3-7f40949e3f00

Tags:FILE