YARA · SEKOIA.IO Community
SEKOIA_Merlin_Win_Exe
Detects Merling agent (PE)
- Author
- Sekoia.io
- Date
- 2022-01-03
- Modified
- 2024-12-19
- Score / Quality
- 75 / 80
What this rule detects
Detects Merling agent (PE)
Targets: Windows PE.
It defines 4 patterns (4 text, 0 hex, 0 regex). 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.
merlin-win-exe.yarDetection Rule License 1.1
import "pe"
import "hash"
rule SEKOIA_Merlin_Win_Exe : FILE
{
meta:
= "Detects Merling agent (PE)"
= "Sekoia.io"
= "c9c57f5e-26c3-43be-b2cf-10f5129d3be4"
= "2022-01-03"
= "2024-12-19"
= "https://github.com/SEKOIA-IO/Community"
= "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/yara_rules/merlin_win_exe.yar#L4-L27"
= "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/LICENSE.md"
= "6a42e9ea9749dc894788d80cd4395da026ef3c49eab1de6802e09f8b1751f5bd"
= 75
= 80
= "FILE"
= "1.0"
= "TLP:CLEAR"
strings:
$s1 = "B.symtab" ascii
$s2 = "github.com/Ne0nd0g/merlin" ascii
$s3 = "github.com/lucas-clemente" ascii
$s4 = "SendMerlinMessage" ascii
condition:
uint16( 0 ) == 0x5A4D and for any i in ( 0 .. pe.number_of_sections -1 ) : ( hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "07b5472d347d42780469fb2654b7fc54" ) and all of them and $s1 at 591 and filesize < 15MB
}
Strings (4 patterns)
| Identifier | Type | Value | Modifiers |
|---|---|---|---|
| $s1 | text | "B.symtab" | ascii |
| $s2 | text | "github.com/Ne0nd0g/merlin" | ascii |
| $s3 | text | "github.com/lucas-clemente" | ascii |
| $s4 | text | "SendMerlinMessage" | ascii |
Condition
uint16( 0 ) == 0x5A4D and for any i in ( 0 .. pe.number_of_sections -1 ) : ( hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "07b5472d347d42780469fb2654b7fc54" ) and all of them and $s1 at 591 and filesize < 15MBIn plain words (Heuristic)
- The file must start with “MZ” — a Windows executable (PE).
- The file must be smaller than 15MB (a cheap guard that skips large files).
- All patterns in the rule must match.
- Pattern $s1 must be found at offset 591.
- 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 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.
References
Licence & attribution
Author: Sekoia.io
Source repository: SEKOIA.IO Community @ a438a5901a
Licence: Detection Rule License 1.1 (repository licence)
Mirrored via YARA Forge 20260927, which prefixes rule names with the source and adds normalised meta fields.
Rule id: c9c57f5e-26c3-43be-b2cf-10f5129d3be4
Metadata
| version | 1.0 |
|---|---|
| classification | TLP:CLEAR |
Tags:FILE
Related rules
- APT / threat actorSEKOIA.IO Community· Sekoia.io· 2024-09-10
- APT / threat actorSEKOIA.IO Community· Sekoia.io· 2024-10-21
- APT / threat actorSEKOIA.IO Community· Sekoia.io· 2024-10-21
- APT / threat actorSEKOIA.IO Community· Sekoia.io· 2024-09-27
- APT / threat actorSEKOIA.IO Community· Sekoia.io· 2024-09-27
- APT / threat actorSEKOIA.IO Community· Sekoia.io· 2024-09-23
- APT / threat actorSEKOIA.IO Community· Sekoia.io· 2024-06-11
- APT / threat actorSEKOIA.IO Community· Sekoia.io· 2024-03-06