YARA · SEKOIA.IO Community
SEKOIA_Infostealer_Win_Mars_Stealer
Detect Mars Stealer based on specific strings
- Author
- Sekoia.io
- Date
- 2022-02-03
- Modified
- 2024-12-19
- Score / Quality
- 75 / 80
What this rule detects
Detect Mars Stealer based on specific strings
Associated malware family: Mars Stealer.
Targets: Windows PE.
It defines 18 patterns (17 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.
import "pe"
rule SEKOIA_Infostealer_Win_Mars_Stealer : FILE
{
meta:
= "Detect Mars Stealer based on specific strings"
= "Sekoia.io"
= "3e2c7440b2fc9e4b039e6fa8152ac8fd"
= "2022-02-03"
= "2024-12-19"
= "https://3xp0rt.com/posts/mars-stealer"
= "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/yara_rules/infostealer_win_mars_stealer.yar#L3-L44"
= "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/LICENSE.md"
= "b2b36a280c3c6cbbb8cbb9f1dd3eb48a4943ebbddb48eba2ac3d0db03924cafd"
= 75
= 80
= "FILE"
= "1.0"
= "2022-02-14"
= "TLP:CLEAR"
strings:
$dec = {a3 ?? ?? ?? ?? 68 ?? ?? ?? ?? e8 ?? ?? 00 00 83 c4 ??}
$api00 = "LoadLibrary" ascii
$api01 = "GetProcAddress" ascii
$api02 = "ExitProcess" ascii
$api03 = "advapi32.dll" ascii
$api04 = "crypt32.dll" ascii
$api05 = "GetTickCount" ascii
$api06 = "Sleep" ascii
$api07 = "GetUserDefaultLangID" ascii
$api08 = "CreateMutex" ascii
$api09 = "GetLastError" ascii
$api10 = "HeapAlloc" ascii
$api11 = "GetProcessHeap" ascii
$api12 = "GetComputerName" ascii
$api13 = "VirtualProtect" ascii
$api14 = "GetUserName" ascii
$api15 = "CryptStringToBinary" ascii
$str0 = "JohnDoe" ascii
condition:
uint16( 0 ) == 0x5A4D and ( #dec > 400 and 12 of ( $api* ) and $str0 ) or for any i in ( 0 .. pe.number_of_sections -1 ) : ( pe.sections [ i ] . name == "LLCPPC" and pe.sections [ i ] . raw_data_size < 5000 )
}
Strings (18 patterns)
| Identifier | Type | Value | Modifiers |
|---|---|---|---|
| $dec | hex | {a3 ?? ?? ?? ?? 68 ?? ?? ?? ?? e8 ?? ?? 00 00 83 c4 ??} | |
| $api00 | text | "LoadLibrary" | ascii |
| $api01 | text | "GetProcAddress" | ascii |
| $api02 | text | "ExitProcess" | ascii |
| $api03 | text | "advapi32.dll" | ascii |
| $api04 | text | "crypt32.dll" | ascii |
| $api05 | text | "GetTickCount" | ascii |
| $api06 | text | "Sleep" | ascii |
| $api07 | text | "GetUserDefaultLangID" | ascii |
| $api08 | text | "CreateMutex" | ascii |
| $api09 | text | "GetLastError" | ascii |
| $api10 | text | "HeapAlloc" | ascii |
| $api11 | text | "GetProcessHeap" | ascii |
| $api12 | text | "GetComputerName" | ascii |
| $api13 | text | "VirtualProtect" | ascii |
| $api14 | text | "GetUserName" | ascii |
| $api15 | text | "CryptStringToBinary" | ascii |
| $str0 | text | "JohnDoe" | ascii |
Condition
uint16( 0 ) == 0x5A4D and ( #dec > 400 and 12 of ( $api* ) and $str0 ) or for any i in ( 0 .. pe.number_of_sections -1 ) : ( pe.sections [ i ] . name == "LLCPPC" and pe.sections [ i ] . raw_data_size < 5000 )In plain words (Heuristic)
- The file must start with “MZ” — a Windows executable (PE).
- At least 12 patterns in ( $api* ) must match.
- Pattern $dec must occur > 400 times.
- A for-loop checks a property over several matches or items.
- Pattern $str0 must be present.
- 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.
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: 3e2c7440b2fc9e4b039e6fa8152ac8fd
Metadata
| version | 1.0 |
|---|---|
| modification_date | 2022-02-14 |
| classification | TLP:CLEAR |
Tags:FILE
Related rules
- MalwareSEKOIA.IO Community· Sekoia.io· 2022-03-10
- MalwareSEKOIA.IO Community· Sekoia.io· 2022-04-06
- MalwareMalpedia signator rules· Felix Bilstein - yara-signator at cocacoding dot com· 2026-05-04
- MalwareEmbee Research· Matthew @ Embee_Research· 2023-12-24
- MalwareSEKOIA.IO Community· Sekoia.io· 2024-07-16
- MalwareSEKOIA.IO Community· Sekoia.io· 2024-08-23
- MalwareSEKOIA.IO Community· Sekoia.io· 2024-04-22
- MalwareSEKOIA.IO Community· Sekoia.io· 2024-07-23