Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit b8dcada

Browse files
author
Louie Mayor
authored
Merge pull request #234 from martyav/ryuk
ryuk related pages
2 parents ba13711 + 2cf5827 commit b8dcada

File tree

3 files changed

+184
-0
lines changed

3 files changed

+184
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Detect Cobalt Strike invoked via WMI
2+
3+
This query was originally published in the threat analytics report, *Ryuk ransomware*. There is also a related [blog](https://www.microsoft.com/security/blog/2020/03/05/human-operated-ransomware-attacks-a-preventable-disaster/).
4+
5+
[Ryuk](https://www.microsoft.com/en-us/wdsi/threats/malware-encyclopedia-description?Name=Ransom:Win32/Ryuk&threatId=-2147232689) is human-operated ransomware. Much like [DoppelPaymer](https://www.microsoft.com/security/blog/2020/03/05/human-operated-ransomware-attacks-a-preventable-disaster/) ransomware, Ryuk is spread manually, often on networks that are already infected with Trickbot.
6+
7+
During the earliest stages of a Ryuk infection, an operator downloads [Cobalt Strike](https://www.cobaltstrike.com/), a penetration testing kit that is also used by malicious actors. Cobalt Strike is used by Ryuk operators to explore the network before deploying the Ryuk payload. This malicious behavior is often obscured by Base64 encoding and other tricks.
8+
9+
The following query detects possible invocation of Cobalt Strike using [Windows Management Instrumentation](https://docs.microsoft.com/windows/win32/wmisdk/wmi-start-page) (WMI).
10+
11+
The [See also](#See-also) section below lists links to other queries associated with Ryuk ransomware.
12+
13+
## Query
14+
15+
```Kusto
16+
// Find use of Base64 encoded PowerShell
17+
// Indicating possible Cobalt Strike
18+
DeviceProcessEvents
19+
| where Timestamp > ago(7d)
20+
// Only WMI-initiated instances, remove to broaden scope
21+
| where InitiatingProcessFileName =~ 'wmiprvse.exe'
22+
| where FileName =~ 'powershell.exe'
23+
and (ProcessCommandLine hasprefix '-e' or
24+
ProcessCommandLine contains 'frombase64')
25+
// Check for Base64 with regex
26+
| where ProcessCommandLine matches regex '[A-Za-z0-9+/]{50,}[=]{0,2}'
27+
// Exclusions: The above regex may trigger false positive on legitimate SCCM activities.
28+
// Remove this exclusion to search more broadly.
29+
| where ProcessCommandLine !has 'Windows\\CCM\\'
30+
| project DeviceId, Timestamp, InitiatingProcessId,
31+
InitiatingProcessFileName, ProcessId, FileName, ProcessCommandLine
32+
```
33+
34+
## Category
35+
36+
This query can be used to detect the following attack techniques and tactics ([see MITRE ATT&CK framework](https://attack.mitre.org/)) or security configuration states.
37+
38+
| Technique, tactic, or state | Covered? (v=yes) | Notes |
39+
|-|-|-|
40+
| Initial access | | |
41+
| Execution | v | |
42+
| Persistence | | |
43+
| Privilege escalation | | |
44+
| Defense evasion | v | |
45+
| Credential Access | | |
46+
| Discovery | | |
47+
| Lateral movement | | |
48+
| Collection | | |
49+
| Command and control | | |
50+
| Exfiltration | | |
51+
| Impact | | |
52+
| Vulnerability | | |
53+
| Misconfiguration | | |
54+
| Malware, component | | |
55+
56+
## See also
57+
58+
* [Detect PsExec being used to spread files](../Lateral%20Movement/remote-file-creation-with-psexec.md)
59+
* [Detect credential theft via SAM database export by LaZagne](../Credential%20Access/lazagne.md)
60+
61+
## Contributor info
62+
63+
**Contributor:** Microsoft Threat Protection team

Credential Access/lazagne.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Detect credential theft via SAM database export by LaZagne
2+
3+
This query was originally published in the threat analytics report, *Ryuk ransomware*. There is also a related [blog](https://www.microsoft.com/security/blog/2020/03/05/human-operated-ransomware-attacks-a-preventable-disaster/).
4+
5+
[Ryuk](https://www.microsoft.com/en-us/wdsi/threats/malware-encyclopedia-description?Name=Ransom:Win32/Ryuk&threatId=-2147232689) is human-operated ransomware. Much like [DoppelPaymer](https://www.microsoft.com/security/blog/2020/03/05/human-operated-ransomware-attacks-a-preventable-disaster/) ransomware, Ryuk is spread manually, often on networks that are already infected with Trickbot.
6+
7+
During a typical Ryuk campaign, an operator will use [LaZagne](https://github.com/AlessandroZ/LaZagne), a credential theft tool, to access stored passwords for service accounts. The accounts are then used to jump from desktop clients to servers or domain controllers, allowing for better reconnaissance, faster movement, and a more severe impact on the target.
8+
9+
The following query detects credential theft by LaZagne.
10+
11+
The [See also](#See-also) section below lists links to other queries associated with Ryuk ransomware.
12+
13+
## Query
14+
15+
```Kusto
16+
// Find credential theft via SAM database export by LaZagne
17+
DeviceProcessEvents
18+
| where Timestamp > ago(7d)
19+
| where FileName =~ 'reg.exe'
20+
and ProcessCommandLine has 'save'
21+
and ProcessCommandLine has 'hklm'
22+
and ProcessCommandLine has 'sam'
23+
| project DeviceId, Timestamp, InitiatingProcessId,
24+
InitiatingProcessFileName, ProcessId, FileName, ProcessCommandLine
25+
```
26+
27+
## Category
28+
29+
This query can be used to detect the following attack techniques and tactics ([see MITRE ATT&CK framework](https://attack.mitre.org/)) or security configuration states.
30+
31+
| Technique, tactic, or state | Covered? (v=yes) | Notes |
32+
|-|-|-|
33+
| Initial access | | |
34+
| Execution | | |
35+
| Persistence | | |
36+
| Privilege escalation | | |
37+
| Defense evasion | | |
38+
| Credential Access | v | |
39+
| Discovery | | |
40+
| Lateral movement | | |
41+
| Collection | | |
42+
| Command and control | | |
43+
| Exfiltration | | |
44+
| Impact | | |
45+
| Vulnerability | | |
46+
| Misconfiguration | | |
47+
| Malware, component | | |
48+
49+
## See also
50+
51+
* [Detect PsExec being used to spread files](../Lateral%20Movement/remote-file-creation-with-psexec.md)
52+
* [Detect Cobalt Strike invoked via WMI](../Campaigns/cobalt-strike-invoked-w-wmi.md)
53+
54+
## Contributor info
55+
56+
**Contributor:** Microsoft Threat Protection team
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Detect PsExec being used to spread files
2+
3+
This query was originally published in the threat analytics report, *Ryuk ransomware*. There is also a related [blog](https://www.microsoft.com/security/blog/2020/03/05/human-operated-ransomware-attacks-a-preventable-disaster/).
4+
5+
[Ryuk](https://www.microsoft.com/en-us/wdsi/threats/malware-encyclopedia-description?Name=Ransom:Win32/Ryuk&threatId=-2147232689) is human-operated ransomware. Much like [DoppelPaymer](https://www.microsoft.com/security/blog/2020/03/05/human-operated-ransomware-attacks-a-preventable-disaster/) ransomware, Ryuk is spread manually, often on networks that are already infected with Trickbot.
6+
7+
Ryuk operators use [PsExec](https://docs.microsoft.com/en-us/sysinternals/downloads/psexec) to manually spread the ransomware to other devices.
8+
9+
The following query detects remote file creation events that might indicate an active attack.
10+
11+
The [See also](#See-also) section below lists links to other queries associated with Ryuk ransomware.
12+
13+
## Query
14+
15+
```Kusto
16+
// Find PsExec creating multiple files on remote machines in a 10-minute window
17+
DeviceFileEvents
18+
| where Timestamp > ago(7d)
19+
// Looking for PsExec by accepteula command flag
20+
| where InitiatingProcessCommandLine has "accepteula"
21+
// Remote machines and file is exe
22+
| where FolderPath has "\\\\" and FileName endswith ".exe"
23+
| extend Exe = countof(InitiatingProcessCommandLine, ".exe")
24+
// Checking to see if command line has 2 .exe or .bat
25+
| where InitiatingProcessCommandLine !has ".ps1" and Exe > 1 or
26+
InitiatingProcessCommandLine has ".bat"
27+
// Exclusions: Remove the following line to widen scope of AHQ
28+
| where not(InitiatingProcessCommandLine has_any("batch", "auditpol",
29+
"script", "scripts", "illusive", "rebootrequired"))
30+
| summarize FileCount = dcount(FolderPath), make_set(SHA1), make_set(FolderPath),
31+
make_set(FileName), make_set(InitiatingProcessCommandLine) by DeviceId,
32+
TimeWindow=bin(Timestamp, 10m), InitiatingProcessFileName
33+
| where FileCount > 4
34+
```
35+
36+
## Category
37+
38+
This query can be used to detect the following attack techniques and tactics ([see MITRE ATT&CK framework](https://attack.mitre.org/)) or security configuration states.
39+
40+
| Technique, tactic, or state | Covered? (v=yes) | Notes |
41+
|-|-|-|
42+
| Initial access | | |
43+
| Execution | | |
44+
| Persistence | | |
45+
| Privilege escalation | | |
46+
| Defense evasion | | |
47+
| Credential Access | | |
48+
| Discovery | | |
49+
| Lateral movement | v | |
50+
| Collection | | |
51+
| Command and control | | |
52+
| Exfiltration | | |
53+
| Impact | | |
54+
| Vulnerability | | |
55+
| Misconfiguration | | |
56+
| Malware, component | | |
57+
58+
## See also
59+
60+
* [Detect credential theft via SAM database export by LaZagne](../Credential%20Access/lazagne.md)
61+
* [Detect Cobalt Strike invoked via WMI](../Campaigns/cobalt-strike-invoked-w-wmi.md)
62+
63+
## Contributor info
64+
65+
**Contributor:** Microsoft Threat Protection team

0 commit comments

Comments
 (0)