Detect Asymmetric Cryptography in Sumo Logic CSE
Adversaries may employ asymmetric encryption algorithms such as RSA, ECDH, or Diffie-Hellman to conceal command and control (C2) traffic. Asymmetric cryptography uses a keypair: a public key for encryption and a private key for decryption, ensuring only the intended recipient can read the data. In practice, most C2 frameworks (Cobalt Strike, Sliver, Havoc, AsyncRAT, Metasploit) use TLS for all communications, leveraging asymmetric cryptography for key exchange before switching to symmetric encryption for the bulk session data. Real-world malware families using this technique include SombRAT (SSL-encrypted C2), LunarWeb (RSA-4096 encrypted commands), SodaMaster (hardcoded RSA key for C2 traffic), ComRAT (RSA+AES for Gmail C2 channel), and Cyclops Blink (OpenSSL RSA public key encrypting per-message keys under TLS). Detection must focus on behavioral indicators: LOLBin processes initiating TLS connections, self-signed or anomalous certificate attributes, TLS on non-standard ports, regular beaconing intervals from non-browser processes, and use of cryptographic tools (openssl, certutil, .NET RSA APIs) in unexpected contexts.
MITRE ATT&CK
- Tactic
- Command and Control
- Technique
- T1573 Encrypted Channel
- Sub-technique
- T1573.002 Asymmetric Cryptography
- Canonical reference
- https://attack.mitre.org/techniques/T1573/002/
Sumo Detection Query
// Approach 1: LOLBin processes making outbound TLS/non-RFC1918 connections (Sysmon EventID 3)
(_sourceCategory="windows/sysmon" OR _sourceCategory="WinEventLog/Sysmon")
| parse xml "<Event><System><EventID>*</EventID>*</System><EventData>*</EventData></Event>" as EventID, SystemData, EventData nodrop
| where EventID = "3"
| parse field=EventData "<Data Name='Image'>*</Data>" as ProcessImage nodrop
| parse field=EventData "<Data Name='DestinationIp'>*</Data>" as DestinationIp nodrop
| parse field=EventData "<Data Name='DestinationPort'>*</Data>" as DestinationPort nodrop
| parse field=EventData "<Data Name='User'>*</Data>" as UserName nodrop
| parse field=EventData "<Data Name='CommandLine'>*</Data>" as CommandLine nodrop
| parse field=EventData "<Data Name='ParentImage'>*</Data>" as ParentImage nodrop
| where (
ProcessImage matches "*\\cmd.exe" OR ProcessImage matches "*\\powershell.exe" OR
ProcessImage matches "*\\pwsh.exe" OR ProcessImage matches "*\\wscript.exe" OR
ProcessImage matches "*\\cscript.exe" OR ProcessImage matches "*\\mshta.exe" OR
ProcessImage matches "*\\regsvr32.exe" OR ProcessImage matches "*\\rundll32.exe" OR
ProcessImage matches "*\\msbuild.exe" OR ProcessImage matches "*\\csc.exe" OR
ProcessImage matches "*\\installutil.exe" OR ProcessImage matches "*\\regasm.exe" OR
ProcessImage matches "*\\wmic.exe" OR ProcessImage matches "*\\bitsadmin.exe"
)
| where !( DestinationIp matches "10.*" OR DestinationIp matches "172.16.*" OR
DestinationIp matches "172.17.*" OR DestinationIp matches "172.18.*" OR
DestinationIp matches "172.19.*" OR DestinationIp matches "172.20.*" OR
DestinationIp matches "172.31.*" OR DestinationIp matches "192.168.*" OR
DestinationIp matches "127.*" OR DestinationIp matches "169.254.*" )
| if (DestinationPort IN ("443","8443","4443","8080","8888","8081","9443","2083","2087","2096"), 1, 0) as IsTLSPort
| if (tonumber(DestinationPort) > 1024 AND IsTLSPort = 0, 1, 0) as IsHighPort
| if (IsHighPort = 1, 2, if (IsTLSPort = 1, 1, 0)) as SuspicionScore
| where SuspicionScore > 0
| fields _messageTime, _sourceHost, UserName, ProcessImage, CommandLine, ParentImage, DestinationIp, DestinationPort, IsTLSPort, IsHighPort, SuspicionScore
// Approach 2: Cryptographic tool and API invocation (Sysmon EventID 1)
// Run separately or union in a scheduled search:
// (_sourceCategory="windows/sysmon" OR _sourceCategory="WinEventLog/Sysmon")
// | parse xml ...
// | where EventID = "1"
// | where (
// ProcessImage matches "*\\openssl.exe"
// OR CommandLine matches "*openssl genrsa*" OR CommandLine matches "*openssl genpkey*"
// OR CommandLine matches "*openssl req*" OR CommandLine matches "*openssl s_client*"
// OR CommandLine matches "*RSACryptoServiceProvider*" OR CommandLine matches "*RSACng*"
// OR CommandLine matches "*ECDiffieHellman*" OR CommandLine matches "*New-SelfSignedCertificate*"
// OR CommandLine matches "*Export-PfxCertificate*" OR CommandLine matches "*Import-PfxCertificate*"
// OR (ProcessImage matches "*\\certutil.exe" AND (
// CommandLine matches "*-exportpfx*" OR CommandLine matches "*-importpfx*" OR CommandLine matches "*-MergePFX*"
// ))
// )
| sort by SuspicionScore desc, _messageTime desc
| count by _sourceHost, UserName, ProcessImage, CommandLine, ParentImage, DestinationIp, DestinationPort, SuspicionScore Sumo Logic query detecting T1573.002 asymmetric cryptography C2 from Sysmon event logs. Approach 1 identifies LOLBin and scripting engine processes (PowerShell, cmd, wscript, mshta, regsvr32, rundll32, etc.) establishing outbound connections to non-RFC1918 addresses via Sysmon EventID 3, with scoring based on port type. Approach 2 (provided as comment for union) covers cryptographic tool/API invocations including openssl commands, .NET RSA/ECDH APIs, and certutil certificate operations via Sysmon EventID 1.
Data Sources
Required Tables
False Positives & Tuning
- Enterprise certificate lifecycle management tools (DigiCert, Entrust agents) invoking certutil for automated certificate enrollment or renewal on managed workstations
- PowerShell-based automation scripts in DevOps environments connecting to Azure or AWS API endpoints over TLS 443 from administrative workstations
- Software build servers running msbuild.exe or csc.exe that fetch dependencies or push artifacts over HTTPS as part of legitimate CI/CD pipeline activity
Other platforms for T1573.002
Testing Methodology
Validate this detection against 4 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 1RSA Key Pair Generation via OpenSSL Command Line
Expected signal: Sysmon Event ID 1 (Process Create): openssl.exe with CommandLine containing 'genrsa -out' and 'rsa -in ... -pubout'. Sysmon Event ID 11 (File Create): df00tech_test_priv.pem and df00tech_test_pub.pem created in %TEMP%. Security Event ID 4688 if process command line auditing is enabled via GPO.
- Test 2In-Memory RSA Encryption via PowerShell .NET API
Expected signal: Sysmon Event ID 1 (Process Create): powershell.exe with CommandLine containing 'RSACryptoServiceProvider'. PowerShell ScriptBlock Log Event ID 4104 (Microsoft-Windows-PowerShell/Operational) capturing the full RSA key generation and encrypt/decrypt code in plaintext. No network connections expected — this test exercises the crypto API only.
- Test 3Outbound TLS Handshake from LOLBin Process Chain (cmd.exe -> PowerShell)
Expected signal: Sysmon Event ID 1 (Process Create): cmd.exe spawning powershell.exe — parent-child relationship captured. Sysmon Event ID 3 (Network Connection): powershell.exe connecting to 1.1.1.1:443. PowerShell ScriptBlock Log Event ID 4104 capturing the SslStream and AuthenticateAsClient code showing TLS setup. The cmd.exe → powershell.exe → external TLS connection chain is the key indicator.
- Test 4Self-Signed Certificate Generation for Adversary C2 Server
Expected signal: Sysmon Event ID 1 (Process Create): powershell.exe with CommandLine containing 'New-SelfSignedCertificate' and 'RSA'. Sysmon Event ID 11 (File Create): df00tech_c2cert.pfx in %TEMP%. Sysmon Event ID 12/13 (Registry Create/Set): certificate installation to Cert:\CurrentUser\My store captured as registry operations under HKCU\Software\Microsoft\SystemCertificates. PowerShell ScriptBlock Log Event ID 4104 with full certificate generation and export code.
References (14)
- https://attack.mitre.org/techniques/T1573/002/
- http://www.sans.org/reading-room/whitepapers/analyst/finding-hidden-threats-decrypting-ssl-34840
- https://insights.sei.cmu.edu/cert/2015/03/the-risks-of-ssl-inspection.html
- https://arxiv.org/ftp/arxiv/papers/1408/1408.1136.pdf
- https://engineering.salesforce.com/tls-fingerprinting-with-ja3-and-ja3s-247362855967/
- https://github.com/salesforce/ja3
- https://www.ncsc.gov.uk/files/Cyclops-Blink-Malware-Analysis-Report.pdf
- https://www.welivesecurity.com/2020/05/26/agentbtz-comratv4-ten-year-journey/
- https://securelist.com/apt10-sophisticated-multi-layered-loader-rosneft/101524/
- https://www.blackberry.com/us/en/solutions/endpoint-security/cylanceprotect/research/2020/costaricto
- https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.rsacryptoserviceprovider
- https://learn.microsoft.com/en-us/dotnet/api/system.net.security.sslstream
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1573.002/T1573.002.md
- https://github.com/SigmaHQ/sigma/tree/master/rules/windows/network_connection
Unlock Pro Content
Get the full detection package for T1573.002 including response playbook, investigation guide, and atomic red team tests.