YARA · SEKOIA.IO Community
SEKOIA_Apt_Mustang_Panda_Toneins
Detect the TONEINS implant used by Mustang Panda
- Author
- Sekoia.io
- Date
- 2022-11-28
- Modified
- 2024-12-19
- Score / Quality
- 75 / 80
What this rule detects
Detect the TONEINS implant used by Mustang Panda
Targets: Windows PE.
It defines 17 patterns (8 text, 9 hex, 0 regex). YARA modules used: pe, hash.
YARA-X says: warning[text_as_hex]: hex pattern could be written as text literal
Summary generated from the rule's metadata and condition.
Rule source
Includes the imports needed to compile it on its own.
import "pe"
import "hash"
rule SEKOIA_Apt_Mustang_Panda_Toneins : FILE
{
meta:
= "Detect the TONEINS implant used by Mustang Panda"
= "Sekoia.io"
= "f178217a-ff28-4dd7-9395-f19f3e2e934c"
= "2022-11-28"
= "2024-12-19"
= "https://github.com/SEKOIA-IO/Community"
= "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/yara_rules/apt_mustang_panda_toneins.yar#L4-L44"
= "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/LICENSE.md"
= "b71932f16ffb1d8d1780b6f9b4db2f0c98d1c770829a4d2284e78c19d37e54bb"
= 75
= 80
= "FILE"
= "1.0"
= "TLP:CLEAR"
strings:
$rtti1 = ".?AVDNameNode@@"
$rtti2 = ".?AVcharNode@@"
$rtti3 = ".?AVpcharNode@@"
$rtti4 = ".?AVpDNameNode@@"
$rtti5 = ".?AVDNameStatusNode@@"
$rtti6 = ".?AVpairNode@@"
$s1 = "DefWindowProcW1222_test" wide ascii
$s2 = "schtasks /create /sc minute /mo 2 /tn" wide ascii
$fnv_CreateFile = {CE C9 CA BD}
$fnv_GetFileSize = {18 81 ED 44}
$fnv_ReadFile = {43 C9 FC 54}
$fnv_CloseHandle = {65 00 BA FA}
$fnv_WriteFile = {4A C4 07 7F}
$fnv_CreateEventA = {E2 DD D2 F9}
$fnv_TerminateProcess = {59 EE 4E F8}
$fnv_GetCurrentProcess = {45 A8 D8 6D}
$fnv_CreateProcessA = { 09 0A 7C 4A}
condition:
uint16be( 0 ) == 0x4d5a and 4 of ( $rtti* ) and filesize < 8MB 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 ) == "69f400d3ff4679294e63fb8a8ca97dbb" ) or ( all of ( $s* ) and 5 of ( $fnv* ) ) )
}
Strings (17 patterns)
| Identifier | Type | Value | Modifiers |
|---|---|---|---|
| $rtti1 | text | ".?AVDNameNode@@" | |
| $rtti2 | text | ".?AVcharNode@@" | |
| $rtti3 | text | ".?AVpcharNode@@" | |
| $rtti4 | text | ".?AVpDNameNode@@" | |
| $rtti5 | text | ".?AVDNameStatusNode@@" | |
| $rtti6 | text | ".?AVpairNode@@" | |
| $s1 | text | "DefWindowProcW1222_test" | wide ascii |
| $s2 | text | "schtasks /create /sc minute /mo 2 /tn" | wide ascii |
| $fnv_CreateFile | hex | {CE C9 CA BD} | |
| $fnv_GetFileSize | hex | {18 81 ED 44} | |
| $fnv_ReadFile | hex | {43 C9 FC 54} | |
| $fnv_CloseHandle | hex | {65 00 BA FA} | |
| $fnv_WriteFile | hex | {4A C4 07 7F} | |
| $fnv_CreateEventA | hex | {E2 DD D2 F9} | |
| $fnv_TerminateProcess | hex | {59 EE 4E F8} | |
| $fnv_GetCurrentProcess | hex | {45 A8 D8 6D} | |
| $fnv_CreateProcessA | hex | { 09 0A 7C 4A} |
Condition
uint16be( 0 ) == 0x4d5a and 4 of ( $rtti* ) and filesize < 8MB 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 ) == "69f400d3ff4679294e63fb8a8ca97dbb" ) or ( all of ( $s* ) and 5 of ( $fnv* ) ) )In plain words (Heuristic)
- The file must start with “MZ” — a Windows executable (PE).
- The file must be smaller than 8MB (a cheap guard that skips large files).
- All patterns in ( $s* ) must match.
- At least 4 patterns in ( $rtti* ) must match.
- At least 5 patterns in ( $fnv* ) must match.
- 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.
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: f178217a-ff28-4dd7-9395-f19f3e2e934c
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