Skip to content

YARA · ditekSHen detection

DITEKSHEN_MALWARE_Win_WSHRATJS

Detects WSHRAT JS variants

MalwareWSHRATJSditekSHen detectionBSD 2-Clause LicenseCompiles with YARA-X
Author
ditekSHen
Date
2020-11-06
Modified
2024-11-01
Score / Quality
75 / 75

What this rule detects

Detects WSHRAT JS variants

Associated malware family: WSHRATJS.

It defines 10 patterns (10 text, 0 hex, 0 regex).

Summary generated from the rule's metadata and condition.

Rule source

malware-win-wshratjs.yarBSD 2-Clause License
rule DITEKSHEN_MALWARE_Win_WSHRATJS : FILE
{
	meta:
		description = "Detects WSHRAT JS variants"
		author = "ditekSHen"
		id = "7dbaea67-48dc-5fb8-ba58-b0d6eeca207b"
		date = "2020-11-06"
		modified = "2024-11-01"
		reference = "https://github.com/ditekshen/detection"
		source_url = "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/yara/malware.yar#L4028-L4045"
		license_url = "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/LICENSE.txt"
		logic_hash = "9956ed4613ac403360ab0222a7ed62350fcd998710843bd6700717f8bbb5052e"
		score = 75
		quality = 75
		tags = "FILE"

	strings:
		$charset_full = "us-ascii" nocase ascii
		$charset_begin = "\"us-\"" nocase ascii
		$charset_end = "Array(97,115,99,105,105)" nocase ascii
		$wsc_object1 = "WScript.CreateObject(\"System.Text.UTF8Encoding" nocase ascii
		$wsc_object2 = "WScript.CreateObject(\"Adodb.Stream" nocase ascii
		$wsc_object3 = "WScript.CreateObject(\"Microsoft.XmlDom" nocase ascii
		$s1 = "function(){return" ascii
		$s2 = "}catch(err){" ascii
		$s3 = "{item: \"bin.base64\"}" nocase ascii
		$s4 = "* 1].item =" ascii

	condition:
		filesize < 400KB and ( $charset_full or ( $charset_begin and $charset_end ) ) and 2 of ( $wsc_object* ) and 3 of ( $s* )
}

Strings (10 patterns)

IdentifierTypeValueModifiers
$charset_fulltext"us-ascii"nocase ascii
$charset_begintext"\"us-\""nocase ascii
$charset_endtext"Array(97,115,99,105,105)"nocase ascii
$wsc_object1text"WScript.CreateObject(\"System.Text.UTF8Encoding"nocase ascii
$wsc_object2text"WScript.CreateObject(\"Adodb.Stream"nocase ascii
$wsc_object3text"WScript.CreateObject(\"Microsoft.XmlDom"nocase ascii
$s1text"function(){return"ascii
$s2text"}catch(err){"ascii
$s3text"{item: \"bin.base64\"}"nocase ascii
$s4text"* 1].item ="ascii

Condition

filesize < 400KB and ( $charset_full or ( $charset_begin and $charset_end ) ) and 2 of ( $wsc_object* ) and 3 of ( $s* )

In plain words (Heuristic)

  • The file must be smaller than 400KB (a cheap guard that skips large files).
  • At least 2 patterns in ( $wsc_object* ) must match.
  • At least 3 patterns in ( $s* ) must match.
  • Pattern $charset_full must be present.
  • Pattern $charset_begin must be present.
  • Pattern $charset_end must be present.

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

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).

Original rule

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

Rule id: 7dbaea67-48dc-5fb8-ba58-b0d6eeca207b

Tags:FILE