Skip to content

YARA · elceef yara-rulz

ELCEEF_BAT_Begin_Substring_Env

Detects suspicious substring syntax at the begining of batch script

Suspicious / huntingelceef yara-rulzMIT LicenseCompiles with YARA-X
Author
marcin@ulikowski.pl
Date
2023-06-02
Modified
2024-04-10
Score / Quality
65 / 75

What this rule detects

Detects suspicious substring syntax at the begining of batch script

It defines 2 patterns (1 text, 1 hex, 0 regex).

Summary generated from the rule's metadata and condition.

Rule source

bat-begin-substring-env.yarMIT License
rule ELCEEF_BAT_Begin_Substring_Env
{
	meta:
		description = "Detects suspicious substring syntax at the begining of batch script"
		author = "marcin@ulikowski.pl"
		id = "3fca187b-d2e7-595c-9330-25141a54285b"
		date = "2023-06-02"
		modified = "2024-04-10"
		reference = "https://cybersecurity.att.com/blogs/labs-research/seroxen-rat-for-sale"
		source_url = "https://github.com/elceef/yara-rulz/blob/5683b294a12cf0c875b624933586029ae43a852f/rules/Suspicious_BAT.yara#L39-L55"
		license_url = "https://github.com/elceef/yara-rulz/blob/5683b294a12cf0c875b624933586029ae43a852f/LICENSE"
		hash = "8ace121fae472cc7ce896c91a3f1743d5ccc8a389bc3152578c4782171c69e87"
		logic_hash = "cc5e6e511bbc0a5cbb277ed0cbac1f2b21db8e21c4cdc802b6a1c3313d3b55cc"
		score = 65
		quality = 75
		tags = ""

	strings:
		$echo = "@echo off"
		$substr = { 3a 7e ( 3? 2c 3? | 2d 3? 2c 3? | 3? 2c 2d 3? | 3? 3? 2c 3? | 2d 3? 3? 2c 3? | 3? 3? 2c 2d 3? ) 25 }

	condition:
		$echo in ( 0 .. 4 ) and $substr in ( 10 .. 100 )
}

Strings (2 patterns)

IdentifierTypeValueModifiers
$echotext"@echo off"
$substrhex{ 3a 7e ( 3? 2c 3? | 2d 3? 2c 3? | 3? 2c 2d 3? | 3? 3? 2c 3? | 2d 3? 3? 2c 3? | 3? 3? 2c 2d 3? ) 25 }

Condition

$echo in ( 0 .. 4 ) and $substr in ( 10 .. 100 )

In plain words (Heuristic)

  • Pattern $echo must be found within the range 0 .. 4.
  • Pattern $substr must be found within the range 10 .. 100.

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.

Open in editor

References

Sample hashes

Hashes of samples the author lists in the rule's meta (look them up in your threat-intelligence platform).

  • 8ace121fae472cc7ce896c91a3f1743d5ccc8a389bc3152578c4782171c69e87

Licence & attribution

Author: marcin@ulikowski.pl

Source repository: elceef yara-rulz @ 5683b294a1

Licence: MIT License (repository licence)

Copyright notice: Copyright (c) 2022 Marcin Ulikowski

Original rule

Mirrored via YARA Forge 20260927, which prefixes rule names with the source and adds normalised meta fields.

Rule id: 3fca187b-d2e7-595c-9330-25141a54285b