Skip to content

Commit 0ee475c

Browse files
Update latest docs
1 parent 6a6e25a commit 0ee475c

File tree

40 files changed

+3871
-82
lines changed

40 files changed

+3871
-82
lines changed
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
[[prebuilt-rule-8-17-13-account-discovery-command-via-system-account]]
2+
=== Account Discovery Command via SYSTEM Account
3+
4+
Identifies when the SYSTEM account uses an account discovery utility. This could be a sign of discovery activity after an adversary has achieved privilege escalation.
5+
6+
*Rule type*: eql
7+
8+
*Rule indices*:
9+
10+
* winlogbeat-*
11+
* logs-endpoint.events.process-*
12+
* logs-windows.sysmon_operational-*
13+
14+
*Severity*: low
15+
16+
*Risk score*: 21
17+
18+
*Runs every*: 5m
19+
20+
*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)
21+
22+
*Maximum alerts per execution*: 100
23+
24+
*References*: None
25+
26+
*Tags*:
27+
28+
* Domain: Endpoint
29+
* OS: Windows
30+
* Use Case: Threat Detection
31+
* Tactic: Discovery
32+
* Tactic: Privilege Escalation
33+
* Resources: Investigation Guide
34+
* Data Source: Elastic Defend
35+
* Data Source: Sysmon
36+
37+
*Version*: 214
38+
39+
*Rule authors*:
40+
41+
* Elastic
42+
43+
*Rule license*: Elastic License v2
44+
45+
46+
==== Investigation guide
47+
48+
49+
50+
*Triage and analysis*
51+
52+
53+
54+
*Investigating Account Discovery Command via SYSTEM Account*
55+
56+
57+
After successfully compromising an environment, attackers may try to gain situational awareness to plan their next steps. This can happen by running commands to enumerate network resources, users, connections, files, and installed security software.
58+
59+
This rule looks for the execution of account discovery utilities using the SYSTEM account, which is commonly observed after attackers successfully perform privilege escalation or exploit web applications.
60+
61+
62+
*Possible investigation steps*
63+
64+
65+
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
66+
- If the process tree includes a web-application server process such as w3wp, httpd.exe, nginx.exe and alike, investigate any suspicious file creation or modification in the last 48 hours to assess the presence of any potential webshell backdoor.
67+
- Investigate other alerts associated with the user/host during the past 48 hours.
68+
- Determine how the SYSTEM account is being used. For example, users with administrator privileges can spawn a system shell using Windows services, scheduled tasks or other third party utilities.
69+
70+
71+
*False positive analysis*
72+
73+
74+
- Discovery activities are not inherently malicious if they occur in isolation. As long as the analyst did not identify suspicious activity related to the user or host, such alerts can be dismissed.
75+
76+
77+
*Response and remediation*
78+
79+
80+
- Initiate the incident response process based on the outcome of the triage.
81+
- Isolate the involved hosts to prevent further post-compromise behavior.
82+
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
83+
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
84+
- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
85+
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
86+
- Use the data collected through the analysis to investigate other machines affected in the environment.
87+
88+
89+
==== Setup
90+
91+
92+
93+
*Setup*
94+
95+
96+
If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
97+
events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
98+
Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
99+
`event.ingested` to @timestamp.
100+
For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
101+
102+
103+
==== Rule query
104+
105+
106+
[source, js]
107+
----------------------------------
108+
process where host.os.type == "windows" and event.type == "start" and
109+
(?process.Ext.token.integrity_level_name : "System" or
110+
?winlog.event_data.IntegrityLevel : "System") and
111+
(
112+
process.name : "whoami.exe" or
113+
(
114+
process.name : "net1.exe" and not process.parent.name : "net.exe" and not process.args : ("start", "stop", "/active:*")
115+
)
116+
) and
117+
process.parent.executable != null and
118+
not (process.name : "net1.exe" and process.working_directory : "C:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Downloads\\") and
119+
not process.parent.executable :
120+
("C:\\Program Files\\Microsoft Monitoring Agent\\Agent\\MonitoringHost.exe",
121+
"C:\\Program Files\\Dell\\SupportAssistAgent\\SRE\\SRE.exe",
122+
"C:\\Program Files\\Obkio Agent\\main.dist\\ObkioAgentSoftware.exe",
123+
"C:\\Windows\\Temp\\WinGet\\defaultState\\PostgreSQL.PostgreSQL*\\postgresql-*-windows-x64.exe",
124+
"C:\\Program Files\\Obkio Agent\\main.dist\\ObkioAgentSoftware.exe",
125+
"C:\\Program Files (x86)\\SolarWinds\\Agent\\Plugins\\JobEngine\\SWJobEngineWorker2.exe") and
126+
not (process.parent.executable : "C:\\Windows\\Sys?????\\WindowsPowerShell\\v1.0\\powershell.exe" and
127+
process.parent.args : ("C:\\Program Files (x86)\\Microsoft Intune Management Extension\\*.ps1",
128+
"Agent\\Modules\\AdHealthConfiguration\\AdHealthConfiguration.psd1'")) and
129+
not (process.parent.name : "cmd.exe" and process.working_directory : "C:\\Program Files\\Infraon Corp\\SecuraAgent\\")
130+
131+
----------------------------------
132+
133+
*Framework*: MITRE ATT&CK^TM^
134+
135+
* Tactic:
136+
** Name: Discovery
137+
** ID: TA0007
138+
** Reference URL: https://attack.mitre.org/tactics/TA0007/
139+
* Technique:
140+
** Name: System Owner/User Discovery
141+
** ID: T1033
142+
** Reference URL: https://attack.mitre.org/techniques/T1033/
143+
* Tactic:
144+
** Name: Privilege Escalation
145+
** ID: TA0004
146+
** Reference URL: https://attack.mitre.org/tactics/TA0004/
147+
* Technique:
148+
** Name: Valid Accounts
149+
** ID: T1078
150+
** Reference URL: https://attack.mitre.org/techniques/T1078/
151+
* Sub-technique:
152+
** Name: Local Accounts
153+
** ID: T1078.003
154+
** Reference URL: https://attack.mitre.org/techniques/T1078/003/
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
[[prebuilt-rule-8-17-13-aws-access-token-used-from-multiple-addresses]]
2+
=== AWS Access Token Used from Multiple Addresses
3+
4+
This rule identifies potentially suspicious activity by detecting instances where a single IAM user's temporary session token is accessed from multiple IP addresses within a short time frame. Such behavior may suggest that an adversary has compromised temporary credentials and is utilizing them from various locations. To enhance detection accuracy and minimize false positives, the rule incorporates criteria that evaluate unique IP addresses, user agents, cities, and networks. These additional checks help distinguish between legitimate distributed access patterns and potential credential misuse. Detected activities are classified into different types based on the combination of unique indicators, with each classification assigned a fidelity score reflecting the likelihood of malicious behavior. High fidelity scores are given to patterns most indicative of threats, such as multiple unique IPs, networks, cities, and user agents. Medium and low fidelity scores correspond to less severe patterns, enabling security teams to effectively prioritize alerts.
5+
6+
*Rule type*: esql
7+
8+
*Rule indices*: None
9+
10+
*Severity*: medium
11+
12+
*Risk score*: 47
13+
14+
*Runs every*: 5m
15+
16+
*Searches indices from*: now-32m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)
17+
18+
*Maximum alerts per execution*: 100
19+
20+
*References*:
21+
22+
* https://www.sygnia.co/blog/sygnia-investigation-bybit-hack/
23+
24+
*Tags*:
25+
26+
* Domain: Cloud
27+
* Data Source: AWS
28+
* Data Source: Amazon Web Services
29+
* Data Source: AWS IAM
30+
* Data Source: AWS CloudTrail
31+
* Tactic: Initial Access
32+
* Use Case: Identity and Access Audit
33+
* Resources: Investigation Guide
34+
35+
*Version*: 101
36+
37+
*Rule authors*:
38+
39+
* Elastic
40+
41+
*Rule license*: Elastic License v2
42+
43+
44+
==== Investigation guide
45+
46+
47+
48+
*Triage and Analysis*
49+
50+
51+
52+
*Investigating AWS Access Token Used from Multiple Addresses*
53+
54+
55+
Access tokens are bound to a single user. Usage from multiple IP addresses may indicate the token was stolen and used elsewhere. By correlating this with additional detection criteria like multiple user agents, different cities, and different networks, we can improve the fidelity of the rule and help to eliminate false positives associated with expected behavior, like dual-stack IPV4/IPV6 usage.
56+
57+
58+
*Possible Investigation Steps*
59+
60+
61+
- **Identify the IAM User**: Examine the `aws.cloudtrail.user_identity.arn` stored in `user_id` and correlate with the `source.ips` stored in `ip_list` and `unique_ips` count to determine how widely the token was used.
62+
- **Correlate Additional Detection Context**: Examine `activity_type` and `fidelity_score` to determine additional cities, networks or user agents associated with the token usage.
63+
- **Determine Access Key Type**: Examine the `access_key_id` to determine whether the token is short-term (beginning with ASIA) or long-term (beginning with AKIA).
64+
- **Check Recent MFA Events**: Determine whether the user recently enabled MFA, registered devices, or assumed a role using this token.
65+
- **Review Workload Context**: Confirm whether the user was expected to be active across multiple cities, networks or user agent environments.
66+
- **Trace Adversary Movement**: Pivot to related actions (e.g., `s3:ListBuckets`, `iam:ListUsers`, `sts:GetCallerIdentity`) to track further enumeration.
67+
68+
69+
*False Positive Analysis*
70+
71+
72+
- Automation frameworks that rotate through multiple IPs or cloud functions with dynamic egress IPs may cause this alert to fire.
73+
- Confirm geolocation and workload context before escalating.
74+
75+
76+
*Response and Remediation*
77+
78+
79+
- **Revoke the Token**: Disable or rotate the IAM credentials and invalidate the temporary session token.
80+
- **Audit the Environment**: Look for signs of lateral movement or data access during the token's validity.
81+
- **Strengthen Controls**: Require MFA for high-privilege actions, restrict access via policy conditions (e.g., IP range or device).
82+
83+
84+
*References*
85+
86+
87+
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html[IAM Long-Term Credentials]
88+
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html[STS Temporary Credentials]
89+
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html[Using MFA with Temporary Credentials]
90+
- https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-standards-fsbp-controls.html[AWS Threat Detection Use Cases]
91+
92+
93+
==== Rule query
94+
95+
96+
[source, js]
97+
----------------------------------
98+
FROM logs-aws.cloudtrail* metadata _id, _version, _index
99+
| WHERE @timestamp > NOW() - 30 minutes
100+
// filter on CloudTrail logs for STS temporary session tokens used by IAM users
101+
102+
AND event.dataset == "aws.cloudtrail"
103+
AND aws.cloudtrail.user_identity.arn IS NOT NULL
104+
AND aws.cloudtrail.user_identity.type == "IAMUser"
105+
AND source.ip IS NOT NULL
106+
107+
// exclude known benign IaC tools and Amazon Network
108+
AND NOT (user_agent.original LIKE "%Terraform%" OR user_agent.original LIKE "%Ansible%" OR user_agent.original LIKE "%Pulumni%")
109+
AND `source.as.organization.name` != "AMAZON-AES"
110+
111+
// exclude noisy service APIs less indicative of malicous behavior
112+
AND event.provider NOT IN ("health.amazonaws.com", "monitoring.amazonaws.com", "notifications.amazonaws.com", "ce.amazonaws.com", "cost-optimization-hub.amazonaws.com", "servicecatalog-appregistry.amazonaws.com", "securityhub.amazonaws.com")
113+
114+
| EVAL
115+
// create a time window for aggregation
116+
time_window = DATE_TRUNC(30 minutes, @timestamp),
117+
// capture necessary fields for detection and investigation
118+
user_id = aws.cloudtrail.user_identity.arn,
119+
access_key_id = aws.cloudtrail.user_identity.access_key_id,
120+
ip = source.ip,
121+
user_agent = user_agent.original,
122+
ip_string = TO_STRING(source.ip), // Convert IP to string
123+
ip_user_agent_pair = CONCAT(ip_string, " - ", user_agent.original), // Combine IP and user agent
124+
ip_city_pair = CONCAT(ip_string, " - ", source.geo.city_name), // Combine IP and city
125+
city = source.geo.city_name,
126+
event_time = @timestamp,
127+
network_arn = `source.as.organization.name`
128+
129+
| STATS
130+
event_actions = VALUES(event.action),
131+
event_providers = VALUES(event.provider),
132+
access_key_id = VALUES(access_key_id),
133+
user_id = VALUES(user_id),
134+
ip_list = VALUES(ip), // Collect list of IPs
135+
user_agent_list = VALUES(user_agent), // Collect list of user agents
136+
ip_user_agent_pairs = VALUES(ip_user_agent_pair), // Collect list of IP - user agent pairs
137+
cities_list = VALUES(city), // Collect list of cities
138+
ip_city_pairs = VALUES(ip_city_pair), // Collect list of IP - city pairs
139+
networks_list = VALUES(network_arn), // Collect list of networks
140+
unique_ips = COUNT_DISTINCT(ip),
141+
unique_user_agents = COUNT_DISTINCT(user_agent),
142+
unique_cities = COUNT_DISTINCT(city),
143+
unique_networks = COUNT_DISTINCT(network_arn),
144+
first_seen = MIN(event_time),
145+
last_seen = MAX(event_time),
146+
total_events = COUNT()
147+
BY time_window, access_key_id
148+
149+
| EVAL
150+
// activity type based on combinations of detection criteria
151+
activity_type = CASE(
152+
unique_ips >= 2 AND unique_networks >= 2 AND unique_cities >= 2 AND unique_user_agents >= 2, "multiple_ip_network_city_user_agent", // high severity
153+
unique_ips >= 2 AND unique_networks >= 2 AND unique_cities >= 2, "multiple_ip_network_city", // high severity
154+
unique_ips >= 2 AND unique_cities >= 2, "multiple_ip_and_city", // medium severity
155+
unique_ips >= 2 AND unique_networks >= 2, "multiple_ip_and_network", // medium severity
156+
unique_ips >= 2 AND unique_user_agents >= 2, "multiple_ip_and_user_agent", // low severity
157+
"normal_activity"
158+
),
159+
// likelihood of malicious activity based on activity type
160+
fidelity_score = CASE(
161+
activity_type == "multiple_ip_network_city_user_agent", "high",
162+
activity_type == "multiple_ip_network_city", "high",
163+
activity_type == "multiple_ip_and_city", "medium",
164+
activity_type == "multiple_ip_and_network", "medium",
165+
activity_type == "multiple_ip_and_user_agent", "low"
166+
)
167+
168+
| KEEP
169+
time_window, activity_type, fidelity_score, total_events, first_seen, last_seen,
170+
user_id, access_key_id, event_actions, event_providers, ip_list, user_agent_list, ip_user_agent_pairs, cities_list, ip_city_pairs, networks_list, unique_ips, unique_user_agents, unique_cities, unique_networks
171+
172+
| WHERE activity_type != "normal_activity"
173+
174+
----------------------------------
175+
176+
*Framework*: MITRE ATT&CK^TM^
177+
178+
* Tactic:
179+
** Name: Initial Access
180+
** ID: TA0001
181+
** Reference URL: https://attack.mitre.org/tactics/TA0001/
182+
* Technique:
183+
** Name: Valid Accounts
184+
** ID: T1078
185+
** Reference URL: https://attack.mitre.org/techniques/T1078/
186+
* Sub-technique:
187+
** Name: Cloud Accounts
188+
** ID: T1078.004
189+
** Reference URL: https://attack.mitre.org/techniques/T1078/004/

0 commit comments

Comments
 (0)