Skip to content

YARA · ditekSHen detection

DITEKSHEN_MALWARE_Win_Khonsari

Detects Khonsari ransomware

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

What this rule detects

Detects Khonsari ransomware

Associated malware family: Khonsari.

Targets: Windows PE.

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

Summary generated from the rule's metadata and condition.

Rule source

malware-win-khonsari.yarBSD 2-Clause License
rule DITEKSHEN_MALWARE_Win_Khonsari : FILE
{
	meta:
		description = "Detects Khonsari ransomware"
		author = "ditekSHen"
		id = "2d562e62-a948-570d-8ff2-cc4835b91573"
		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#L8951-L8963"
		license_url = "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/LICENSE.txt"
		logic_hash = "2a78f36259481fccb31b2e6248fed19699b6eb05bacfd08905414764c3045943"
		score = 75
		quality = 73
		tags = "FILE"

	strings:
		$x1 = ".khonsari" fullword wide nocase
		$s1 = "Encrypt" fullword ascii
		$s2 = "CreateEncryptor" fullword ascii
		$s3 = "GenerateKey" fullword ascii
		$s4 = "277e5e6a-4da6-4138-97fa-3fecbdad0176" ascii

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

Strings (5 patterns)

IdentifierTypeValueModifiers
$x1text".khonsari"fullword wide nocase
$s1text"Encrypt"fullword ascii
$s2text"CreateEncryptor"fullword ascii
$s3text"GenerateKey"fullword ascii
$s4text"277e5e6a-4da6-4138-97fa-3fecbdad0176"ascii

Condition

uint16( 0 ) == 0x5a4d and ( ( 1 of ( $x* ) and 2 of ( $s* ) ) or ( all of ( $s* ) ) )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • All patterns in ( $s* ) must match.
  • At least 1 patterns in ( $x* ) must match.
  • At least 2 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: 2d562e62-a948-570d-8ff2-cc4835b91573

Tags:FILE