Skip to content

YARA · SEKOIA.IO Community

SEKOIA_Apt_Sofacy_Graphitemalware_Generic

Detects APT28 graphite malware based on strings

APT / threat actorGraphiteSEKOIA.IO CommunityDetection Rule License 1.1Compiles with YARA-X
Author
Sekoia.io
Date
2022-09-27
Modified
2024-12-19
Score / Quality
75 / 80

What this rule detects

Detects APT28 graphite malware based on strings

Associated malware family: Graphite.

Targets: Windows PE.

It defines 7 patterns (7 text, 0 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.

apt-sofacy-graphitemalware-generic.yarDetection Rule License 1.1
import "pe"

rule SEKOIA_Apt_Sofacy_Graphitemalware_Generic : FILE
{
	meta:
		description = "Detects APT28 graphite malware based on strings"
		author = "Sekoia.io"
		id = "6b51cfa3-4a7d-4c2a-9fd9-f129b8a18466"
		date = "2022-09-27"
		modified = "2024-12-19"
		reference = "https://github.com/SEKOIA-IO/Community"
		source_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/yara_rules/apt_sofacy_graphitemalware_generic.yar#L3-L25"
		license_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/LICENSE.md"
		logic_hash = "f4c994c36768bae6d6e3b5aeefb634e485ab7b483a693781f29d5ff44c71996f"
		score = 75
		quality = 80
		tags = "FILE"
		version = "1.0"
		classification = "TLP:CLEAR"

	strings:
		$ = "Microsoft Enhanced RSA and AES Cryptographic Provider" wide
		$ = "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)" wide
		$ = "%s %04d sp%1d.%1d %s"
		$ = "%s%c%s%c%s"
		$ = "InternetReadFile"
		$ = "ObtainUserAgentString"
		$ = "CryptImportKey"

	condition:
		uint16be( 0 ) == 0x4d5a and filesize < 100KB and ( all of them or pe.imphash ( ) == "c56c322548250651361aef7dacf93eaf" )
}

Strings (7 patterns)

IdentifierTypeValueModifiers
$text"Microsoft Enhanced RSA and AES Cryptographic Provider"wide
$text"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"wide
$text"%s %04d sp%1d.%1d %s"
$text"%s%c%s%c%s"
$text"InternetReadFile"
$text"ObtainUserAgentString"
$text"CryptImportKey"

Condition

uint16be( 0 ) == 0x4d5a and filesize < 100KB and ( all of them or pe.imphash ( ) == "c56c322548250651361aef7dacf93eaf" )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • The file must be smaller than 100KB (a cheap guard that skips large files).
  • All patterns in the rule must match.
  • Uses the pe module.
  • Checks the PE import hash (imphash).

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: 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: 6b51cfa3-4a7d-4c2a-9fd9-f129b8a18466

Metadata

version1.0
classificationTLP:CLEAR

Tags:FILE

More Graphite rules