Skip to content

YARA · SEKOIA.IO Community

SEKOIA_Plugx_Final_Payload

Detects encrypted plugx config with a specific size

MalwarePlugxSEKOIA.IO CommunityDetection Rule License 1.1Compiles with YARA-X (with warnings)
Author
Sekoia.io
Date
2023-07-04
Modified
2024-12-19
Score / Quality
75 / 80

What this rule detects

Detects encrypted plugx config with a specific size

Associated malware family: Plugx.

Targets: Windows PE, Linux ELF.

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

YARA-X says: warning[deprecated_field]: field `number_of_sections` is deprecated

Summary generated from the rule's metadata and condition.

Rule source

Includes the imports needed to compile it on its own.

plugx-final-payload.yarDetection Rule License 1.1
import "pe"

rule SEKOIA_Plugx_Final_Payload : FILE
{
	meta:
		description = "Detects encrypted plugx config with a specific size"
		author = "Sekoia.io"
		id = "a4047324-81a7-4c17-be84-c0fa479d2f89"
		date = "2023-07-04"
		modified = "2024-12-19"
		reference = "https://github.com/SEKOIA-IO/Community"
		source_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/yara_rules/plugx_final_payload.yar#L3-L23"
		license_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/LICENSE.md"
		logic_hash = "bf5035eb7ed620edcf7a0e8e8be220451ce268fc49310f28059b60576d8c5182"
		score = 75
		quality = 80
		tags = "FILE"
		version = "1.0"
		classification = "TLP:CLEAR"

	strings:
		$s1 = {30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 88 13 00 00 60 ea 00 00 ?? ?? ?? ?? 00 00 00 00}

	condition:
		( uint32be( 0 ) == 0x7f454c46 or uint16be( 0 ) == 0x4d5a ) and filesize < 8MB and for any i in ( 0 .. pe.number_of_sections -1 ) : ( pe.sections [ i ] . name == ".data" and $s1 in ( pe.sections [ i ] . raw_data_offset..pe.sections [ i ] . raw_data_offset + pe.sections [ i ] . raw_data_size ) )
}

Strings (1 patterns)

IdentifierTypeValueModifiers
$s1hex{30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 88 13 00 00 60 ea 00 00 ?? ?? ?? ?? 00 00 00 00}

Condition

( uint32be( 0 ) == 0x7f454c46 or uint16be( 0 ) == 0x4d5a ) and filesize < 8MB and for any i in ( 0 .. pe.number_of_sections -1 ) : ( pe.sections [ i ] . name == ".data" and $s1 in ( pe.sections [ i ] . raw_data_offset..pe.sections [ i ] . raw_data_offset + pe.sections [ i ] . raw_data_size ) )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • The file must start with the ELF header — a Linux/Unix executable.
  • The file must be smaller than 8MB (a cheap guard that skips large files).
  • Pattern $s1 must be found within the range pe.sections [ i ] . raw_data_offset..pe.sections [ i ] . raw_data_offset + pe.sections [ i ] . raw_data_size.
  • A for-loop checks a property over several matches or items.
  • 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

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: a4047324-81a7-4c17-be84-c0fa479d2f89

Metadata

version1.0
classificationTLP:CLEAR

Tags:FILE

More Plugx rules