Skip to content

YARA · SEKOIA.IO Community

SEKOIA_Rat_Win_Nighthawk

Detects Nighthawk RAT

MalwareNighthawkSEKOIA.IO CommunityDetection Rule License 1.1Compiles with YARA-X (with warnings)
Author
Sekoia.io
Date
2022-11-23
Modified
2024-12-19
Score / Quality
75 / 80

What this rule detects

Detects Nighthawk RAT

Associated malware family: Nighthawk.

Targets: Windows PE.

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

YARA-X says: warning[non_bool_expr]: non-boolean expression used as boolean

Summary generated from the rule's metadata and condition.

Rule source

Includes the imports needed to compile it on its own.

rat-win-nighthawk.yarDetection Rule License 1.1
import "pe"

rule SEKOIA_Rat_Win_Nighthawk : FILE
{
	meta:
		description = "Detects Nighthawk RAT"
		author = "Sekoia.io"
		id = "91bc3c5b-83fd-47f8-9652-df0f6a70b693"
		date = "2022-11-23"
		modified = "2024-12-19"
		reference = "https://github.com/SEKOIA-IO/Community"
		source_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/yara_rules/rat_win_nighthawk.yar#L3-L25"
		license_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/LICENSE.md"
		hash = "0551ca07f05c2a8278229c1dc651a2b1273a39914857231b075733753cb2b988"
		hash = "9a57919cc5c194e28acd62719487c563a8f0ef1205b65adbe535386e34e418b8"
		hash = "38881b87826f184cc91559555a3456ecf00128e01986a9df36a72d60fb179ccf"
		hash = "f3bba2bfd4ed48b5426e36eba3b7613973226983a784d24d7a20fcf9df0de74e"
		hash = "b775a8f7629966592cc7727e2081924a7d7cf83edd7447aa60627a2b67d87c94"
		logic_hash = "9a0c72de5b097f74d3c44586b8355c410470992f37d9a09c5f6db36ad6286d70"
		score = 75
		quality = 80
		tags = "FILE"
		version = "1.0"
		classification = "TLP:CLEAR"

	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 }

	condition:
		uint16( 0 ) == 0x5A4D and filesize < 2MB and ( ( 1 of them ) or ( pe.section_index ( ".profile" ) and pe.section_index ( ".detourc" ) ) )
}

Strings (2 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 }

Condition

uint16( 0 ) == 0x5A4D and filesize < 2MB and ( ( 1 of them ) or ( pe.section_index ( ".profile" ) and pe.section_index ( ".detourc" ) ) )

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 1 patterns in the rule 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: Sekoia.io

Source repository: SEKOIA.IO Community @ a438a5901a

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: 91bc3c5b-83fd-47f8-9652-df0f6a70b693

Metadata

version1.0
classificationTLP:CLEAR

Tags:FILE

More Nighthawk rules