Skip to content

YARA · ditekSHen detection

DITEKSHEN_MALWARE_Win_Nppspy

Detects NPPSpy / Ntospy

MalwareNppspyditekSHen 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 NPPSpy / Ntospy

Associated malware family: Nppspy.

Targets: Windows PE.

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

Summary generated from the rule's metadata and condition.

Rule source

Includes the imports needed to compile it on its own.

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

rule DITEKSHEN_MALWARE_Win_Nppspy : FILE
{
	meta:
		description = "Detects NPPSpy / Ntospy"
		author = "ditekShen"
		id = "3867ba96-1162-5693-b58e-fc6fa04d880a"
		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#L11305-L11325"
		license_url = "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/LICENSE.txt"
		logic_hash = "53e929b52dddd5e3d060d2dd9937411f1ff215be4d3c67f5935c2a3fbab006d6"
		score = 75
		quality = 75
		tags = "FILE"

	strings:
		$s1 = "ntskrnl.dll" fullword ascii
		$s2 = "PasswordStealing.dll" fullword ascii
		$s3 = "ntoskrnl.dll" fullword ascii
		$s4 = "\\programdata\\packag~" ascii
		$s5 = "NPPSPY.dll" fullword ascii
		$s6 = "MSControll.dll" fullword ascii
		$s7 = "\\Windows\\Temp\\" ascii
		$s8 = "\\NPPSpy\\" ascii
		$s9 = "NPGetCaps" fullword ascii
		$s10 = "NPLogonNotify" fullword ascii
		$path = "\\GrzegorzTworek\\" ascii

	condition:
		uint16( 0 ) == 0x5a4d and ( ( pe.is_dll ( ) and filesize < 110KB and pe.number_of_exports == 2 and ( ( pe.exports ( "NPGetCaps" ) and pe.exports ( "NPLogonNotify" ) ) or ( 1 of ( $s* ) and ( pe.exports ( "NPGetCaps" ) or pe.exports ( "NPLogonNotify" ) ) ) ) ) or ( ( $path ) and any of ( $s* ) ) )
}

Strings (11 patterns)

IdentifierTypeValueModifiers
$s1text"ntskrnl.dll"fullword ascii
$s2text"PasswordStealing.dll"fullword ascii
$s3text"ntoskrnl.dll"fullword ascii
$s4text"\\programdata\\packag~"ascii
$s5text"NPPSPY.dll"fullword ascii
$s6text"MSControll.dll"fullword ascii
$s7text"\\Windows\\Temp\\"ascii
$s8text"\\NPPSpy\\"ascii
$s9text"NPGetCaps"fullword ascii
$s10text"NPLogonNotify"fullword ascii
$pathtext"\\GrzegorzTworek\\"ascii

Condition

uint16( 0 ) == 0x5a4d and ( ( pe.is_dll ( ) and filesize < 110KB and pe.number_of_exports == 2 and ( ( pe.exports ( "NPGetCaps" ) and pe.exports ( "NPLogonNotify" ) ) or ( 1 of ( $s* ) and ( pe.exports ( "NPGetCaps" ) or pe.exports ( "NPLogonNotify" ) ) ) ) ) or ( ( $path ) and any of ( $s* ) ) )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • The file must be smaller than 110KB (a cheap guard that skips large files).
  • At least one pattern in ( $s* ) must match.
  • At least 1 patterns in ( $s* ) must match.
  • Uses the pe module.
  • Checks exported functions or the DLL name.
  • Requires a DLL.

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: 3867ba96-1162-5693-b58e-fc6fa04d880a

Tags:FILE