YARA · SEKOIA.IO Community
SEKOIA_Infostealer_Win_Blackcap
Finds BlackCap Grabber samples (Python code obfuscated using Py-Fuscate)
- Author
- Sekoia.io
- Date
- 2023-03-06
- Modified
- 2024-12-19
- Score / Quality
- 75 / 80
What this rule detects
Finds BlackCap Grabber samples (Python code obfuscated using Py-Fuscate)
It defines 3 patterns (3 text, 0 hex, 0 regex).
Summary generated from the rule's metadata and condition.
Rule source
infostealer-win-blackcap.yarDetection Rule License 1.1
rule SEKOIA_Infostealer_Win_Blackcap : FILE
{
meta:
= "Finds BlackCap Grabber samples (Python code obfuscated using Py-Fuscate)"
= "Sekoia.io"
= "1aa1fadb-3413-46e2-b733-1ad2134f7be2"
= "2023-03-06"
= "2024-12-19"
= "https://github.com/SEKOIA-IO/Community"
= "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/yara_rules/infostealer_win_blackcap.yar#L1-L19"
= "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/LICENSE.md"
= "b826c88d557ea0a516534946ad9531eda1a875cb9c4ddf92d9b98f8c7b86623e"
= 75
= 80
= "FILE"
= "1.0"
= "TLP:CLEAR"
strings:
$imp01 = "import asyncio, json, ntpath, random, re, shutil, sqlite3, subprocess, threading, winreg, zipfile, httpx, psutil, win32gui, win32con, pyperclip, base64, requests, ctypes, time" ascii
$imp02 = "from ctypes import windll, wintypes, byref, cdll, Structure, POINTER, c_char, c_buffer;from Crypto.Cipher import AES;from PIL import ImageGrab;from win32crypt import CryptUnprotectData" ascii
$pyf01 = "import marshal,lzma,gzip,bz2,binascii,zlib;exec(marshal.loads(binascii.a2b_base64(b'YwAAAAAA" ascii
condition:
($imp01 in ( 0 .. 500 ) and $pyf01 in ( @imp01 + 200 .. @imp01 + 1000 ) or $imp02 in ( 0 .. 1000 ) and $pyf01 in ( @imp02 + 100 .. @imp02 + 500 ) ) and filesize > 100KB and filesize < 500KB
}
Strings (3 patterns)
| Identifier | Type | Value | Modifiers |
|---|---|---|---|
| $imp01 | text | "import asyncio, json, ntpath, random, re, shutil, sqlite3, subprocess, threading, winreg, zipfile, httpx, psutil, win32gui, win32con, pyperclip, base64, reques … | ascii |
| $imp02 | text | "from ctypes import windll, wintypes, byref, cdll, Structure, POINTER, c_char, c_buffer;from Crypto.Cipher import AES;from PIL import ImageGrab;from win32crypt … | ascii |
| $pyf01 | text | "import marshal,lzma,gzip,bz2,binascii,zlib;exec(marshal.loads(binascii.a2b_base64(b'YwAAAAAA" | ascii |
Condition
($imp01 in ( 0 .. 500 ) and $pyf01 in ( @imp01 + 200 .. @imp01 + 1000 ) or $imp02 in ( 0 .. 1000 ) and $pyf01 in ( @imp02 + 100 .. @imp02 + 500 ) ) and filesize > 100KB and filesize < 500KBIn plain words (Heuristic)
- The file must be smaller than 500KB (a cheap guard that skips large files).
- The file must be larger than 100KB.
- Pattern $imp01 must be found within the range 0 .. 500.
- Pattern $pyf01 must be found within the range @imp01 + 200 .. @imp01 + 1000.
- Pattern $imp02 must be found within the range 0 .. 1000.
- Pattern $pyf01 must be found within the range @imp02 + 100 .. @imp02 + 500.
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: 1aa1fadb-3413-46e2-b733-1ad2134f7be2
Metadata
| version | 1.0 |
|---|---|
| classification | TLP:CLEAR |
Tags:FILE
Related rules
- Suspicious / huntingSEKOIA.IO Community· Sekoia.io· 2024-02-07
- Suspicious / huntingSEKOIA.IO Community· Sekoia.io· 2024-02-07
- Suspicious / huntingSEKOIA.IO Community· Sekoia.io· 2024-03-20
- Suspicious / huntingSEKOIA.IO Community· Sekoia.io· 2022-10-11
- Suspicious / huntingSEKOIA.IO Community· Sekoia.io· 2022-12-22
- 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