Detect Malware in Elastic Security
Adversaries may buy, steal, or download malware that can be used during targeting. Malicious software can include payloads, droppers, post-compromise tools, backdoors, packers, and C2 protocols. Adversaries may acquire malware to support their operations, obtaining a means for maintaining control of remote machines, evading defenses, and executing post-compromise behaviors. In addition to downloading free malware from the internet, adversaries may purchase these capabilities from third-party entities including technology companies specializing in malware development, criminal marketplaces (Malware-as-a-Service), or from individuals. Adversaries may also steal and repurpose malware from third-party entities, including other adversaries.
MITRE ATT&CK
- Tactic
- Resource Development
- Technique
- T1588 Obtain Capabilities
- Sub-technique
- T1588.001 Malware
- Canonical reference
- https://attack.mitre.org/techniques/T1588/001/
Elastic Detection Query
any where
(
event.category == "process" and event.type == "start" and
(
process.name like~ ("beacon.exe", "beacon32.exe", "beacon64.exe", "stager.exe", "stager32.exe", "stager64.exe", "injector.exe", "loader.exe", "dropper.exe", "njrat.exe", "rat.exe")
or
(
process.command_line like~ ("*njrat*", "*quasar*", "*asyncrat*", "*nanocore*", "*remcos*", "*azorult*", "*meterpreter*", "*cobaltstr*", "*cobalt strike*", "*agent tesla*", "*agentTesla*", "*lokibot*", "*formbook*", "*redlinestealer*", "*red line*")
and not process.parent.name like~ ("chrome.exe", "msedge.exe", "firefox.exe", "code.exe", "devenv.exe", "notepad.exe")
)
)
)
or
(
event.category == "network" and event.type in ("start", "connection") and
destination.port in (4444, 1234, 9999, 31337, 50050, 8888, 6666, 5555, 7777) and
not cidrmatch(destination.ip, "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "127.0.0.0/8") and
process.name like~ ("rundll32.exe", "regsvr32.exe", "mshta.exe", "wscript.exe", "cscript.exe", "msiexec.exe", "odbcconf.exe", "certutil.exe", "bitsadmin.exe", "explorer.exe", "svchost.exe")
)
or
(
event.category == "file" and event.type == "creation" and
file.path like~ ("*\\appdata\\roaming\\*", "*\\appdata\\local\\temp\\*", "*\\programdata\\*", "*\\windows\\temp\\*", "*\\users\\public\\*") and
file.name like~ ("*.bin", "*.dat", "*.tmp") and
process.name like~ ("powershell.exe", "pwsh.exe", "cmd.exe", "mshta.exe", "wscript.exe", "cscript.exe", "rundll32.exe", "regsvr32.exe")
) Detects use of acquired commodity malware via three behavioral branches using Elastic Common Schema fields: (1) process creation matching known RAT/C2 binary names or commodity malware framework strings in command lines, excluding browser and IDE parent processes; (2) LOLBin processes initiating outbound connections to known commodity C2 and RAT listener ports on public IPs; (3) script interpreters dropping binary staging payloads with .bin/.dat/.tmp extensions to user-writable Windows paths.
Data Sources
Required Tables
False Positives & Tuning
- Authorised penetration testing or red team engagements using licensed Cobalt Strike, Metasploit Framework, or commodity RAT frameworks will match all three detection branches — maintain a suppression list of authorised red team host names and engagement time windows
- Software development or CI/CD pipelines that invoke PowerShell or cmd.exe to compile or package binary artifacts with .bin or .dat extensions to AppData or ProgramData paths will match the staging file artifact branch
- Legitimate network management software, VoIP clients, or game engines that operate on ports 8888, 9999, or 7777 and run hosted under svchost.exe or explorer.exe will match the C2 network port branch
Other platforms for T1588.001
Testing Methodology
Validate this detection against 5 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Simulate njRAT/QuasarRAT Binary Name Pattern
Expected signal: Sysmon Event ID 1: Process Create with Image ending in 'njrat.exe', CommandLine 'njrat.exe /all'. Security Event ID 4688 (if command line auditing enabled). Prefetch entry NJRAT.EXE-*.pf created in C:\Windows\Prefetch\.
- Test 2Beacon-Pattern Network Connection to Non-Standard Port
Expected signal: Sysmon Event ID 3: Multiple Network Connection events from powershell.exe to 192.0.2.1:4444 with ~10 second intervals. Security Event ID 4688 for the PowerShell process creation. Connection attempts will fail (192.0.2.1 is RFC 5737 documentation range) but process and network events fire regardless.
- Test 3Infostealer Credential Target Access Simulation
Expected signal: Sysmon Event ID 10 (Process Access) if Chrome is running and the Login Data file is locked. Sysmon Event ID 11 or Windows file access auditing events for the Login Data file access by powershell.exe. PowerShell ScriptBlock Log Event ID 4104 with the script content referencing the credential database path.
- Test 4Cobalt Strike Default C2 Port Connection Attempt
Expected signal: Sysmon Event ID 3: Network connection from powershell.exe to 198.51.100.1:50050. The connection attempt will fail (RFC 5737 test range) but the connection attempt event fires. Security Event ID 4688 for the PowerShell process. DNS query may be logged if name resolution was attempted.
- Test 5Commodity Malware Dynamic DNS Resolution
Expected signal: Sysmon Event ID 22 (DNS Query): QueryName='test.no-ip.org', Image ends in 'powershell.exe'. Network connection log may show the DNS resolver query. PowerShell ScriptBlock Log Event ID 4104 with the DNS resolution command.
References (12)
- https://attack.mitre.org/techniques/T1588/001/
- https://www.mandiant.com/resources/supply-chain-analysis-from-quartermaster-to-sunshop
- https://www.proofpoint.com/us/blog/threat-insight/ta2541-flying-under-radar
- https://www.crowdstrike.com/blog/aquatic-panda-targets-higher-education-with-novel-tools-ttps/
- https://www.kaspersky.com/blog/luminousmoth-apt/
- https://www.microsoft.com/security/blog/2022/03/22/dev-0537-criminal-actor-targeting-organizations-for-data-exfiltration-and-destruction/
- https://abuse.ch/blog/threatfox/
- https://bazaar.abuse.ch/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1588.001/T1588.001.md
- https://blog.talosintelligence.com/2022/09/from-the-labs-cobalt-strike-detection.html
- https://thedfirreport.com/
- https://www.sentinelone.com/labs/metador-le-meteore-des-apt/
Unlock Pro Content
Get the full detection package for T1588.001 including response playbook, investigation guide, and atomic red team tests.