Skip to content

YARA · ditekSHen detection

DITEKSHEN_MALWARE_Win_PYSA

Detects PYSA/Mespinoza ransomware

MalwarePYSAditekSHen 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 PYSA/Mespinoza ransomware

Associated malware family: PYSA.

Targets: Windows PE.

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

Summary generated from the rule's metadata and condition.

Rule source

malware-win-pysa.yarBSD 2-Clause License
rule DITEKSHEN_MALWARE_Win_PYSA : FILE
{
	meta:
		description = "Detects PYSA/Mespinoza ransomware"
		author = "ditekSHen"
		id = "3a3fad6a-46bc-51dc-9723-4412034ca442"
		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#L2080-L2100"
		license_url = "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/LICENSE.txt"
		logic_hash = "e614b827bd8d065e94852fed01497c785bf90c52c3624aff9939b3f40ecf96a4"
		score = 75
		quality = 75
		tags = "FILE"
		clamav_sig = "MALWARE.Win.Ransomware.PYSA"

	strings:
		$s1 = "%s\\Readme.README" fullword wide
		$s2 = "Every byte on any types of your devices was encrypted" ascii
		$s3 = { 6c 65 67 61 6c 6e 6f 74 69 63 65 74 65 78 74 00 (50|70) (59|79) (53|73) (41|61) }
		$s4 = { 6c 65 67 61 6c 6e 6f 74 69 63 65 63 61 70 74 69 6f 6e 00 00 (50|70) (59|79) (53|73) (41|61) }
		$s5 = { 2e 62 61 74 00 00 6f 70 65 6e 00 00 00 00 53
                4f 46 54 57 41 52 45 5c 4d 69 63 72 6f 73 6f
                66 74 5c 57 69 6e 64 6f 77 73 5c 43 75 72 72
                65 6e 74 56 65 72 73 69 6f 6e 5c 50 6f 6c 69
                63 69 65 73 5c 53 79 73 74 65 6d 00 00 00 }
		$f1 = ".?AVPK_EncryptorFilter@CryptoPP@@" ascii
		$f2 = ".?AV?$TF_EncryptorImpl@" ascii
		$f3 = "@VTF_EncryptorBase@CryptoPP@@" ascii

	condition:
		uint16( 0 ) == 0x5a4d and all of ( $f* ) and 3 of ( $s* )
}

Strings (8 patterns)

IdentifierTypeValueModifiers
$s1text"%s\\Readme.README"fullword wide
$s2text"Every byte on any types of your devices was encrypted"ascii
$s3hex{ 6c 65 67 61 6c 6e 6f 74 69 63 65 74 65 78 74 00 (50|70) (59|79) (53|73) (41|61) }
$s4hex{ 6c 65 67 61 6c 6e 6f 74 69 63 65 63 61 70 74 69 6f 6e 00 00 (50|70) (59|79) (53|73) (41|61) }
$s5hex{ 2e 62 61 74 00 00 6f 70 65 6e 00 00 00 00 53 4f 46 54 57 41 52 45 5c 4d 69 63 72 6f 73 6f 66 74 5c 57 69 6e 64 6f 77 73 5c 43 …
$f1text".?AVPK_EncryptorFilter@CryptoPP@@"ascii
$f2text".?AV?$TF_EncryptorImpl@"ascii
$f3text"@VTF_EncryptorBase@CryptoPP@@"ascii

Condition

uint16( 0 ) == 0x5a4d and all of ( $f* ) and 3 of ( $s* )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • All patterns in ( $f* ) 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: 3a3fad6a-46bc-51dc-9723-4412034ca442

Metadata

clamav_sigMALWARE.Win.Ransomware.PYSA

Tags:FILE