To create specific Carbon Black EDR queries to detect Cobalt Strike activity with few false positives, you can build queries based on known IOCs and behavioral patterns. Here are some example queries:
- Detecting PowerShell usage with encoded commands:
process_name:powershell.exe cmdline:encodedcommand AND -cmdline:chrome
This query looks for PowerShell processes with "encodedcommand" in their command line, and it excludes instances where "chrome" is present to reduce false positives.
- Detecting Cobalt Strike named pipes:
process_name:net.exe cmdline:"localgroup Administrators" OR process_name:nltest.exe cmdline:"/domain_trusts"
This query searches for "net.exe" and "nltest.exe" processes with specific command line arguments that might indicate Cobalt Strike named pipe usage.
- Detecting Cobalt Strike Beacon:
(process_name:regsvr32.exe OR process_name:rundll32.exe OR process_name:wmic.exe) AND cmdline:/^[a-zA-Z0-9]{20,}$/
This query looks for processes such as "regsvr32.exe", "rundll32.exe", and "wmic.exe" with command line arguments consisting of 20 or more alphanumeric characters, which might indicate a Cobalt Strike Beacon.
- Detecting Cobalt Strike Malleable C2 User-Agent:
process_name:cmd.exe cmdline:"/C certutil -urlcache -split -f" -cmdline:chrome
This query searches for "cmd.exe" processes using "certutil" to download files, excluding instances where "chrome" is present to reduce false positives. You can also replace the User-Agent string with the specific one used by the Cobalt Strike Malleable C2 profile.
- Detecting specific Cobalt Strike DLL usage:
(dll_name:artifact.dll OR dll_name:payload.dll) AND -process_name:chrome
This query looks for processes loading "artifact.dll" or "payload.dll", excluding instances where "chrome" is present to reduce false positives.
Keep in mind that these queries are just examples, and Cobalt Strike's behavior can change over time or depending on the attacker's configuration. Continuously update and fine-tune your queries to ensure accurate detection with minimal false positives.