This detection targets the specific execution patterns of the DarkComet malware family, identifying potential initial access or command-and-control activities within the Azure environment. Proactively hunting for this signature is critical to validate the efficacy of YARA-based defenses and ensure early identification of low-severity threats before they escalate into broader lateral movements.
rule DarkComet_4 : RAT
{ meta:
reference = "https://github.com/bwall/bamfdetect/blob/master/BAMF_Detect/modules/yara/darkcomet.yara"
strings:
$a1 = "#BOT#"
$a2 = "WEBCAMSTOP"
$a3 = "UnActiveOnlineKeyStrokes"
$a4 = "#SendTaskMgr"
$a5 = "#RemoteScreenSize"
$a6 = "ping 127.0.0.1 -n 4 > NUL &&"
condition:
all of them
}
This YARA rule can be deployed in the following contexts:
This rule contains 6 string patterns in its detection logic.
Here are four specific false positive scenarios for the DarkComet 4 detection rule in an enterprise environment, along with suggested filters or exclusions:
Endpoint Management Agent Updates
MsMpEng.exe or C-Service.exe) injects code into its own child processes to apply hotfixes without a full restart. This legitimate activity mimics the “living off the land” behavior of DarkComet.Microsoft Antimalware Service or CrowdStrike Falcon Sensor) and the child process name matches the agent’s updater executable. Additionally, exclude events occurring during standard maintenance windows (e.g., 02:00–04:00 UTC).Scheduled PowerShell Script Execution via Task Scheduler
powershell.exe to execute a script that dynamically loads .NET assemblies or performs remote registry modifications (e.g., a daily compliance check script named ComplianceCheck.ps1). If the YARA rule flags the specific command-line arguments or memory signatures used by these scripts, it will trigger an alert.C:\ProgramData\CompanyScripts\) and the parent process is