Skip to content

YARA · SEKOIA.IO Community

SEKOIA_Apt_Badmagic_Ld_Dll_Loader_Pshscript

Detects BadMagic DLL Loader powershell script

APT / threat actorDllloaderSEKOIA.IO CommunityDetection Rule License 1.1Compiles with YARA-X
Author
Sekoia.io
Date
2023-05-15
Modified
2024-12-19
Score / Quality
75 / 80

What this rule detects

Detects BadMagic DLL Loader powershell script

Associated malware family: Dllloader.

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

Summary generated from the rule's metadata and condition.

Rule source

apt-badmagic-ld-dll-loader-pshscript.yarDetection Rule License 1.1
rule SEKOIA_Apt_Badmagic_Ld_Dll_Loader_Pshscript : FILE
{
	meta:
		description = "Detects BadMagic DLL Loader powershell script"
		author = "Sekoia.io"
		id = "d4a23afc-693f-4fab-b2c4-15eecba047f7"
		date = "2023-05-15"
		modified = "2024-12-19"
		reference = "https://github.com/SEKOIA-IO/Community"
		source_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/yara_rules/apt_badmagic_ld_dll_loader_pshscript.yar#L1-L18"
		license_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/LICENSE.md"
		logic_hash = "8482521fe1f90c008948e551df35448b870145cf8b58f3c5019cafb66bb0ae36"
		score = 75
		quality = 80
		tags = "FILE"
		version = "1.0"
		classification = "TLP:CLEAR"

	strings:
		$ = "$ModulePath = \"$folder_path\\$name"
		$ = "$ModuleExport ="
		$ = "start-job -ScriptBlock $ScriptBlock"
		$ = "Invoke-WebRequest -Uri"

	condition:
		all of them and filesize < 1KB
}

Strings (4 patterns)

IdentifierTypeValueModifiers
$text"$ModulePath = \"$folder_path\\$name"
$text"$ModuleExport ="
$text"start-job -ScriptBlock $ScriptBlock"
$text"Invoke-WebRequest -Uri"

Condition

all of them and filesize < 1KB

In plain words (Heuristic)

  • The file must be smaller than 1KB (a cheap guard that skips large files).
  • All 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: Sekoia.io

Source repository: SEKOIA.IO Community @ a438a5901a

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: d4a23afc-693f-4fab-b2c4-15eecba047f7

Metadata

version1.0
classificationTLP:CLEAR

Tags:FILE

More Dllloader rules