Skip to content

YARA · ditekSHen detection

DITEKSHEN_MALWARE_Win_Mercurial

Detects Mercurial infostealer

MalwareMercurialditekSHen 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 Mercurial infostealer

Associated malware family: Mercurial.

Targets: Windows PE.

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

Summary generated from the rule's metadata and condition.

Rule source

malware-win-mercurial.yarBSD 2-Clause License
rule DITEKSHEN_MALWARE_Win_Mercurial : FILE
{
	meta:
		description = "Detects Mercurial infostealer"
		author = "ditekSHen"
		id = "c262ada2-01ca-5fc1-adef-987908514019"
		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#L6573-L6593"
		license_url = "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/LICENSE.txt"
		logic_hash = "400f8f717a4e07bf4de508c02bbcd9e82bf21f3df84c989fc622378f33e192f0"
		score = 75
		quality = 75
		tags = "FILE"

	strings:
		$x1 = "mercurial grabber" wide nocase
		$x2 = "\"text\":\"Mercurial Grabber |" wide
		$x3 = "/nightfallgt/mercurial-grabber" wide
		$s1 = "/LimerBoy/Adamantium-Thief/" ascii
		$s2 = "Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0" fullword wide
		$s3 = "StealCookies" fullword ascii
		$s4 = "StealPasswords" fullword ascii
		$s5 = "DetectDebug" fullword ascii
		$s6 = "CaptureScreen" fullword ascii
		$s7 = "WebhookContent" fullword ascii
		$s8 = /Grab(Token|Product|IP|Hardware)/ fullword ascii
		$p1 = "[\\w-]{24}\\.[\\w-]{6}\\.[\\w-]{27}" fullword ascii wide
		$p2 = "mfa\\.[\\w-]{84}" fullword ascii wide

	condition:
		uint16( 0 ) == 0x5a4d and ( 1 of ( $x* ) or 5 of ( $s* ) or ( all of ( $p* ) and 3 of ( $s* ) ) )
}

Strings (13 patterns)

IdentifierTypeValueModifiers
$x1text"mercurial grabber"wide nocase
$x2text"\"text\":\"Mercurial Grabber |"wide
$x3text"/nightfallgt/mercurial-grabber"wide
$s1text"/LimerBoy/Adamantium-Thief/"ascii
$s2text"Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0"fullword wide
$s3text"StealCookies"fullword ascii
$s4text"StealPasswords"fullword ascii
$s5text"DetectDebug"fullword ascii
$s6text"CaptureScreen"fullword ascii
$s7text"WebhookContent"fullword ascii
$s8regex/Grab(Token|Product|IP|Hardware)/fullword ascii
$p1text"[\\w-]{24}\\.[\\w-]{6}\\.[\\w-]{27}"fullword ascii wide
$p2text"mfa\\.[\\w-]{84}"fullword ascii wide

Condition

uint16( 0 ) == 0x5a4d and ( 1 of ( $x* ) or 5 of ( $s* ) or ( all of ( $p* ) and 3 of ( $s* ) ) )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • All patterns in ( $p* ) must match.
  • At least 1 patterns in ( $x* ) must match.
  • At least 5 patterns in ( $s* ) must match.
  • At least 3 patterns in ( $s* ) must match.

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: c262ada2-01ca-5fc1-adef-987908514019

Tags:FILE