YARA · elceef yara-rulz
ELCEEF_BAT_Obfuscated_Setenv
Detects batch script with obfuscated SET command located directly after @echo off
- Author
- marcin@ulikowski.pl
- Date
- 2023-05-01
- Modified
- 2023-05-05
- Score / Quality
- 75 / 75
What this rule detects
Detects batch script with obfuscated SET command located directly after @echo off
It defines 2 patterns (0 text, 2 hex, 0 regex).
Summary generated from the rule's metadata and condition.
Rule source
rule ELCEEF_BAT_Obfuscated_Setenv
{
meta:
= "Detects batch script with obfuscated SET command located directly after @echo off"
= "marcin@ulikowski.pl"
= "999d192e-a792-5953-b9e2-de4b298444d3"
= "2023-05-01"
= "2023-05-05"
= "https://twitter.com/wdormann/status/1651631372438585344"
= "https://github.com/elceef/yara-rulz/blob/5683b294a12cf0c875b624933586029ae43a852f/rules/Suspicious_BAT.yara#L1-L20"
= "https://github.com/elceef/yara-rulz/blob/5683b294a12cf0c875b624933586029ae43a852f/LICENSE"
= "a0f43c5748ada07a12af81dda2460045030f936a8d5081f3a403f85c2a9668f8"
= "1a0ca873412474a6437d33e48071aa0169f8317b5c996e1b10a41791707b2cf5"
= "83e47d4f3dd43ed01dc573f0b83e9e71f0ec75b6ea5712f640585d01d8aedf3c"
= "cf351a2b1f0a157a92be2e01e460140e2c1d0ee1685474144f2203a97d2de489"
= "da3a2245207d79cb720079cc2bc88d5f9db22fc16601d21e7c8dcea381ed11e9"
= 75
= 75
= ""
strings:
$s1 = { 40 65 63 68 6f 20 6f 66 66 0d 0a ( 73 65 25 | 73 25 | 25 ) [2-26] 3a 7e [0-6] 3? 25 ( 25 | 20 | 65 25 | 74 20 | 65 74 20 ) }
$s2 = { 40 65 63 68 6f 20 6f 66 66 0d 0a 73 65 74 20 22 [4] 3d 73 65 74 20 22 0d 0a 25 }
condition:
$s1 in ( 0 .. 4 ) or $s2 in ( 0 .. 4 )
}
Strings (2 patterns)
| Identifier | Type | Value | Modifiers |
|---|---|---|---|
| $s1 | hex | { 40 65 63 68 6f 20 6f 66 66 0d 0a ( 73 65 25 | 73 25 | 25 ) [2-26] 3a 7e [0-6] 3? 25 ( 25 | 20 | 65 25 | 74 20 | 65 74 20 ) } | |
| $s2 | hex | { 40 65 63 68 6f 20 6f 66 66 0d 0a 73 65 74 20 22 [4] 3d 73 65 74 20 22 0d 0a 25 } |
Condition
$s1 in ( 0 .. 4 ) or $s2 in ( 0 .. 4 )In plain words (Heuristic)
- Pattern $s1 must be found within the range 0 .. 4.
- Pattern $s2 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.
Sample hashes
Hashes of samples the author lists in the rule's meta (look them up in your threat-intelligence platform).
- a0f43c5748ada07a12af81dda2460045030f936a8d5081f3a403f85c2a9668f8
- 1a0ca873412474a6437d33e48071aa0169f8317b5c996e1b10a41791707b2cf5
- 83e47d4f3dd43ed01dc573f0b83e9e71f0ec75b6ea5712f640585d01d8aedf3c
- cf351a2b1f0a157a92be2e01e460140e2c1d0ee1685474144f2203a97d2de489
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: 999d192e-a792-5953-b9e2-de4b298444d3
Related rules
- Suspicious / huntingelceef yara-rulz· marcin@ulikowski.pl· 2023-06-02
- Suspicious / huntingelceef yara-rulz· marcin@ulikowski.pl· 2023-02-01
- Suspicious / huntingelceef yara-rulz· marcin@ulikowski.pl· 2023-01-22
- Suspicious / huntingelceef yara-rulz· marcin@ulikowski.pl· 2023-04-04
- Exploitelceef yara-rulz· marcin@ulikowski.pl· 2025-08-18
- Genericelceef yara-rulz· marcin@ulikowski.pl· 2024-04-10
- Genericelceef yara-rulz· marcin@ulikowski.pl· 2023-05-05
- Genericelceef yara-rulz· marcin@ulikowski.pl· 2023-04-17