Skip to content

YARA · Signature Base (Florian Roth / Nextron)

SIGNATURE_BASE_APT_MAL_ASP_DLL_HAFNIUM_Mar21_1

Detects HAFNIUM compiled ASP.NET DLLs dropped on compromised servers

APT / threat actorSignature Base (Florian Roth / Nextron)Detection Rule License 1.1Compiles with YARA-X
Author
Florian Roth (Nextron Systems)
Date
2021-03-05
Modified
2023-12-05
Score / Quality
65 / 85

What this rule detects

Detects HAFNIUM compiled ASP.NET DLLs dropped on compromised servers

Targets: Windows PE.

It defines 6 patterns (1 text, 5 hex, 0 regex).

Summary generated from the rule's metadata and condition.

Rule source

apt-mal-asp-dll-hafnium-mar21-1.yarDetection Rule License 1.1
rule SIGNATURE_BASE_APT_MAL_ASP_DLL_HAFNIUM_Mar21_1 : FILE
{
	meta:
		description = "Detects HAFNIUM compiled ASP.NET DLLs dropped on compromised servers"
		author = "Florian Roth (Nextron Systems)"
		id = "68b8252e-a07d-5507-b556-a4d473f98157"
		date = "2021-03-05"
		modified = "2023-12-05"
		reference = "https://www.microsoft.com/security/blog/2021/03/02/hafnium-targeting-exchange-servers/"
		source_url = "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/yara/apt_hafnium.yar#L297-L325"
		license_url = "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/LICENSE"
		hash = "097f5f700c000a13b91855beb61a931d34fb0abb738a110368f525e25c5bc738"
		hash = "15744e767cbaa9b37ff7bb5c036dda9b653fc54fc9a96fe73fbd639150b3daa3"
		hash = "52ae4de2e3f0ef7fe27c699cb60d41129a3acd4a62be60accc85d88c296e1ddb"
		hash = "5f0480035ee23a12302c88be10e54bf3adbcf271a4bb1106d4975a28234d3af8"
		hash = "6243fd2826c528ee329599153355fd00153dee611ca33ec17effcf00205a6e4e"
		hash = "ebf6799bb86f0da2b05e66a0fe5a9b42df6dac848f4b951b2ed7b7a4866f19ef"
		logic_hash = "a4a3f9c7029e67647823a13079655b24648f5e4a7e238439b7a933b19477c20c"
		score = 65
		quality = 85
		tags = "FILE"

	strings:
		$s1 = "Page_Load" ascii fullword
		$sc1 = { 20 00 3A 00 20 00 68 00 74 00 74 00 70 00 3A 00
               2F 00 2F 00 (66|67) 00 2F 00 00 89 A3 0D 00 0A 00 }
		$op1 = { 00 43 00 58 00 77 00 30 00 4a 00 45 00 00 51 7e 00 2f }
		$op2 = { 58 00 77 00 30 00 4a 00 45 00 00 51 7e 00 2f 00 61 00 }
		$op3 = { 01 0e 0e 05 20 01 01 11 79 04 07 01 12 2d 04 07 01 12 31 02 }
		$op4 = { 5e 00 03 00 bc 22 00 00 00 00 01 00 85 03 2b 00 03 00 cc }

	condition:
		uint16( 0 ) == 0x5a4d and filesize < 50KB and all of ( $s* ) or all of ( $op* )
}

Strings (6 patterns)

IdentifierTypeValueModifiers
$s1text"Page_Load"ascii fullword
$sc1hex{ 20 00 3A 00 20 00 68 00 74 00 74 00 70 00 3A 00 2F 00 2F 00 (66|67) 00 2F 00 00 89 A3 0D 00 0A 00 }
$op1hex{ 00 43 00 58 00 77 00 30 00 4a 00 45 00 00 51 7e 00 2f }
$op2hex{ 58 00 77 00 30 00 4a 00 45 00 00 51 7e 00 2f 00 61 00 }
$op3hex{ 01 0e 0e 05 20 01 01 11 79 04 07 01 12 2d 04 07 01 12 31 02 }
$op4hex{ 5e 00 03 00 bc 22 00 00 00 00 01 00 85 03 2b 00 03 00 cc }

Condition

uint16( 0 ) == 0x5a4d and filesize < 50KB and all of ( $s* ) or all of ( $op* )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • The file must be smaller than 50KB (a cheap guard that skips large files).
  • All patterns in ( $s* ) must match.
  • All 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).

  • 097f5f700c000a13b91855beb61a931d34fb0abb738a110368f525e25c5bc738
  • 15744e767cbaa9b37ff7bb5c036dda9b653fc54fc9a96fe73fbd639150b3daa3
  • 52ae4de2e3f0ef7fe27c699cb60d41129a3acd4a62be60accc85d88c296e1ddb
  • 5f0480035ee23a12302c88be10e54bf3adbcf271a4bb1106d4975a28234d3af8
  • 6243fd2826c528ee329599153355fd00153dee611ca33ec17effcf00205a6e4e
  • ebf6799bb86f0da2b05e66a0fe5a9b42df6dac848f4b951b2ed7b7a4866f19ef

Licence & attribution

Author: Florian Roth (Nextron Systems)

Source repository: Signature Base (Florian Roth / Nextron) @ 94a1c48d7a

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: 68b8252e-a07d-5507-b556-a4d473f98157

Tags:FILE