Skip to content

YARA · ditekSHen detection

DITEKSHEN_INDICATOR_TOOL_EXP_Sharpprintnightmare

Detect SharpPrintNightmare

Suspicious / huntingditekSHen detectionBSD 2-Clause LicenseCompiles with YARA-X
Author
ditekSHen
Date
2020-11-06
Modified
2024-09-25
Score / Quality
75 / 75

What this rule detects

Detect SharpPrintNightmare

Targets: Windows PE.

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

Summary generated from the rule's metadata and condition.

Rule source

indicator-tool-exp-sharpprintnightmare.yarBSD 2-Clause License
rule DITEKSHEN_INDICATOR_TOOL_EXP_Sharpprintnightmare : FILE
{
	meta:
		description = "Detect SharpPrintNightmare"
		author = "ditekSHen"
		id = "15f52fce-27cc-52e7-91d5-7e2f6db5b596"
		date = "2020-11-06"
		modified = "2024-09-25"
		reference = "https://github.com/ditekshen/detection"
		source_url = "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/yara/indicator_tools.yar#L941-L961"
		license_url = "https://github.com/ditekshen/detection/blob/e76c93dcdedff04076380ffc60ea54e45b313635/LICENSE.txt"
		logic_hash = "22c890a22ce6b7c1a06068018364f7c5a2afe1bee5b5bc6a8bae3703a11fac26"
		score = 75
		quality = 75
		tags = "FILE"

	strings:
		$s1 = "RevertToSelf() Error:" wide
		$s2 = "NeverGonnaGiveYou" wide
		$s3 = "\\Amd64\\UNIDRV.DLL" wide
		$s4 = ":\\Windows\\System32\\DriverStore\\FileRepository\\" wide
		$s5 = "C:\\Windows\\System32\\spool\\drivers\\x64\\3\\old\\{0}\\{1}" wide
		$s6 = "\\SharpPrintNightmare\\" ascii
		$s7 = { 4e 61 6d 65 09 46 75 6c 6c 54 72 75 73 74 01 }
		$s8 = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\PackageInstallation\\Windows x64\\DriverPackages" wide
		$s9 = "ntprint.inf_amd64" wide
		$s10 = "AddPrinterDriverEx" wide
		$s11 = "addPrinter" ascii
		$s12 = "DRIVER_INFO_2" ascii
		$s13 = "APD_COPY_" ascii

	condition:
		uint16( 0 ) == 0x5a4d and 7 of them
}

Strings (13 patterns)

IdentifierTypeValueModifiers
$s1text"RevertToSelf() Error:"wide
$s2text"NeverGonnaGiveYou"wide
$s3text"\\Amd64\\UNIDRV.DLL"wide
$s4text":\\Windows\\System32\\DriverStore\\FileRepository\\"wide
$s5text"C:\\Windows\\System32\\spool\\drivers\\x64\\3\\old\\{0}\\{1}"wide
$s6text"\\SharpPrintNightmare\\"ascii
$s7hex{ 4e 61 6d 65 09 46 75 6c 6c 54 72 75 73 74 01 }
$s8text"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\PackageInstallation\\Windows x64\\DriverPackages"wide
$s9text"ntprint.inf_amd64"wide
$s10text"AddPrinterDriverEx"wide
$s11text"addPrinter"ascii
$s12text"DRIVER_INFO_2"ascii
$s13text"APD_COPY_"ascii

Condition

uint16( 0 ) == 0x5a4d and 7 of them

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • At least 7 patterns in the rule 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: 15f52fce-27cc-52e7-91d5-7e2f6db5b596

Tags:FILE