Skip to content

YARA · Signature Base (Florian Roth / Nextron)

SIGNATURE_BASE_EXT_HKTL_Nighthawk_RAT

Detects Nighthawk RAT

Hack toolNighthawkSignature Base (Florian Roth / Nextron)Detection Rule License 1.1Compiles with YARA-X
Author
Frank Boldewin (@r3c0nst)
Date
2022-11-22
Modified
2025-07-01
Score / Quality
75 / 85

What this rule detects

Detects Nighthawk RAT

Associated malware family: Nighthawk.

Targets: Windows PE.

It defines 6 patterns (0 text, 6 hex, 0 regex). YARA modules used: pe.

Summary generated from the rule's metadata and condition.

Rule source

Includes the imports needed to compile it on its own.

ext-hktl-nighthawk-rat.yarDetection Rule License 1.1
import "pe"

rule SIGNATURE_BASE_EXT_HKTL_Nighthawk_RAT : FILE
{
	meta:
		description = "Detects Nighthawk RAT"
		author = "Frank Boldewin (@r3c0nst)"
		id = "7a58b8bf-fb14-5758-bc2a-ad2c6fff1216"
		date = "2022-11-22"
		modified = "2025-07-01"
		reference = "https://www.proofpoint.com/us/blog/threat-insight/nighthawk-and-coming-pentest-tool-likely-gain-threat-actor-notice"
		source_url = "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/yara/gen_nighthawk_c2.yar#L3-L30"
		license_url = "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/LICENSE"
		hash = "0551ca07f05c2a8278229c1dc651a2b1273a39914857231b075733753cb2b988"
		hash = "9a57919cc5c194e28acd62719487c563a8f0ef1205b65adbe535386e34e418b8"
		hash = "38881b87826f184cc91559555a3456ecf00128e01986a9df36a72d60fb179ccf"
		hash = "f3bba2bfd4ed48b5426e36eba3b7613973226983a784d24d7a20fcf9df0de74e"
		hash = "b775a8f7629966592cc7727e2081924a7d7cf83edd7447aa60627a2b67d87c94"
		logic_hash = "46404445e1fee89b598b0d42888f793dd602533cff2f72524800597af5b61197"
		score = 75
		quality = 85
		tags = "FILE"

	strings:
		$pattern1 = { 48 8d 0d ?? ?? ?? ?? 51 5a 48 81 c1 ?? ?? ?? ?? 48 81 c2 ?? ?? ?? ?? ff e2 }
		$pattern2 = { 66 03 D2 66 33 D1 66 C1 E2 02 66 33 D1 66 23 D0 0F B7 C1 }
		$pattern3 = { FF 7F 48 3B F0 48 0F 47 F0 48 8D }
		$pattern4 = { 65 48 8B 04 25 30 00 00 00 8B 40 68 49 89 CA 0F 05 C3 }
		$pattern5 = { 48 B8 AA AA AA AA AA AA AA 02 48 ?? ?? ?? ?? 0F 84 }
		$pattern6 = { 65 48 8B 04 25 30 00 00 00 48 8B 80 }

	condition:
		uint16( 0 ) == 0x5A4D and filesize < 2MB and ( 3 of ( $pattern* ) or ( pe.section_index ( ".profile" ) >= 0 and pe.section_index ( ".detourc" ) >= 0 and pe.section_index ( ".detourd" ) >= 0 ) )
}

Strings (6 patterns)

IdentifierTypeValueModifiers
$pattern1hex{ 48 8d 0d ?? ?? ?? ?? 51 5a 48 81 c1 ?? ?? ?? ?? 48 81 c2 ?? ?? ?? ?? ff e2 }
$pattern2hex{ 66 03 D2 66 33 D1 66 C1 E2 02 66 33 D1 66 23 D0 0F B7 C1 }
$pattern3hex{ FF 7F 48 3B F0 48 0F 47 F0 48 8D }
$pattern4hex{ 65 48 8B 04 25 30 00 00 00 8B 40 68 49 89 CA 0F 05 C3 }
$pattern5hex{ 48 B8 AA AA AA AA AA AA AA 02 48 ?? ?? ?? ?? 0F 84 }
$pattern6hex{ 65 48 8B 04 25 30 00 00 00 48 8B 80 }

Condition

uint16( 0 ) == 0x5A4D and filesize < 2MB and ( 3 of ( $pattern* ) or ( pe.section_index ( ".profile" ) >= 0 and pe.section_index ( ".detourc" ) >= 0 and pe.section_index ( ".detourd" ) >= 0 ) )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • The file must be smaller than 2MB (a cheap guard that skips large files).
  • At least 3 patterns in ( $pattern* ) must match.
  • Uses the pe module.
  • Checks PE sections (names, count or properties).

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).

  • 0551ca07f05c2a8278229c1dc651a2b1273a39914857231b075733753cb2b988
  • 9a57919cc5c194e28acd62719487c563a8f0ef1205b65adbe535386e34e418b8
  • 38881b87826f184cc91559555a3456ecf00128e01986a9df36a72d60fb179ccf
  • f3bba2bfd4ed48b5426e36eba3b7613973226983a784d24d7a20fcf9df0de74e
  • b775a8f7629966592cc7727e2081924a7d7cf83edd7447aa60627a2b67d87c94

Licence & attribution

Author: Frank Boldewin (@r3c0nst)

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: 7a58b8bf-fb14-5758-bc2a-ad2c6fff1216

Tags:FILE

More Nighthawk rules