YARA · elceef yara-rulz
ELCEEF_BAT_Chunked_Payload_Setenv
Detects batch script storing chunks of payload in random environment variables
- Author
- marcin@ulikowski.pl
- Date
- 2023-05-05
- Modified
- 2024-04-10
- Score / Quality
- 75 / 75
What this rule detects
Detects batch script storing chunks of payload in random environment variables
It defines 2 patterns (1 text, 1 hex, 0 regex).
Summary generated from the rule's metadata and condition.
Rule source
rule ELCEEF_BAT_Chunked_Payload_Setenv
{
meta:
= "Detects batch script storing chunks of payload in random environment variables"
= "marcin@ulikowski.pl"
= "18f3ddac-bc19-5b54-891e-93271d59490a"
= "2023-05-05"
= "2024-04-10"
= "https://github.com/elceef/yara-rulz"
= "https://github.com/elceef/yara-rulz/blob/5683b294a12cf0c875b624933586029ae43a852f/rules/Suspicious_BAT.yara#L22-L37"
= "https://github.com/elceef/yara-rulz/blob/5683b294a12cf0c875b624933586029ae43a852f/LICENSE"
= "f73521adbf89be99c4d7ea74ebf7fed815af49ce4dc060656d7c9c631e4d0538"
= "6b202d1a5723db664c7ca689c73fc1f84365801fd56fc9a035c8d3a0b6b2b9da"
= 75
= 75
= ""
strings:
$echo = "@echo off"
$set = { ( 0d 0a | 26 20 ) 73 65 74 20 22 [10] 3d [2-6] 22 }
condition:
$echo in ( 0 .. 4 ) and #set > 10
}
Strings (2 patterns)
| Identifier | Type | Value | Modifiers |
|---|---|---|---|
| $echo | text | "@echo off" | |
| $set | hex | { ( 0d 0a | 26 20 ) 73 65 74 20 22 [10] 3d [2-6] 22 } |
Condition
$echo in ( 0 .. 4 ) and #set > 10In plain words (Heuristic)
- Pattern $set must occur > 10 times.
- Pattern $echo must be found within the range 0 .. 4.
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
Sample hashes
Hashes of samples the author lists in the rule's meta (look them up in your threat-intelligence platform).
- f73521adbf89be99c4d7ea74ebf7fed815af49ce4dc060656d7c9c631e4d0538
Licence & attribution
Author: marcin@ulikowski.pl
Source repository: elceef yara-rulz @ 5683b294a1
Licence: MIT License (repository licence)
Copyright notice: Copyright (c) 2022 Marcin Ulikowski
Mirrored via YARA Forge 20260927, which prefixes rule names with the source and adds normalised meta fields.
Rule id: 18f3ddac-bc19-5b54-891e-93271d59490a
Related rules
- Exploitelceef yara-rulz· marcin@ulikowski.pl· 2025-08-18
- Genericelceef yara-rulz· marcin@ulikowski.pl· 2024-04-10
- Suspicious / huntingelceef yara-rulz· marcin@ulikowski.pl· 2023-05-01
- Genericelceef yara-rulz· marcin@ulikowski.pl· 2023-04-17
- Exploitelceef yara-rulz· marcin@ulikowski.pl· 2023-09-23
- Genericelceef yara-rulz· marcin@ulikowski.pl· 2023-03-08
- Genericelceef yara-rulz· marcin@ulikowski.pl· 2022-10-25
- Genericelceef yara-rulz· marcin@ulikowski.pl· 2022-12-02