This detection identifies adversary activity involving C#-based red and black team tools that leverage specific typelib GUID signatures to execute .NET payloads within the environment. Proactive hunting for these indicators in Azure Sentinel is essential to distinguish legitimate security testing from potential malicious reconnaissance or lateral movement attempts by threat actors utilizing similar tooling techniques.
rule HKTL_NET_GUID_SharpExec {
meta:
description = "Detects c# red/black-team tools via typelibguid"
reference = "https://github.com/anthemtotheego/SharpExec"
author = "Arnim Rupp"
date = "2020-12-28"
strings:
$typelibguid0 = "7fbad126-e21c-4c4e-a9f0-613fcf585a71" ascii nocase wide
condition:
(uint16(0) == 0x5A4D and uint32(uint32(0x3C)) == 0x00004550) and any of them
}
This YARA rule can be deployed in the following contexts:
This rule contains 1 string patterns in its detection logic.
HKTL_NET_GUID_SharpExec RuleScenario: Legitimate .NET Development Build Processes
devenv.exe (Visual Studio) or msbuild.exe, specifically targeting file paths within standard development directories (e.g., C:\Program Files\Microsoft Visual Studio\... or D:\Builds\).Scenario: Scheduled PowerShell Automation Scripts
powershell.exe and the command line contains specific keywords like -Command, -File, or references to known internal automation script repositories (e.g., paths starting with C:\Scripts\IT_Ops\).Scenario: Endpoint Security Agent Updates
csagent.exe, cb.exe, SentinelOneAgent.exe) and their associated update service paths, ensuring these legitimate background activities do not trigger