Skip to content

YARA · Cod3nym detection-rules

COD3NYM_DOTNET_Singlefilehost_Bundled_App

Detects single file host .NET bundled apps.

GenericCod3nym detection-rulesDetection Rule License 1.1Compiles with YARA-X
Author
Jonathan Peters
Date
2024-01-02
Modified
2024-01-05
Score / Quality
75 / 80

What this rule detects

Detects single file host .NET bundled apps.

Targets: Windows PE.

It defines 2 patterns (2 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.

dotnet-singlefilehost-bundled-app.yarDetection Rule License 1.1
import "pe"

rule COD3NYM_DOTNET_Singlefilehost_Bundled_App : FILE
{
	meta:
		description = "Detects single file host .NET bundled apps."
		author = "Jonathan Peters"
		id = "061bd294-58d6-57be-b8b5-b8a8f31ce316"
		date = "2024-01-02"
		modified = "2024-01-05"
		reference = "https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file"
		source_url = "https://github.com/cod3nym/detection-rules//blob/86a04c4594cb48895192aad4af164f21f568c136/yara/dotnet/framework_identiciation.yar#L3-L17"
		license_url = "https://github.com/cod3nym/detection-rules//blob/86a04c4594cb48895192aad4af164f21f568c136/LICENSE.md"
		logic_hash = "12075b07a9feb951898ac8eba303471d9253ed9535db927244e5562f4fad33d6"
		score = 75
		quality = 80
		tags = "FILE"

	strings:
		$ = "singlefilehost.exe" ascii
		$ = "singlefilehost.pdb" ascii

	condition:
		uint16( 0 ) == 0x5a4d and 1 of them and pe.exports ( "DotNetRuntimeInfo" ) and pe.exports ( "CLRJitAttachState" )
}

Strings (2 patterns)

IdentifierTypeValueModifiers
$text"singlefilehost.exe"ascii
$text"singlefilehost.pdb"ascii

Condition

uint16( 0 ) == 0x5a4d and 1 of them and pe.exports ( "DotNetRuntimeInfo" ) and pe.exports ( "CLRJitAttachState" )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • At least 1 patterns in the rule must match.
  • Uses the pe module.
  • Checks exported functions or the DLL name.

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: Jonathan Peters

Source repository: Cod3nym detection-rules @ 86a04c4594

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: 061bd294-58d6-57be-b8b5-b8a8f31ce316

Tags:FILE