Skip to content

YARA · dr4k0nia yara-rules

DR4K0NIA_MAL_Msil_Net_Niximports_Loader

Detects NixImports .NET loader

Malwaredr4k0nia yara-rulesDetection Rule License 1.1Compiles with YARA-X
Author
dr4k0nia
Date
2023-05-21
Modified
2023-05-22
Score / Quality
75 / 85

What this rule detects

Detects NixImports .NET loader

Targets: Windows PE.

It defines 6 patterns (4 text, 2 hex, 0 regex).

Summary generated from the rule's metadata and condition.

Rule source

mal-msil-net-niximports-loader.yarDetection Rule License 1.1
rule DR4K0NIA_MAL_Msil_Net_Niximports_Loader : FILE
{
	meta:
		description = "Detects NixImports .NET loader"
		author = "dr4k0nia"
		id = "ba0d072d-674a-5790-9381-4dac98204268"
		date = "2023-05-21"
		modified = "2023-05-22"
		reference = "https://github.com/dr4k0nia/NixImports"
		source_url = "https://github.com/dr4k0nia/yara-rules/blob/4b10f9b79a4cfb3ec9cb5675f32cc7ee6885fbd8/dotnet/msil_mal_niximports_loader.yar#L1-L21"
		license_url = "https://github.com/dr4k0nia/yara-rules/blob/4b10f9b79a4cfb3ec9cb5675f32cc7ee6885fbd8/LICENSE.md"
		logic_hash = "79421b2677705852f893fa53478deb2e4aa8bd354ac05cbf5438a3a2a15d70bf"
		score = 75
		quality = 85
		tags = "FILE"

	strings:
		$op_pe = {C2 95 C2 97 C2 B2 C2 92 C2 82 C2 82 C2 8E C2 82 C2 82 C2 82 C2 82 C2 86 C2 82}
		$op_delegate = {20 F0 C7 FF 80 20 83 BF 7F 1F 14 14}
		$a1 = "GetRuntimeProperties" ascii fullword
		$a2 = "GetTypes" ascii fullword
		$a3 = "GetRuntimeMethods" ascii fullword
		$a4 = "netstandard" ascii fullword

	condition:
		uint16( 0 ) == 0x5a4d and filesize < 3MB and all of ( $a* ) and 2 of ( $op* )
}

Strings (6 patterns)

IdentifierTypeValueModifiers
$op_pehex{C2 95 C2 97 C2 B2 C2 92 C2 82 C2 82 C2 8E C2 82 C2 82 C2 82 C2 82 C2 86 C2 82}
$op_delegatehex{20 F0 C7 FF 80 20 83 BF 7F 1F 14 14}
$a1text"GetRuntimeProperties"ascii fullword
$a2text"GetTypes"ascii fullword
$a3text"GetRuntimeMethods"ascii fullword
$a4text"netstandard"ascii fullword

Condition

uint16( 0 ) == 0x5a4d and filesize < 3MB and all of ( $a* ) and 2 of ( $op* )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • The file must be smaller than 3MB (a cheap guard that skips large files).
  • All patterns in ( $a* ) must match.
  • At least 2 patterns in ( $op* ) 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: dr4k0nia

Source repository: dr4k0nia yara-rules @ 4b10f9b79a

Licence: Detection Rule License 1.1 (repository licence)

Original rule

Mirrored via YARA Forge 20260927, which prefixes rule names with the source and adds normalised meta fields.

Rule id: ba0d072d-674a-5790-9381-4dac98204268

Tags:FILE