Skip to content

YARA · SEKOIA.IO Community

SEKOIA_Implant_Win_Mysterysnail

Detect the MysterySnail using section hashes

MalwareSEKOIA.IO CommunityDetection Rule License 1.1Compiles with YARA-X (with warnings)
Author
Sekoia.io
Date
2021-10-13
Modified
2024-12-19
Score / Quality
75 / 80

What this rule detects

Detect the MysterySnail using section hashes

Targets: Windows PE.

It has no patterns: the condition alone decides (modules, file properties or other rules). YARA modules used: pe, hash.

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.

implant-win-mysterysnail.yarDetection Rule License 1.1
import "pe"
import "hash"

rule SEKOIA_Implant_Win_Mysterysnail : FILE
{
	meta:
		description = "Detect the MysterySnail using section hashes"
		author = "Sekoia.io"
		id = "dfd2eba8-eb9c-411a-b5e0-663593453e3d"
		date = "2021-10-13"
		modified = "2024-12-19"
		reference = "https://github.com/SEKOIA-IO/Community"
		source_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/yara_rules/implant_win_mysterysnail.yar#L4-L27"
		license_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/LICENSE.md"
		logic_hash = "37c02a5916ad7ce3190ce926d576365d1e17fee0f10e9b31619ea4b6fee29ae6"
		score = 75
		quality = 80
		tags = "FILE"
		version = "1.0"
		classification = "TLP:CLEAR"

	condition:
		uint16( 0 ) == 0x5A4D and ( pe.imphash ( ) == "de0c9e6aec27d278ccdb6718b3e96e32" or for any i in ( 0 .. pe.number_of_sections -1 ) : ( hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "a41b6fb1cc34d6393e30c13a58f6ecd4" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "f263a2be76694feab7e2ce79ecf8b724" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "e9056ae96619d7aa18daa973da592afc" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "3e38e89e9e8329f5cff8a7022d88fff7" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "ce78f8599167c63e8f1c8d3e789c4a60" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "456d4f1096bf5c72cd6e1e3eb9980ec6" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "37e2bff637001fc64566fe651757f66e" ) or hash.md5 ( pe.rich_signature.clear_data ) == "e4116fffa240ba6d91b400541ce85182" )
}

Condition

uint16( 0 ) == 0x5A4D and ( pe.imphash ( ) == "de0c9e6aec27d278ccdb6718b3e96e32" or for any i in ( 0 .. pe.number_of_sections -1 ) : ( hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "a41b6fb1cc34d6393e30c13a58f6ecd4" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "f263a2be76694feab7e2ce79ecf8b724" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "e9056ae96619d7aa18daa973da592afc" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "3e38e89e9e8329f5cff8a7022d88fff7" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "ce78f8599167c63e8f1c8d3e789c4a60" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "456d4f1096bf5c72cd6e1e3eb9980ec6" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "37e2bff637001fc64566fe651757f66e" ) or hash.md5 ( pe.rich_signature.clear_data ) == "e4116fffa240ba6d91b400541ce85182" )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • A for-loop checks a property over several matches or items.
  • Uses the pe module.
  • Uses the hash module.
  • Compares a hash of the file or a part of it.
  • Checks the PE import hash (imphash).
  • 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: dfd2eba8-eb9c-411a-b5e0-663593453e3d

Metadata

version1.0
classificationTLP:CLEAR

Tags:FILE