YARA · ditekSHen detection
DITEKSHEN_MALWARE_Win_Margulasrat
Detects MargulasRAT
- Author
- ditekSHen
- Date
- 2020-11-06
- Modified
- 2024-11-01
- Score / Quality
- 75 / 75
What this rule detects
Detects MargulasRAT
Associated malware family: Margulasrat.
Targets: Windows PE.
It defines 17 patterns (16 text, 1 hex, 0 regex).
Summary generated from the rule's metadata and condition.
Rule source
malware-win-margulasrat.yarBSD 2-Clause License
rule DITEKSHEN_MALWARE_Win_Margulasrat : FILE
{
meta:
= "Detects MargulasRAT"
= "ditekSHen"
= "6efabf80-9194-542d-afd2-9bf9c8e26e55"
= "2020-11-06"
= "2024-11-01"
= "https://github.com/ditekshen/detection"
= "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/yara/malware.yar#L6786-L6810"
= "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/LICENSE.txt"
= "dd5b94c947d97cdc34032f2cb84b4975a1e8f510638857fb6dbe553bcff7d16e"
= 75
= 75
= "FILE"
strings:
$pdb1 = "G:\\VP-S-Fin\\memory\\" ascii
$pdb2 = "G:\\VP-S-Fin\\Margulas\\" ascii
$pdb3 = "G:\\VP-S-Fin\\remote" ascii
$pdb4 = "G:\\VP-S-Fin\\" ascii
$s1 = "/C choice /C Y /N /D Y /T 1 & Del " fullword wide
$s2 = "strToHash" fullword ascii
$s3 = "\\socking" fullword wide
$s4 = "\\wininets" fullword wide
$s5 = "ClientSocket" fullword ascii
$s6 = "new Stream()" fullword wide
$s7 = "CipherText" fullword ascii
$s8 = "WriteAllBytes" fullword ascii
$s9 = { 00 50 72 6f 63 65 73 73 00 45 78 69 73 74 73 00}
$s10 = "pxR/THCwdLuruMmw8wB8xAUvbno1yPGBTOV9IoOkAp/n7+paQm74pkzlfSKDpAKfTOV9IoOkAp9M5X0ig6QCn0zlfSKDpAKfTOV9IoOkAp" wide
$c1 = "149.248.52.61" wide
$c2 = "://vpn.nic.in" wide
$c3 = "://www.mod.gov.in/dod/sites/default/files/" wide
condition:
uint16( 0 ) == 0x5a4d and ( ( 1 of ( $pdb* ) and ( 1 of ( $c* ) or 3 of ( $s* ) ) ) or ( 1 of ( $c* ) and 3 of ( $s* ) ) or ( 6 of ( $s* ) ) )
}
Strings (17 patterns)
| Identifier | Type | Value | Modifiers |
|---|---|---|---|
| $pdb1 | text | "G:\\VP-S-Fin\\memory\\" | ascii |
| $pdb2 | text | "G:\\VP-S-Fin\\Margulas\\" | ascii |
| $pdb3 | text | "G:\\VP-S-Fin\\remote" | ascii |
| $pdb4 | text | "G:\\VP-S-Fin\\" | ascii |
| $s1 | text | "/C choice /C Y /N /D Y /T 1 & Del " | fullword wide |
| $s2 | text | "strToHash" | fullword ascii |
| $s3 | text | "\\socking" | fullword wide |
| $s4 | text | "\\wininets" | fullword wide |
| $s5 | text | "ClientSocket" | fullword ascii |
| $s6 | text | "new Stream()" | fullword wide |
| $s7 | text | "CipherText" | fullword ascii |
| $s8 | text | "WriteAllBytes" | fullword ascii |
| $s9 | hex | { 00 50 72 6f 63 65 73 73 00 45 78 69 73 74 73 00} | |
| $s10 | text | "pxR/THCwdLuruMmw8wB8xAUvbno1yPGBTOV9IoOkAp/n7+paQm74pkzlfSKDpAKfTOV9IoOkAp9M5X0ig6QCn0zlfSKDpAKfTOV9IoOkAp" | wide |
| $c1 | text | "149.248.52.61" | wide |
| $c2 | text | "://vpn.nic.in" | wide |
| $c3 | text | "://www.mod.gov.in/dod/sites/default/files/" | wide |
Condition
uint16( 0 ) == 0x5a4d and ( ( 1 of ( $pdb* ) and ( 1 of ( $c* ) or 3 of ( $s* ) ) ) or ( 1 of ( $c* ) and 3 of ( $s* ) ) or ( 6 of ( $s* ) ) )In plain words (Heuristic)
- The file must start with “MZ” — a Windows executable (PE).
- At least 1 patterns in ( $pdb* ) must match.
- At least 1 patterns in ( $c* ) must match.
- At least 3 patterns in ( $s* ) must match.
- At least 6 patterns in ( $s* ) must match.
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: ditekSHen
Source repository: ditekSHen detection @ e76c93dcde
Licence: BSD 2-Clause License (repository licence)
Copyright notice: Copyright 2021 by ditekSHen (https://github.com/ditekshen/detection).
Mirrored via YARA Forge 20260927, which prefixes rule names with the source and adds normalised meta fields.
Rule id: 6efabf80-9194-542d-afd2-9bf9c8e26e55
Tags:FILE
Related rules
- MalwareditekSHen detection· ditekSHen· 2034-02-17
- MalwareditekSHen detection· ditekSHen· 2020-11-06
- MalwareditekSHen detection· ditekSHen· 2020-11-06
- MalwareditekSHen detection· ditekSHen· 2020-11-06
- MalwareditekSHen detection· ditekSHen· 2020-11-06
- MalwareditekSHen detection· ditekSHen· 2020-11-06
- MalwareditekSHen detection· ditekSHen· 2020-11-06
- MalwareditekSHen detection· ditekSHen· 2020-11-06