Skip to content

YARA · ditekSHen detection

DITEKSHEN_MALWARE_Win_R77

Detects r77 rootkit

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

What this rule detects

Detects r77 rootkit

Associated malware family: R77.

Targets: Windows PE.

It defines 8 patterns (8 text, 0 hex, 0 regex). YARA modules used: pe.

YARA-X says: warning[deprecated_field]: field `number_of_sections` is deprecated

Summary generated from the rule's metadata and condition.

Rule source

Includes the imports needed to compile it on its own.

malware-win-r77.yarBSD 2-Clause License
import "pe"

rule DITEKSHEN_MALWARE_Win_R77 : FILE
{
	meta:
		description = "Detects r77 rootkit"
		author = "ditekSHen"
		id = "813d207e-c6d9-5fea-8387-19da33bc3317"
		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#L11192-L11217"
		license_url = "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/LICENSE.txt"
		logic_hash = "e3ec6e88a3a77b7dc69eb51a528e6417f6b8695c7cb01d699cf248cebd9b84e2"
		score = 75
		quality = 75
		tags = "FILE"

	strings:
		$s1 = "startup" fullword wide
		$s2 = "process_names" fullword wide
		$s3 = "paths" fullword wide
		$s4 = "service_names" fullword wide
		$s5 = "tcp_local" fullword wide
		$s6 = "tcp_remote" fullword wide
		$s7 = "\\\\.\\pipe\\" wide
		$s8 = "SOFTWARE\\" wide

	condition:
		uint16( 0 ) == 0x5a4d and ( all of ( $s* ) or ( 5 of them and pe.exports ( "ReflectiveDllMain" ) ) or ( 5 of them and for any i in ( 0 .. pe.number_of_sections ) : ( ( pe.sections [ i ] . name == ".detourd" ) ) ) )
}

Strings (8 patterns)

IdentifierTypeValueModifiers
$s1text"startup"fullword wide
$s2text"process_names"fullword wide
$s3text"paths"fullword wide
$s4text"service_names"fullword wide
$s5text"tcp_local"fullword wide
$s6text"tcp_remote"fullword wide
$s7text"\\\\.\\pipe\\"wide
$s8text"SOFTWARE\\"wide

Condition

uint16( 0 ) == 0x5a4d and ( all of ( $s* ) or ( 5 of them and pe.exports ( "ReflectiveDllMain" ) ) or ( 5 of them and for any i in ( 0 .. pe.number_of_sections ) : ( ( pe.sections [ i ] . name == ".detourd" ) ) ) )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • All patterns in ( $s* ) must match.
  • At least 5 patterns in the rule must match.
  • A for-loop checks a property over several matches or items.
  • Uses the pe module.
  • Checks exported functions or the DLL name.
  • Checks PE sections (names, count or properties).

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: 813d207e-c6d9-5fea-8387-19da33bc3317

Tags:FILE