APT_Backdoor_Win_DShell_2

YARA-2025-1077 High general Active
No description available for this rule
APT_Backdoor_Win_DShell_2.yar Valid Syntax
// Copyright 2020 by FireEye, Inc.
// You may not use this file except in compliance with the license. The license should have been received with this file. You may obtain a copy of the license at:
// https://github.com/fireeye/red_team_tool_countermeasures/blob/master/LICENSE.txt
rule APT_Backdoor_Win_DShell_2
{
    meta:
        description = "This rule looks for strings specific to the D programming language in combination with a selection of Windows functions that are present within a DShell payload"
        md5 = "e0683f8ee787313cfd2c61cd0995a830"
        rev = 4
        author = "FireEye"
    strings:
        $dlang1 = "C:\\D\\dmd2\\windows\\bin\\..\\..\\src\\phobos\\std\\utf.d" ascii wide
        $dlang2 = "C:\\D\\dmd2\\windows\\bin\\..\\..\\src\\phobos\\std\\file.d" ascii wide
        $dlang3 = "C:\\D\\dmd2\\windows\\bin\\..\\..\\src\\phobos\\std\\format.d" ascii wide
        $dlang4 = "C:\\D\\dmd2\\windows\\bin\\..\\..\\src\\phobos\\std\\base64.d" ascii wide
        $dlang5 = "C:\\D\\dmd2\\windows\\bin\\..\\..\\src\\phobos\\std\\stdio.d" ascii wide
        $dlang6 = "\\..\\..\\src\\phobos\\std\\utf.d" ascii wide
        $dlang7 = "\\..\\..\\src\\phobos\\std\\file.d" ascii wide
        $dlang8 = "\\..\\..\\src\\phobos\\std\\format.d" ascii wide
        $dlang9 = "\\..\\..\\src\\phobos\\std\\base64.d" ascii wide
        $dlang10 = "\\..\\..\\src\\phobos\\std\\stdio.d" ascii wide
        $dlang11 = "Unexpected '\\n' when converting from type const(char)[] to type int" ascii wide
        $ign1 = "--strip-comments"
        $ign2 = "Usage: rdmd [RDMD AND DMD OPTIONS]"
        $s1 = "CloseHandle"
        $s2 = "CommandLineToArgvW"
        $s3 = "CreateFileA"
        $s4 = "CreateSemaphoreA"
        $s5 = "CreateThread"
        $s6 = "DeleteCriticalSection"
        $s7 = "DeleteFileA"
        $s8 = "DuplicateHandle"
        $s9 = "EnterCriticalSection"
        $s10 = "ExitProcess"
        $s11 = "ExitThread"
        $s12 = "ExpandEnvironmentStringsW"
        $s13 = "FileTimeToDosDateTime"
        $s14 = "FindClose"
        $s15 = "FindFirstFileA"
        $s16 = "FindFirstFileW"
        $s17 = "FindNextFileA"
        $s18 = "FindNextFileW"
        $s19 = "FormatMessageW"
        $s20 = "FreeEnvironmentStringsA"
        $s21 = "FreeEnvironmentStringsW"
        $s22 = "FreeLibrary"
        $s23 = "GetACP"
        $s24 = "GetCPInfo"
        $s25 = "GetCommandLineA"
        $s26 = "GetCommandLineW"
        $s27 = "GetConsoleOutputCP"
        $s28 = "GetConsoleScreenBufferInfo"
        $s29 = "GetCurrentProcess"
        $s30 = "GetCurrentThread"
        $s31 = "GetCurrentThreadId"
        $s32 = "GetEnvironmentStrings"
        $s33 = "GetEnvironmentStringsW"
        $s34 = "GetEnvironmentVariableA"
        $s35 = "GetEnvironmentVariableW"
        $s36 = "GetExitCodeThread"
        $s37 = "GetFileAttributesW"
        $s38 = "GetFileType"
        $s39 = "GetLastError"
        $s40 = "GetModuleFileNameA"
        $s41 = "GetModuleHandleA"
        $s42 = "GetOEMCP"
        $s43 = "GetProcAddress"
        $s44 = "GetProcessHeap"
        $s45 = "GetStdHandle"
        $s46 = "GetStringTypeA"
        $s47 = "GetSystemInfo"
        $s48 = "GetThreadContext"
        $s49 = "GetTickCount"
        $s50 = "GetTimeZoneInformation"
        $s51 = "GetVersion"
        $s52 = "GlobalAlloc"
        $s53 = "GlobalFree"
        $s54 = "GlobalMemoryStatus"
        $s55 = "HeapAlloc"
        $s56 = "HeapFree"
        $s57 = "HeapReAlloc"
        $s58 = "InitializeCriticalSection"
        $s59 = "IsDebuggerPresent"
        $s60 = "LCMapStringA"
        $s61 = "LeaveCriticalSection"
        $s62 = "LoadLibraryA"
        $s63 = "LoadLibraryW"
        $s64 = "LocalFree"
        $s65 = "MessageBoxA"
        $s66 = "MultiByteToWideChar"
        $s67 = "QueryPerformanceCounter"
        $s68 = "QueryPerformanceFrequency"
        $s69 = "RaiseException"
        $s70 = "ReadFile"
        $s71 = "RegCloseKey"
        $s72 = "RegCreateKeyExW"
        $s73 = "RegDeleteKeyW"
        $s74 = "RegDeleteValueW"
        $s75 = "RegEnumKeyExW"
        $s76 = "RegEnumValueW"
        $s77 = "RegFlushKey"
        $s78 = "RegOpenKeyExW"
        $s79 = "RegOpenKeyW"
        $s80 = "RegQueryInfoKeyW"
        $s81 = "RegQueryValueExW"
        $s82 = "RegSetValueExW"
        $s83 = "ReleaseSemaphore"
        $s84 = "ResumeThread"
        $s85 = "RtlCaptureContext"
        $s86 = "RtlUnwind"
        $s87 = "SetConsoleCtrlHandler"
        $s88 = "SetEnvironmentVariableW"
        $s89 = "SetFilePointer"
        $s90 = "SetHandleCount"
        $s91 = "SetLastError"
        $s92 = "Sleep"
        $s93 = "SuspendThread"
        $s94 = "SwitchToThread"
        $s95 = "SystemTimeToTzSpecificLocalTime"
        $s96 = "TryEnterCriticalSection"
        $s97 = "TzSpecificLocalTimeToSystemTime"
        $s98 = "UnhandledExceptionFilter"
        $s99 = "VirtualAlloc"
        $s100 = "VirtualFree"
        $s101 = "WaitForSingleObject"
        $s102 = "WideCharToMultiByte"
        $s103 = "WriteConsoleA"
        $s104 = "WriteFile"
        $s105 = "lstrlenW"
    condition:
        (uint16(0) == 0x5A4D and uint32(uint32(0x3C)) == 0x00004550) and filesize > 500KB and filesize > 700KB and all of ($s*) and 1 of ($dlang*) and not $ign1 and not $ign2
}

String Definitions

{"name":"$dlang1","value":"\"C:\\\\D\\\\dmd2\\\\windows\\\\bin\\\\..\\\\..\\\\src\\\\phobos\\\\std\\\\utf.d\" ascii wide"}
{"name":"$dlang2","value":"\"C:\\\\D\\\\dmd2\\\\windows\\\\bin\\\\..\\\\..\\\\src\\\\phobos\\\\std\\\\file.d\" ascii wide"}
{"name":"$dlang3","value":"\"C:\\\\D\\\\dmd2\\\\windows\\\\bin\\\\..\\\\..\\\\src\\\\phobos\\\\std\\\\format.d\" ascii wide"}
{"name":"$dlang4","value":"\"C:\\\\D\\\\dmd2\\\\windows\\\\bin\\\\..\\\\..\\\\src\\\\phobos\\\\std\\\\base64.d\" ascii wide"}
{"name":"$dlang5","value":"\"C:\\\\D\\\\dmd2\\\\windows\\\\bin\\\\..\\\\..\\\\src\\\\phobos\\\\std\\\\stdio.d\" ascii wide"}
{"name":"$dlang6","value":"\"\\\\..\\\\..\\\\src\\\\phobos\\\\std\\\\utf.d\" ascii wide"}
{"name":"$dlang7","value":"\"\\\\..\\\\..\\\\src\\\\phobos\\\\std\\\\file.d\" ascii wide"}
{"name":"$dlang8","value":"\"\\\\..\\\\..\\\\src\\\\phobos\\\\std\\\\format.d\" ascii wide"}
{"name":"$dlang9","value":"\"\\\\..\\\\..\\\\src\\\\phobos\\\\std\\\\base64.d\" ascii wide"}
{"name":"$dlang10","value":"\"\\\\..\\\\..\\\\src\\\\phobos\\\\std\\\\stdio.d\" ascii wide"}
{"name":"$dlang11","value":"\"Unexpected '\\\\n' when converting from type const(char)[] to type int\" ascii wide"}
{"name":"$ign1","value":"\"--strip-comments\""}
{"name":"$ign2","value":"\"Usage: rdmd [RDMD AND DMD OPTIONS]\""}
{"name":"$s1","value":"\"CloseHandle\""}
{"name":"$s2","value":"\"CommandLineToArgvW\""}
{"name":"$s3","value":"\"CreateFileA\""}
{"name":"$s4","value":"\"CreateSemaphoreA\""}
{"name":"$s5","value":"\"CreateThread\""}
{"name":"$s6","value":"\"DeleteCriticalSection\""}
{"name":"$s7","value":"\"DeleteFileA\""}
{"name":"$s8","value":"\"DuplicateHandle\""}
{"name":"$s9","value":"\"EnterCriticalSection\""}
{"name":"$s10","value":"\"ExitProcess\""}
{"name":"$s11","value":"\"ExitThread\""}
{"name":"$s12","value":"\"ExpandEnvironmentStringsW\""}
{"name":"$s13","value":"\"FileTimeToDosDateTime\""}
{"name":"$s14","value":"\"FindClose\""}
{"name":"$s15","value":"\"FindFirstFileA\""}
{"name":"$s16","value":"\"FindFirstFileW\""}
{"name":"$s17","value":"\"FindNextFileA\""}
{"name":"$s18","value":"\"FindNextFileW\""}
{"name":"$s19","value":"\"FormatMessageW\""}
{"name":"$s20","value":"\"FreeEnvironmentStringsA\""}
{"name":"$s21","value":"\"FreeEnvironmentStringsW\""}
{"name":"$s22","value":"\"FreeLibrary\""}
{"name":"$s23","value":"\"GetACP\""}
{"name":"$s24","value":"\"GetCPInfo\""}
{"name":"$s25","value":"\"GetCommandLineA\""}
{"name":"$s26","value":"\"GetCommandLineW\""}
{"name":"$s27","value":"\"GetConsoleOutputCP\""}
{"name":"$s28","value":"\"GetConsoleScreenBufferInfo\""}
{"name":"$s29","value":"\"GetCurrentProcess\""}
{"name":"$s30","value":"\"GetCurrentThread\""}
{"name":"$s31","value":"\"GetCurrentThreadId\""}
{"name":"$s32","value":"\"GetEnvironmentStrings\""}
{"name":"$s33","value":"\"GetEnvironmentStringsW\""}
{"name":"$s34","value":"\"GetEnvironmentVariableA\""}
{"name":"$s35","value":"\"GetEnvironmentVariableW\""}
{"name":"$s36","value":"\"GetExitCodeThread\""}
{"name":"$s37","value":"\"GetFileAttributesW\""}
{"name":"$s38","value":"\"GetFileType\""}
{"name":"$s39","value":"\"GetLastError\""}
{"name":"$s40","value":"\"GetModuleFileNameA\""}
{"name":"$s41","value":"\"GetModuleHandleA\""}
{"name":"$s42","value":"\"GetOEMCP\""}
{"name":"$s43","value":"\"GetProcAddress\""}
{"name":"$s44","value":"\"GetProcessHeap\""}
{"name":"$s45","value":"\"GetStdHandle\""}
{"name":"$s46","value":"\"GetStringTypeA\""}
{"name":"$s47","value":"\"GetSystemInfo\""}
{"name":"$s48","value":"\"GetThreadContext\""}
{"name":"$s49","value":"\"GetTickCount\""}
{"name":"$s50","value":"\"GetTimeZoneInformation\""}
{"name":"$s51","value":"\"GetVersion\""}
{"name":"$s52","value":"\"GlobalAlloc\""}
{"name":"$s53","value":"\"GlobalFree\""}
{"name":"$s54","value":"\"GlobalMemoryStatus\""}
{"name":"$s55","value":"\"HeapAlloc\""}
{"name":"$s56","value":"\"HeapFree\""}
{"name":"$s57","value":"\"HeapReAlloc\""}
{"name":"$s58","value":"\"InitializeCriticalSection\""}
{"name":"$s59","value":"\"IsDebuggerPresent\""}
{"name":"$s60","value":"\"LCMapStringA\""}
{"name":"$s61","value":"\"LeaveCriticalSection\""}
{"name":"$s62","value":"\"LoadLibraryA\""}
{"name":"$s63","value":"\"LoadLibraryW\""}
{"name":"$s64","value":"\"LocalFree\""}
{"name":"$s65","value":"\"MessageBoxA\""}
{"name":"$s66","value":"\"MultiByteToWideChar\""}
{"name":"$s67","value":"\"QueryPerformanceCounter\""}
{"name":"$s68","value":"\"QueryPerformanceFrequency\""}
{"name":"$s69","value":"\"RaiseException\""}
{"name":"$s70","value":"\"ReadFile\""}
{"name":"$s71","value":"\"RegCloseKey\""}
{"name":"$s72","value":"\"RegCreateKeyExW\""}
{"name":"$s73","value":"\"RegDeleteKeyW\""}
{"name":"$s74","value":"\"RegDeleteValueW\""}
{"name":"$s75","value":"\"RegEnumKeyExW\""}
{"name":"$s76","value":"\"RegEnumValueW\""}
{"name":"$s77","value":"\"RegFlushKey\""}
{"name":"$s78","value":"\"RegOpenKeyExW\""}
{"name":"$s79","value":"\"RegOpenKeyW\""}
{"name":"$s80","value":"\"RegQueryInfoKeyW\""}
{"name":"$s81","value":"\"RegQueryValueExW\""}
{"name":"$s82","value":"\"RegSetValueExW\""}
{"name":"$s83","value":"\"ReleaseSemaphore\""}
{"name":"$s84","value":"\"ResumeThread\""}
{"name":"$s85","value":"\"RtlCaptureContext\""}
{"name":"$s86","value":"\"RtlUnwind\""}
{"name":"$s87","value":"\"SetConsoleCtrlHandler\""}
{"name":"$s88","value":"\"SetEnvironmentVariableW\""}
{"name":"$s89","value":"\"SetFilePointer\""}
{"name":"$s90","value":"\"SetHandleCount\""}
{"name":"$s91","value":"\"SetLastError\""}
{"name":"$s92","value":"\"Sleep\""}
{"name":"$s93","value":"\"SuspendThread\""}
{"name":"$s94","value":"\"SwitchToThread\""}
{"name":"$s95","value":"\"SystemTimeToTzSpecificLocalTime\""}
{"name":"$s96","value":"\"TryEnterCriticalSection\""}
{"name":"$s97","value":"\"TzSpecificLocalTimeToSystemTime\""}
{"name":"$s98","value":"\"UnhandledExceptionFilter\""}
{"name":"$s99","value":"\"VirtualAlloc\""}
{"name":"$s100","value":"\"VirtualFree\""}
{"name":"$s101","value":"\"WaitForSingleObject\""}
{"name":"$s102","value":"\"WideCharToMultiByte\""}
{"name":"$s103","value":"\"WriteConsoleA\""}
{"name":"$s104","value":"\"WriteFile\""}
{"name":"$s105","value":"\"lstrlenW\""}

Threat Analysis

This YARA rule is designed to detect general threats.

Severity Level: High

The rule uses pattern matching to identify specific byte sequences, strings, or behavioral patterns associated with malicious activity.

Detection Capabilities

  • File-based detection for executables and documents
  • Memory scanning for running processes
  • Network traffic analysis support

Command Line Usage

# Scan a single file
yara APT_Backdoor_Win_DShell_2.yar /path/to/suspicious/file

# Scan a directory recursively
yara -r APT_Backdoor_Win_DShell_2.yar /path/to/directory/

# Scan with metadata output
yara -m APT_Backdoor_Win_DShell_2.yar target_file

# Scan process memory (Linux)
yara APT_Backdoor_Win_DShell_2.yar /proc/[pid]/exe

Integration Examples

Python (yara-python)

import yara
rules = yara.compile(filepath='APT_Backdoor_Win_DShell_2.yar')
matches = rules.match('/path/to/file')

ClamAV Integration

clamscan --yara-rules=APT_Backdoor_Win_DShell_2.yar /path/to/scan

Rule Information

YARA ID
YARA-2025-1077
Author
Unknown
Created
August 19, 2025
Last Updated
August 19, 2025
Last Imported
Never

Threat Intelligence

Risk Level High
Category general
Detection Confidence Analysis Pending
False Positive Rate Not Available
Last Seen in Wild No Data

Export Options