nldcsc-elastic-rules 0.0.8__py3-none-any.whl → 0.0.16__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nldcsc_elastic_rules/__init__.py +1 -1
- nldcsc_elastic_rules/rules/{linux → cross-platform}/command_and_control_curl_wget_spawn_via_nodejs_parent.toml +32 -11
- nldcsc_elastic_rules/rules/cross-platform/command_and_control_genai_process_suspicious_tld_connection.toml +134 -0
- nldcsc_elastic_rules/rules/cross-platform/command_and_control_genai_process_unusual_domain.toml +128 -0
- nldcsc_elastic_rules/rules/cross-platform/credential_access_genai_process_sensitive_file_access.toml +154 -0
- nldcsc_elastic_rules/rules/cross-platform/credential_access_gitleaks_execution.toml +114 -0
- nldcsc_elastic_rules/rules/cross-platform/credential_access_multi_could_secrets_via_api.toml +198 -0
- nldcsc_elastic_rules/rules/cross-platform/credential_access_trufflehog_execution.toml +24 -5
- nldcsc_elastic_rules/rules/cross-platform/defense_evasion_genai_config_modification.toml +120 -0
- nldcsc_elastic_rules/rules/cross-platform/defense_evasion_genai_process_compiling_executables.toml +158 -0
- nldcsc_elastic_rules/rules/cross-platform/defense_evasion_genai_process_encoding_prior_to_network_activity.toml +172 -0
- nldcsc_elastic_rules/rules/cross-platform/defense_evasion_potential_http_downgrade_attack.toml +98 -0
- nldcsc_elastic_rules/rules/cross-platform/discovery_web_server_local_file_inclusion_activity.toml +172 -0
- nldcsc_elastic_rules/rules/cross-platform/discovery_web_server_remote_file_inclusion_activity.toml +133 -0
- nldcsc_elastic_rules/rules/cross-platform/execution_aws_ec2_lolbin_via_ssm.toml +250 -0
- nldcsc_elastic_rules/rules/{linux/persistence_nodejs_pre_or_post_install_script_execution.toml → cross-platform/execution_nodejs_pre_or_post_install_script_execution.toml} +40 -24
- nldcsc_elastic_rules/rules/cross-platform/execution_privileged_container_creation_with_host_reference.toml +146 -0
- nldcsc_elastic_rules/rules/cross-platform/execution_register_github_actions_runner.toml +126 -0
- nldcsc_elastic_rules/rules/cross-platform/execution_via_github_actions_runner.toml +130 -0
- nldcsc_elastic_rules/rules/cross-platform/execution_via_github_runner_with_runner_tracking_id_tampering_via_env_vars.toml +163 -0
- nldcsc_elastic_rules/rules/cross-platform/initial_access_execution_susp_react_serv_child.toml +130 -0
- nldcsc_elastic_rules/rules/cross-platform/initial_access_file_upload_followed_by_get_request.toml +145 -0
- nldcsc_elastic_rules/rules/cross-platform/multiple_alerts_elastic_defend_netsecurity_by_host.toml +4 -1
- nldcsc_elastic_rules/rules/cross-platform/persistence_credential_access_modify_auth_module_or_config.toml +3 -4
- nldcsc_elastic_rules/rules/cross-platform/persistence_web_server_potential_command_injection.toml +23 -25
- nldcsc_elastic_rules/rules/cross-platform/reconnaissance_web_server_discovery_or_fuzzing_activity.toml +13 -14
- nldcsc_elastic_rules/rules/cross-platform/reconnaissance_web_server_unusual_spike_in_error_logs.toml +8 -5
- nldcsc_elastic_rules/rules/cross-platform/reconnaissance_web_server_unusual_spike_in_error_response_codes.toml +12 -12
- nldcsc_elastic_rules/rules/cross-platform/reconnaissance_web_server_unusual_user_agents.toml +37 -43
- nldcsc_elastic_rules/rules/integrations/aws/defense_evasion_rds_instance_restored.toml +137 -45
- nldcsc_elastic_rules/rules/integrations/aws/discovery_iam_principal_enumeration_via_update_assume_role_policy.toml +152 -0
- nldcsc_elastic_rules/rules/integrations/aws/discovery_multiple_discovery_api_calls_via_cli.toml +242 -0
- nldcsc_elastic_rules/rules/integrations/aws/exfiltration_rds_snapshot_export.toml +141 -33
- nldcsc_elastic_rules/rules/integrations/aws/exfiltration_rds_snapshot_shared_with_another_account.toml +108 -30
- nldcsc_elastic_rules/rules/integrations/aws/exfiltration_s3_bucket_policy_added_for_external_account_access.toml +2 -1
- nldcsc_elastic_rules/rules/integrations/aws/exfiltration_s3_bucket_replicated_to_external_account.toml +114 -27
- nldcsc_elastic_rules/rules/integrations/aws/impact_efs_filesystem_deleted.toml +174 -0
- nldcsc_elastic_rules/rules/integrations/aws/impact_kms_cmk_disabled_or_scheduled_for_deletion.toml +111 -33
- nldcsc_elastic_rules/rules/integrations/aws/impact_rds_instance_cluster_deletion.toml +129 -43
- nldcsc_elastic_rules/rules/integrations/aws/impact_rds_instance_cluster_deletion_protection_disabled.toml +89 -27
- nldcsc_elastic_rules/rules/integrations/aws/impact_rds_snapshot_deleted.toml +127 -37
- nldcsc_elastic_rules/rules/integrations/aws/impact_s3_object_encryption_with_external_key.toml +160 -43
- nldcsc_elastic_rules/rules/integrations/aws/initial_access_iam_session_token_used_from_multiple_addresses.toml +20 -10
- nldcsc_elastic_rules/rules/integrations/aws/ml_cloudtrail_error_message_spike.toml +35 -1
- nldcsc_elastic_rules/rules/integrations/aws/ml_cloudtrail_rare_error_code.toml +59 -1
- nldcsc_elastic_rules/rules/integrations/aws/ml_cloudtrail_rare_method_by_city.toml +19 -1
- nldcsc_elastic_rules/rules/integrations/aws/ml_cloudtrail_rare_method_by_country.toml +19 -1
- nldcsc_elastic_rules/rules/integrations/aws/ml_cloudtrail_rare_method_by_user.toml +58 -1
- nldcsc_elastic_rules/rules/integrations/aws/persistence_rds_db_instance_password_modified.toml +109 -35
- nldcsc_elastic_rules/rules/integrations/aws/persistence_rds_instance_made_public.toml +103 -22
- nldcsc_elastic_rules/rules/integrations/aws/persistence_redshift_instance_creation.toml +3 -3
- nldcsc_elastic_rules/rules/integrations/aws/privilege_escalation_sts_assume_root_from_rare_user_and_member_account.toml +126 -69
- nldcsc_elastic_rules/rules/integrations/azure/credential_access_azure_entra_susp_device_code_signin.toml +134 -0
- nldcsc_elastic_rules/rules/integrations/azure/credential_access_entra_id_excessive_account_lockouts.toml +2 -2
- nldcsc_elastic_rules/rules/integrations/azure/ml_azure_event_failures.toml +124 -0
- nldcsc_elastic_rules/rules/integrations/azure/ml_azure_rare_event_failures.toml +148 -0
- nldcsc_elastic_rules/rules/integrations/azure/ml_azure_rare_method_by_city.toml +109 -0
- nldcsc_elastic_rules/rules/integrations/azure/ml_azure_rare_method_by_country.toml +108 -0
- nldcsc_elastic_rules/rules/integrations/azure/ml_azure_rare_method_by_user.toml +147 -0
- nldcsc_elastic_rules/rules/integrations/fim/persistence_suspicious_file_modifications.toml +9 -1
- nldcsc_elastic_rules/rules/integrations/gcp/ml_gcp_error_message_spike.toml +95 -0
- nldcsc_elastic_rules/rules/integrations/gcp/ml_gcp_rare_error_code.toml +118 -0
- nldcsc_elastic_rules/rules/integrations/gcp/ml_gcp_rare_method_by_city.toml +79 -0
- nldcsc_elastic_rules/rules/integrations/gcp/ml_gcp_rare_method_by_country.toml +79 -0
- nldcsc_elastic_rules/rules/integrations/gcp/ml_gcp_rare_method_by_user.toml +117 -0
- nldcsc_elastic_rules/rules/integrations/github/initial_access_github_register_self_hosted_runner.toml +92 -0
- nldcsc_elastic_rules/rules/integrations/o365/collection_onedrive_excessive_file_downloads.toml +24 -14
- nldcsc_elastic_rules/rules/linux/defense_evasion_file_deletion_via_shred.toml +12 -5
- nldcsc_elastic_rules/rules/linux/execution_suspicious_pod_or_container_creation_command_execution.toml +150 -0
- nldcsc_elastic_rules/rules/linux/persistence_at_job_creation.toml +4 -4
- nldcsc_elastic_rules/rules/linux/persistence_pluggable_authentication_module_creation.toml +12 -7
- nldcsc_elastic_rules/rules/linux/persistence_pth_file_creation.toml +6 -1
- nldcsc_elastic_rules/rules/linux/persistence_site_and_user_customize_file_creation.toml +6 -1
- nldcsc_elastic_rules/rules/linux/persistence_web_server_unusual_command_execution.toml +155 -0
- nldcsc_elastic_rules/rules/ml/ml_high_count_events_for_a_host_name.toml +58 -1
- nldcsc_elastic_rules/rules/ml/ml_high_count_network_denies.toml +71 -1
- nldcsc_elastic_rules/rules/ml/ml_high_count_network_events.toml +53 -1
- nldcsc_elastic_rules/rules/ml/ml_linux_anomalous_network_activity.toml +56 -1
- nldcsc_elastic_rules/rules/ml/ml_linux_anomalous_network_port_activity.toml +40 -1
- nldcsc_elastic_rules/rules/ml/ml_low_count_events_for_a_host_name.toml +27 -1
- nldcsc_elastic_rules/rules/ml/ml_packetbeat_rare_server_domain.toml +63 -1
- nldcsc_elastic_rules/rules/ml/ml_rare_destination_country.toml +68 -1
- nldcsc_elastic_rules/rules/ml/ml_spike_in_traffic_to_a_country.toml +53 -1
- nldcsc_elastic_rules/rules/ml/ml_windows_anomalous_network_activity.toml +56 -1
- nldcsc_elastic_rules/rules/network/initial_access_react_server_components_rce_attempt.toml +123 -0
- nldcsc_elastic_rules/rules/promotions/external_alerts.toml +2 -2
- nldcsc_elastic_rules/rules/windows/command_and_control_common_webservices.toml +4 -3
- nldcsc_elastic_rules/rules/windows/credential_access_rare_webdav_destination.toml +3 -4
- nldcsc_elastic_rules/rules/windows/defense_evasion_masquerading_as_svchost.toml +11 -8
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation.toml +25 -2
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation_backtick.toml +2 -3
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation_backtick_var.toml +2 -3
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation_char_arrays.toml +2 -3
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation_concat_dynamic.toml +2 -3
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation_high_number_proportion.toml +2 -3
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation_iex_env_vars_reconstruction.toml +2 -3
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation_iex_string_reconstruction.toml +2 -3
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation_index_reversal.toml +2 -3
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation_reverse_keyword.toml +2 -3
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation_string_concat.toml +2 -3
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation_string_format.toml +2 -3
- nldcsc_elastic_rules/rules/windows/defense_evasion_posh_obfuscation_whitespace_special_proportion.toml +2 -3
- nldcsc_elastic_rules/rules/windows/defense_evasion_wsl_filesystem.toml +13 -10
- nldcsc_elastic_rules/rules/windows/execution_posh_hacktool_functions.toml +3 -2
- nldcsc_elastic_rules/rules/windows/execution_suspicious_powershell_imgload.toml +7 -2
- nldcsc_elastic_rules/rules/windows/execution_windows_powershell_susp_args.toml +9 -2
- nldcsc_elastic_rules/rules/windows/impact_mod_critical_os_files.toml +16 -6
- nldcsc_elastic_rules/rules/windows/lateral_movement_credential_access_kerberos_correlation.toml +7 -2
- nldcsc_elastic_rules/rules/windows/lateral_movement_scheduled_task_target.toml +2 -2
- nldcsc_elastic_rules/rules/windows/persistence_browser_extension_install.toml +19 -2
- nldcsc_elastic_rules/rules/windows/persistence_msi_installer_task_startup.toml +50 -13
- nldcsc_elastic_rules/rules/windows/persistence_via_application_shimming.toml +12 -2
- nldcsc_elastic_rules/rules/windows/privilege_escalation_tokenmanip_sedebugpriv_enabled.toml +24 -18
- nldcsc_elastic_rules/rules/windows/privilege_escalation_unusual_printspooler_childprocess.toml +14 -2
- nldcsc_elastic_rules/rules/windows/privilege_escalation_via_ppid_spoofing.toml +3 -2
- {nldcsc_elastic_rules-0.0.8.dist-info → nldcsc_elastic_rules-0.0.16.dist-info}/METADATA +1 -1
- {nldcsc_elastic_rules-0.0.8.dist-info → nldcsc_elastic_rules-0.0.16.dist-info}/RECORD +119 -87
- nldcsc_elastic_rules/rules/integrations/aws/credential_access_aws_iam_assume_role_brute_force.toml +0 -105
- nldcsc_elastic_rules/rules/integrations/aws/discovery_ec2_multi_region_describe_instances.toml +0 -135
- nldcsc_elastic_rules/rules/integrations/aws/discovery_ec2_multiple_discovery_api_calls_via_cli.toml +0 -155
- nldcsc_elastic_rules/rules/integrations/aws/impact_efs_filesystem_or_mount_deleted.toml +0 -95
- {nldcsc_elastic_rules-0.0.8.dist-info → nldcsc_elastic_rules-0.0.16.dist-info}/WHEEL +0 -0
- {nldcsc_elastic_rules-0.0.8.dist-info → nldcsc_elastic_rules-0.0.16.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
creation_date = "2025/11/23"
|
|
3
|
+
integration = ["aws", "endpoint"]
|
|
4
|
+
maturity = "production"
|
|
5
|
+
updated_date = "2025/11/23"
|
|
6
|
+
|
|
7
|
+
[rule]
|
|
8
|
+
author = ["Elastic"]
|
|
9
|
+
description = """
|
|
10
|
+
Identifies the execution of Living Off the Land Binaries (LOLBins) or GTFOBins on EC2 instances via AWS Systems Manager
|
|
11
|
+
(SSM) `SendCommand` API. This detection correlates AWS CloudTrail `SendCommand` events with endpoint process execution
|
|
12
|
+
by matching SSM command IDs. While AWS redacts command parameters in CloudTrail logs, this correlation technique reveals
|
|
13
|
+
the actual commands executed on EC2 instances. Adversaries may abuse SSM to execute malicious commands remotely without
|
|
14
|
+
requiring SSH or RDP access, using legitimate system utilities for data exfiltration, establishing reverse shells, or
|
|
15
|
+
lateral movement.
|
|
16
|
+
"""
|
|
17
|
+
false_positives = [
|
|
18
|
+
"""
|
|
19
|
+
Legitimate administrative tasks using SSM to run system utilities may trigger this rule. Review the command context,
|
|
20
|
+
user identity, and timing to determine if the activity is authorized.
|
|
21
|
+
""",
|
|
22
|
+
"""
|
|
23
|
+
Automated configuration management or monitoring scripts that use LOLBins via SSM for legitimate purposes. Consider
|
|
24
|
+
excluding known automation accounts or specific command patterns.
|
|
25
|
+
""",
|
|
26
|
+
]
|
|
27
|
+
from = "now-9m"
|
|
28
|
+
interval = "8m"
|
|
29
|
+
language = "esql"
|
|
30
|
+
license = "Elastic License v2"
|
|
31
|
+
name = "AWS EC2 LOLBin Execution via SSM SendCommand"
|
|
32
|
+
note = """## Triage and analysis
|
|
33
|
+
|
|
34
|
+
### Investigating AWS EC2 LOLBin Execution via SSM SendCommand
|
|
35
|
+
|
|
36
|
+
AWS Systems Manager (SSM) enables remote command execution on EC2 instances without SSH/RDP access. While legitimate for administration, adversaries exploit this by running LOLBins—system utilities abused for malicious purposes like data theft or backdoors. This detection correlates CloudTrail API logs with endpoint telemetry using SSM command IDs, bypassing AWS's parameter redaction to reveal actual executed commands and identify suspicious activity.
|
|
37
|
+
|
|
38
|
+
This is an ESQL aggregation-based rule, thus all original event fields and detail may not be present in the alert. It is recommended to pivot into the raw events from both data sources for full context during investigation.
|
|
39
|
+
|
|
40
|
+
### Possible investigation steps
|
|
41
|
+
|
|
42
|
+
- Review the SSM command ID in the alert to track the full lifecycle of the command from initiation to execution across both CloudTrail and endpoint data
|
|
43
|
+
- Examine the CloudTrail user identity, including the ARN and access key ID, to determine who initiated the SSM command and verify if the activity is authorized
|
|
44
|
+
- Analyze the command lines of the executed LOLBins to understand what commands were run and assess their intent, looking for indicators of data exfiltration, reverse shells, or reconnaissance
|
|
45
|
+
- Check the source IP address and user agent from the CloudTrail event to identify if the request came from an expected location or tool
|
|
46
|
+
- Investigate the affected EC2 instances for other suspicious activities or signs of compromise during the same timeframe, including network connections and file modifications
|
|
47
|
+
- Review the SSM shell process details to see the full context of what the SSM agent executed and identify the parent-child process relationships
|
|
48
|
+
- Correlate the timing between the CloudTrail event and endpoint execution to ensure they occurred within the detection window and represent the same activity
|
|
49
|
+
- Check if the same user identity or source IP has executed similar SSM commands on other EC2 instances in your environment
|
|
50
|
+
|
|
51
|
+
### False positive analysis
|
|
52
|
+
|
|
53
|
+
- Routine administrative scripts that use utilities like curl, wget, or python for legitimate configuration management should be documented and excluded by user identity or source IP
|
|
54
|
+
- Automated monitoring tools that execute commands via SSM for health checks or data collection can be filtered by identifying their consistent patterns and access key IDs
|
|
55
|
+
- DevOps CI/CD pipelines that deploy or test applications using SSM may trigger alerts; create exceptions based on known automation roles or specific command patterns
|
|
56
|
+
- Security scanning tools that legitimately use SSM for vulnerability assessments should be allowlisted by their known IAM roles or source IPs
|
|
57
|
+
- Scheduled maintenance tasks using LOLBins for backup, log rotation, or data synchronization can be excluded by command pattern matching or execution timing
|
|
58
|
+
|
|
59
|
+
### Response and remediation
|
|
60
|
+
|
|
61
|
+
- Immediately isolate the affected EC2 instance from the network to prevent further unauthorized command execution or lateral movement
|
|
62
|
+
- Review AWS CloudTrail logs to identify the IAM user, role, or access key associated with the suspicious SSM command and revoke or rotate compromised credentials
|
|
63
|
+
- Terminate any unauthorized processes identified on the endpoint that match the LOLBin execution patterns detected in the alert
|
|
64
|
+
- Conduct a forensic analysis of the affected EC2 instance to identify any persistence mechanisms, backdoors, or data exfiltration indicators
|
|
65
|
+
- Implement stricter IAM policies to limit SSM `SendCommand` permissions to only trusted users and roles, following the principle of least privilege
|
|
66
|
+
- Enable multi-factor authentication (MFA) for IAM users with SSM execution privileges to reduce the risk of credential compromise
|
|
67
|
+
- Review and update VPC security groups and network ACLs to restrict outbound traffic from EC2 instances to only necessary destinations, preventing data exfiltration
|
|
68
|
+
- Escalate the incident to the security operations center (SOC) for further investigation and to determine if additional AWS resources or accounts have been compromised
|
|
69
|
+
"""
|
|
70
|
+
references = [
|
|
71
|
+
"https://www.mitiga.io/blog/abusing-the-amazon-web-services-ssm-agent-as-a-remote-access-trojan",
|
|
72
|
+
"https://www.kali.org/tools/pacu/",
|
|
73
|
+
"https://www.100daysofredteam.com/p/ghost-in-the-cloud-abusing-aws-ssm",
|
|
74
|
+
"https://hackingthe.cloud/aws/post_exploitation/run_shell_commands_on_ec2/",
|
|
75
|
+
"https://gtfobins.github.io/",
|
|
76
|
+
]
|
|
77
|
+
risk_score = 47
|
|
78
|
+
rule_id = "a8b3e2f0-8c7d-11ef-b4c6-f661ea17fbcd"
|
|
79
|
+
severity = "medium"
|
|
80
|
+
tags = [
|
|
81
|
+
"Domain: Cloud",
|
|
82
|
+
"Domain: Endpoint",
|
|
83
|
+
"OS: Linux",
|
|
84
|
+
"Use Case: Threat Detection",
|
|
85
|
+
"Tactic: Execution",
|
|
86
|
+
"Tactic: Command and Control",
|
|
87
|
+
"Data Source: AWS",
|
|
88
|
+
"Data Source: Amazon Web Services",
|
|
89
|
+
"Data Source: AWS CloudTrail",
|
|
90
|
+
"Data Source: AWS EC2",
|
|
91
|
+
"Data Source: AWS SSM",
|
|
92
|
+
"Data Source: AWS Systems Manager",
|
|
93
|
+
"Data Source: Elastic Defend",
|
|
94
|
+
"Resources: Investigation Guide",
|
|
95
|
+
]
|
|
96
|
+
timestamp_override = "event.ingested"
|
|
97
|
+
type = "esql"
|
|
98
|
+
|
|
99
|
+
query = '''
|
|
100
|
+
FROM logs-aws.cloudtrail*, logs-endpoint.events.process-* METADATA _id, _version, _index
|
|
101
|
+
| WHERE
|
|
102
|
+
// CloudTrail SSM SendCommand with AWS-RunShellScript
|
|
103
|
+
(
|
|
104
|
+
event.dataset == "aws.cloudtrail"
|
|
105
|
+
AND event.action == "SendCommand"
|
|
106
|
+
AND aws.cloudtrail.request_parameters LIKE "*documentName=AWS-RunShellScript*"
|
|
107
|
+
)
|
|
108
|
+
// Linux endpoint process events, prefiltered to SSM shell runner OR LOLBins/GTFOBins
|
|
109
|
+
OR
|
|
110
|
+
(
|
|
111
|
+
event.dataset == "endpoint.events.process"
|
|
112
|
+
AND host.os.type == "linux"
|
|
113
|
+
AND (
|
|
114
|
+
// SSM shell (_script.sh) runner
|
|
115
|
+
process.command_line LIKE "%/document/orchestration/%/awsrunShellScript/%/_script.sh"
|
|
116
|
+
// LOLBins / GTFOBins
|
|
117
|
+
OR process.name IN (
|
|
118
|
+
"base64",
|
|
119
|
+
"curl",
|
|
120
|
+
"wget",
|
|
121
|
+
"openssl",
|
|
122
|
+
"nc", "ncat", "netcat",
|
|
123
|
+
"socat",
|
|
124
|
+
"python", "python3",
|
|
125
|
+
"perl",
|
|
126
|
+
"php",
|
|
127
|
+
"ruby",
|
|
128
|
+
"ssh",
|
|
129
|
+
"scp",
|
|
130
|
+
"sftp",
|
|
131
|
+
"rsync"
|
|
132
|
+
)
|
|
133
|
+
)
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
// Endpoint leg: extract SSM command ID from parent command line
|
|
137
|
+
| DISSECT process.parent.command_line
|
|
138
|
+
"%{}/document/orchestration/%{Esql.process_parent_command_line_ssm_command_id}/%{}"
|
|
139
|
+
|
|
140
|
+
// CloudTrail leg: extract SSM command ID from response_elements
|
|
141
|
+
| DISSECT aws.cloudtrail.response_elements
|
|
142
|
+
"%{}commandId=%{Esql.aws_cloudtrail_response_elements_ssm_command_id},%{}"
|
|
143
|
+
|
|
144
|
+
// Coalesce SSM command ID from both data sources
|
|
145
|
+
| EVAL Esql.aws_ssm_command_id = COALESCE(
|
|
146
|
+
Esql.aws_cloudtrail_response_elements_ssm_command_id,
|
|
147
|
+
Esql.process_parent_command_line_ssm_command_id
|
|
148
|
+
)
|
|
149
|
+
| WHERE Esql.aws_ssm_command_id IS NOT NULL
|
|
150
|
+
|
|
151
|
+
// Role flags
|
|
152
|
+
| EVAL Esql.is_cloud_event = event.dataset == "aws.cloudtrail"
|
|
153
|
+
| EVAL Esql.is_endpoint_event = event.dataset == "endpoint.events.process"
|
|
154
|
+
|
|
155
|
+
// Identify the SSM shell processes (the _script.sh runners)
|
|
156
|
+
| EVAL Esql.is_ssm_shell_process =
|
|
157
|
+
Esql.is_endpoint_event
|
|
158
|
+
AND process.command_line LIKE "%/document/orchestration/%/awsrunShellScript/%/_script.sh"
|
|
159
|
+
|
|
160
|
+
// LOLBins / GTFOBins on Linux
|
|
161
|
+
| EVAL Esql.is_lolbin_process =
|
|
162
|
+
Esql.is_endpoint_event AND NOT Esql.is_ssm_shell_process
|
|
163
|
+
|
|
164
|
+
// Aggregate per SSM command ID
|
|
165
|
+
| STATS
|
|
166
|
+
// Core correlation counts & timing
|
|
167
|
+
Esql.aws_cloudtrail_event_count = SUM(CASE(Esql.is_cloud_event, 1, 0)),
|
|
168
|
+
Esql.endpoint_events_process_lolbin_count = SUM(CASE(Esql.is_lolbin_process, 1, 0)),
|
|
169
|
+
Esql.endpoint_events_process_ssm_shell_count = SUM(CASE(Esql.is_ssm_shell_process, 1, 0)),
|
|
170
|
+
Esql.aws_cloudtrail_first_event_ts = MIN(CASE(Esql.is_cloud_event, @timestamp, null)),
|
|
171
|
+
Esql.endpoint_events_process_first_lolbin_ts = MIN(CASE(Esql.is_lolbin_process, @timestamp, null)),
|
|
172
|
+
|
|
173
|
+
// AWS / CloudTrail identity & request context
|
|
174
|
+
Esql_priv.aws_cloudtrail_user_identity_arn_values =
|
|
175
|
+
VALUES(CASE(Esql.is_cloud_event, aws.cloudtrail.user_identity.arn, null)),
|
|
176
|
+
Esql_priv.aws_cloudtrail_user_identity_access_key_id_values =
|
|
177
|
+
VALUES(CASE(Esql.is_cloud_event, aws.cloudtrail.user_identity.access_key_id, null)),
|
|
178
|
+
Esql_priv.user_name_values =
|
|
179
|
+
VALUES(CASE(Esql.is_cloud_event, user.name, null)),
|
|
180
|
+
|
|
181
|
+
// AWS environment / request metadata
|
|
182
|
+
Esql.cloud_region_values = VALUES(CASE(Esql.is_cloud_event, cloud.region, null)),
|
|
183
|
+
Esql.source_ip_values = VALUES(CASE(Esql.is_cloud_event, source.ip, null)),
|
|
184
|
+
Esql.user_agent_original_values =
|
|
185
|
+
VALUES(CASE(Esql.is_cloud_event, user_agent.original, null)),
|
|
186
|
+
|
|
187
|
+
// Endpoint host & user context
|
|
188
|
+
Esql.host_name_values = VALUES(CASE(Esql.is_endpoint_event, host.name, null)),
|
|
189
|
+
Esql_priv.endpoint_user_name_values =
|
|
190
|
+
VALUES(CASE(Esql.is_endpoint_event, user.name, null)),
|
|
191
|
+
|
|
192
|
+
// SSM shell processes on endpoint
|
|
193
|
+
Esql.process_command_line_ssm_shell_values =
|
|
194
|
+
VALUES(CASE(Esql.is_ssm_shell_process, process.command_line, null)),
|
|
195
|
+
Esql.process_pid_ssm_shell_values =
|
|
196
|
+
VALUES(CASE(Esql.is_ssm_shell_process, process.pid, null)),
|
|
197
|
+
|
|
198
|
+
// LOLBin processes on endpoint
|
|
199
|
+
Esql.process_name_lolbin_values =
|
|
200
|
+
VALUES(CASE(Esql.is_lolbin_process, process.name, null)),
|
|
201
|
+
Esql.process_executable_lolbin_values =
|
|
202
|
+
VALUES(CASE(Esql.is_lolbin_process, process.executable, null)),
|
|
203
|
+
Esql.process_command_line_lolbin_values =
|
|
204
|
+
VALUES(CASE(Esql.is_lolbin_process, process.command_line, null)),
|
|
205
|
+
Esql.process_pid_lolbin_values =
|
|
206
|
+
VALUES(CASE(Esql.is_lolbin_process, process.pid, null)),
|
|
207
|
+
Esql.process_parent_command_line_lolbin_values =
|
|
208
|
+
VALUES(CASE(Esql.is_lolbin_process, process.parent.command_line, null)),
|
|
209
|
+
|
|
210
|
+
Esql.data_stream_namespace_values = VALUES(data_stream.namespace)
|
|
211
|
+
BY Esql.aws_ssm_command_id
|
|
212
|
+
|
|
213
|
+
// Detection condition: SSM SendCommand + AWS-RunShellScript + LOLBin on endpoint
|
|
214
|
+
| WHERE Esql.aws_cloudtrail_event_count > 0
|
|
215
|
+
AND Esql.endpoint_events_process_lolbin_count > 0
|
|
216
|
+
AND DATE_DIFF(
|
|
217
|
+
"minutes",
|
|
218
|
+
Esql.endpoint_events_process_first_lolbin_ts,
|
|
219
|
+
Esql.aws_cloudtrail_first_event_ts
|
|
220
|
+
) <= 5
|
|
221
|
+
| SORT Esql.aws_cloudtrail_first_event_ts ASC
|
|
222
|
+
| KEEP Esql.*, Esql_priv.*
|
|
223
|
+
'''
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
[[rule.threat]]
|
|
227
|
+
framework = "MITRE ATT&CK"
|
|
228
|
+
[[rule.threat.technique]]
|
|
229
|
+
id = "T1651"
|
|
230
|
+
name = "Cloud Administration Command"
|
|
231
|
+
reference = "https://attack.mitre.org/techniques/T1651/"
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
[rule.threat.tactic]
|
|
235
|
+
id = "TA0002"
|
|
236
|
+
name = "Execution"
|
|
237
|
+
reference = "https://attack.mitre.org/tactics/TA0002/"
|
|
238
|
+
[[rule.threat]]
|
|
239
|
+
framework = "MITRE ATT&CK"
|
|
240
|
+
[[rule.threat.technique]]
|
|
241
|
+
id = "T1105"
|
|
242
|
+
name = "Ingress Tool Transfer"
|
|
243
|
+
reference = "https://attack.mitre.org/techniques/T1105/"
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
[rule.threat.tactic]
|
|
247
|
+
id = "TA0011"
|
|
248
|
+
name = "Command and Control"
|
|
249
|
+
reference = "https://attack.mitre.org/tactics/TA0011/"
|
|
250
|
+
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
creation_date = "2025/09/18"
|
|
3
|
-
integration = ["endpoint", "crowdstrike"]
|
|
3
|
+
integration = ["endpoint", "crowdstrike", "sentinel_one_cloud_funnel"]
|
|
4
4
|
maturity = "production"
|
|
5
|
-
updated_date = "2025/
|
|
5
|
+
updated_date = "2025/12/03"
|
|
6
6
|
|
|
7
7
|
[rule]
|
|
8
8
|
author = ["Elastic"]
|
|
@@ -13,11 +13,15 @@ this technique to execute arbitrary commands on the system and establish persist
|
|
|
13
13
|
was observed in the wild as part of the Shai-Hulud worm.
|
|
14
14
|
"""
|
|
15
15
|
from = "now-9m"
|
|
16
|
-
index = ["logs-endpoint.events.process*", "logs-crowdstrike.fdr*"]
|
|
16
|
+
index = ["logs-endpoint.events.process*", "logs-crowdstrike.fdr*", "logs-sentinel_one_cloud_funnel.*"]
|
|
17
17
|
language = "eql"
|
|
18
18
|
license = "Elastic License v2"
|
|
19
19
|
name = "Node.js Pre or Post-Install Script Execution"
|
|
20
|
-
references = [
|
|
20
|
+
references = [
|
|
21
|
+
"https://www.elastic.co/blog/shai-hulud-worm-npm-supply-chain-compromise",
|
|
22
|
+
"https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack",
|
|
23
|
+
"https://www.elastic.co/blog/shai-hulud-worm-2-0-updated-response",
|
|
24
|
+
]
|
|
21
25
|
risk_score = 47
|
|
22
26
|
rule_id = "0871a5d8-6b5f-4a12-a568-fd7bc05bd8db"
|
|
23
27
|
setup = """## Setup
|
|
@@ -49,6 +53,7 @@ severity = "medium"
|
|
|
49
53
|
tags = [
|
|
50
54
|
"Domain: Endpoint",
|
|
51
55
|
"OS: Linux",
|
|
56
|
+
"OS: macOS",
|
|
52
57
|
"Use Case: Threat Detection",
|
|
53
58
|
"Tactic: Persistence",
|
|
54
59
|
"Tactic: Execution",
|
|
@@ -56,35 +61,18 @@ tags = [
|
|
|
56
61
|
"Data Source: Elastic Defend",
|
|
57
62
|
"Resources: Investigation Guide",
|
|
58
63
|
"Data Source: Crowdstrike",
|
|
64
|
+
"Data Source: SentinelOne",
|
|
59
65
|
]
|
|
60
66
|
type = "eql"
|
|
61
67
|
query = '''
|
|
62
68
|
sequence by host.id with maxspan=10s
|
|
63
|
-
[process where host.os.type
|
|
64
|
-
[process where host.os.type
|
|
69
|
+
[process where host.os.type in ("linux", "macos") and event.type == "start" and event.action in ("exec", "ProcessRollup2", "start") and process.name == "node" and process.args == "install"] by process.entity_id
|
|
70
|
+
[process where host.os.type in ("linux", "macos") and event.type == "start" and event.action in ("exec", "ProcessRollup2", "start") and process.parent.name == "node"] by process.parent.entity_id
|
|
65
71
|
'''
|
|
66
72
|
|
|
67
73
|
[[rule.threat]]
|
|
68
74
|
framework = "MITRE ATT&CK"
|
|
69
75
|
|
|
70
|
-
[[rule.threat.technique]]
|
|
71
|
-
id = "T1543"
|
|
72
|
-
name = "Create or Modify System Process"
|
|
73
|
-
reference = "https://attack.mitre.org/techniques/T1543/"
|
|
74
|
-
|
|
75
|
-
[[rule.threat.technique]]
|
|
76
|
-
id = "T1574"
|
|
77
|
-
name = "Hijack Execution Flow"
|
|
78
|
-
reference = "https://attack.mitre.org/techniques/T1574/"
|
|
79
|
-
|
|
80
|
-
[rule.threat.tactic]
|
|
81
|
-
id = "TA0003"
|
|
82
|
-
name = "Persistence"
|
|
83
|
-
reference = "https://attack.mitre.org/tactics/TA0003/"
|
|
84
|
-
|
|
85
|
-
[[rule.threat]]
|
|
86
|
-
framework = "MITRE ATT&CK"
|
|
87
|
-
|
|
88
76
|
[[rule.threat.technique]]
|
|
89
77
|
id = "T1059"
|
|
90
78
|
name = "Command and Scripting Interpreter"
|
|
@@ -95,6 +83,16 @@ id = "T1059.004"
|
|
|
95
83
|
name = "Unix Shell"
|
|
96
84
|
reference = "https://attack.mitre.org/techniques/T1059/004/"
|
|
97
85
|
|
|
86
|
+
[[rule.threat.technique]]
|
|
87
|
+
id = "T1204"
|
|
88
|
+
name = "User Execution"
|
|
89
|
+
reference = "https://attack.mitre.org/techniques/T1204/"
|
|
90
|
+
|
|
91
|
+
[[rule.threat.technique.subtechnique]]
|
|
92
|
+
id = "T1204.005"
|
|
93
|
+
name = "Malicious Library"
|
|
94
|
+
reference = "https://attack.mitre.org/techniques/T1204/005/"
|
|
95
|
+
|
|
98
96
|
[rule.threat.tactic]
|
|
99
97
|
id = "TA0002"
|
|
100
98
|
name = "Execution"
|
|
@@ -103,6 +101,24 @@ reference = "https://attack.mitre.org/tactics/TA0002/"
|
|
|
103
101
|
[[rule.threat]]
|
|
104
102
|
framework = "MITRE ATT&CK"
|
|
105
103
|
|
|
104
|
+
[[rule.threat.technique]]
|
|
105
|
+
id = "T1543"
|
|
106
|
+
name = "Create or Modify System Process"
|
|
107
|
+
reference = "https://attack.mitre.org/techniques/T1543/"
|
|
108
|
+
|
|
109
|
+
[[rule.threat.technique]]
|
|
110
|
+
id = "T1574"
|
|
111
|
+
name = "Hijack Execution Flow"
|
|
112
|
+
reference = "https://attack.mitre.org/techniques/T1574/"
|
|
113
|
+
|
|
114
|
+
[rule.threat.tactic]
|
|
115
|
+
id = "TA0003"
|
|
116
|
+
name = "Persistence"
|
|
117
|
+
reference = "https://attack.mitre.org/tactics/TA0003/"
|
|
118
|
+
|
|
119
|
+
[[rule.threat]]
|
|
120
|
+
framework = "MITRE ATT&CK"
|
|
121
|
+
|
|
106
122
|
[rule.threat.tactic]
|
|
107
123
|
id = "TA0005"
|
|
108
124
|
name = "Defense Evasion"
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
creation_date = "2025/11/27"
|
|
3
|
+
integration = ["endpoint", "auditd_manager", "crowdstrike", "sentinel_one_cloud_funnel"]
|
|
4
|
+
maturity = "production"
|
|
5
|
+
updated_date = "2025/11/27"
|
|
6
|
+
|
|
7
|
+
[rule]
|
|
8
|
+
author = ["Elastic"]
|
|
9
|
+
description = """
|
|
10
|
+
This rule detects the creation of privileged containers that mount host directories into the container's filesystem.
|
|
11
|
+
Such configurations can be exploited by attackers to escape the container isolation and gain access to the host system,
|
|
12
|
+
potentially leading to privilege escalation and lateral movement within the environment.
|
|
13
|
+
"""
|
|
14
|
+
from = "now-9m"
|
|
15
|
+
index = [
|
|
16
|
+
"auditbeat-*",
|
|
17
|
+
"endgame-*",
|
|
18
|
+
"logs-auditd_manager.auditd-*",
|
|
19
|
+
"logs-crowdstrike.fdr*",
|
|
20
|
+
"logs-endpoint.events.process*",
|
|
21
|
+
"logs-sentinel_one_cloud_funnel.*",
|
|
22
|
+
]
|
|
23
|
+
language = "eql"
|
|
24
|
+
license = "Elastic License v2"
|
|
25
|
+
name = "Privileged Container Creation with Host Directory Mount"
|
|
26
|
+
note = """## Triage and analysis
|
|
27
|
+
|
|
28
|
+
> **Disclaimer**:
|
|
29
|
+
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
|
|
30
|
+
|
|
31
|
+
### Investigating Privileged Container Creation with Host Directory Mount
|
|
32
|
+
|
|
33
|
+
This rule flags creation of a privileged container that bind-mounts host directories into the container filesystem, breaking isolation and granting direct access to host files and devices. An attacker on a compromised node starts a privileged container via the runtime, bind-mounts the host root (/:) inside it, then chroots and alters critical files or services to seize host control, persist, and pivot.
|
|
34
|
+
|
|
35
|
+
### Possible investigation steps
|
|
36
|
+
|
|
37
|
+
- Retrieve the full process tree and execution context (user, controlling TTY, parent, remote source IP) to identify who initiated the container and whether it aligns with a sanctioned change.
|
|
38
|
+
- Run runtime introspection to confirm the container’s mounts and privileges (e.g., docker ps/inspect or CRI equivalents), capturing the container ID, exact hostPath mappings, image, entrypoint, and start time.
|
|
39
|
+
- If orchestrated, correlate with Kubernetes events and kubelet logs at the same timestamp to find any Pod using privileged: true with hostPath volumes, recording the namespace, service account, controller, and requestor.
|
|
40
|
+
- Review audit and file integrity telemetry after container start for host-impacting actions such as chroot into the mount, nsenter into host namespaces, or writes to critical paths (/etc/passwd, /etc/sudoers, /root/.ssh, /var/lib/kubelet, and systemd unit directories).
|
|
41
|
+
- Assess image provenance and intent by resolving the image digest and registry, reviewing history/entrypoint for post-start tooling, and validating with service owners or allowlists whether this privileged host-mount is expected on this node.
|
|
42
|
+
|
|
43
|
+
### False positive analysis
|
|
44
|
+
|
|
45
|
+
- An administrator uses docker run --privileged with -v /:/host during a break-glass or troubleshooting session to edit host files or restart services, matching the pattern but aligned with an approved maintenance procedure.
|
|
46
|
+
- Automated provisioning or upgrade workflows intentionally start a privileged container that bind-mounts / to apply system configuration, install packages, or manage kernel modules during node bootstrap, producing an expected event.
|
|
47
|
+
|
|
48
|
+
### Response and remediation
|
|
49
|
+
|
|
50
|
+
- Immediately stop and remove the privileged container by its ID using docker, cordon the node to prevent scheduling, and temporarily disable the Docker/CRI socket to block further privileged runs.
|
|
51
|
+
- Preserve forensic artifacts (docker inspect output, container image and filesystem, bash history, /var/log) and remediate by diffing and restoring critical paths (/etc, /root/.ssh, /etc/systemd/system, /var/lib/kubelet), removing rogue users, SSH keys, and systemd units.
|
|
52
|
+
- Rotate credentials potentially exposed by the host mount (SSH keys, kubelet certs, cloud tokens under /var/lib/kubelet or /root), patch the container runtime, and uncordon or rejoin the node only after verifying privileged runs and host-root mounts are blocked.
|
|
53
|
+
- Escalate to incident response if the mount included "/" or if evidence shows chroot or nsenter into host namespaces or writes to /etc/passwd, /etc/sudoers, or systemd unit files, and initiate host reimage and broader fleet scoping.
|
|
54
|
+
- Enforce controls that deny --privileged and hostPath of "/" via admission policy (Pod Security Standards, Kyverno, OPA Gatekeeper), drop CAP_SYS_ADMIN with seccomp/AppArmor, enable Docker userns-remap and no-new-privileges, and restrict membership in the docker group.
|
|
55
|
+
- Establish a break-glass approval workflow and an allowlist for legitimate host mounts, enable file integrity monitoring on /etc and kubelet directories, and add runtime rules to alert and block future docker run -v /:/host attempts."""
|
|
56
|
+
references = [
|
|
57
|
+
"https://www.elastic.co/blog/shai-hulud-worm-npm-supply-chain-compromise",
|
|
58
|
+
"https://socket.dev/blog/shai-hulud-strikes-again-v2",
|
|
59
|
+
"https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack",
|
|
60
|
+
"https://unit42.paloaltonetworks.com/container-escape-techniques/",
|
|
61
|
+
]
|
|
62
|
+
risk_score = 73
|
|
63
|
+
rule_id = "d1f310cb-5921-4d37-bbdf-cfdab7a6df9c"
|
|
64
|
+
setup = """## Setup
|
|
65
|
+
This rule requires data coming in from Elastic Defend.
|
|
66
|
+
### Elastic Defend Integration Setup
|
|
67
|
+
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
|
|
68
|
+
#### Prerequisite Requirements:
|
|
69
|
+
- Fleet is required for Elastic Defend.
|
|
70
|
+
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
|
|
71
|
+
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
|
|
72
|
+
- Go to the Kibana home page and click "Add integrations".
|
|
73
|
+
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
|
|
74
|
+
- Click "Add Elastic Defend".
|
|
75
|
+
- Configure the integration name and optionally add a description.
|
|
76
|
+
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
|
|
77
|
+
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
|
|
78
|
+
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
|
|
79
|
+
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
|
|
80
|
+
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
|
|
81
|
+
- Click "Save and Continue".
|
|
82
|
+
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
|
|
83
|
+
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
|
|
84
|
+
"""
|
|
85
|
+
severity = "high"
|
|
86
|
+
tags = [
|
|
87
|
+
"Domain: Endpoint",
|
|
88
|
+
"Domain: Container",
|
|
89
|
+
"OS: Linux",
|
|
90
|
+
"OS: macOS",
|
|
91
|
+
"Use Case: Threat Detection",
|
|
92
|
+
"Tactic: Execution",
|
|
93
|
+
"Data Source: Elastic Defend",
|
|
94
|
+
"Data Source: Elastic Endgame",
|
|
95
|
+
"Data Source: Auditd Manager",
|
|
96
|
+
"Data Source: Crowdstrike",
|
|
97
|
+
"Data Source: SentinelOne",
|
|
98
|
+
"Resources: Investigation Guide",
|
|
99
|
+
]
|
|
100
|
+
timestamp_override = "event.ingested"
|
|
101
|
+
type = "eql"
|
|
102
|
+
query = '''
|
|
103
|
+
process where event.type == "start" and event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
|
|
104
|
+
process.name == "docker" and process.args == "--privileged" and process.args == "run" and
|
|
105
|
+
process.args == "-v" and process.args like "/:/*" and
|
|
106
|
+
not (
|
|
107
|
+
(process.args == "aktosecurity/mirror-api-logging:k8s_ebpf" and process.args == "akto-api-security-traffic-collector") or
|
|
108
|
+
(process.args like "goharbor/prepare:*" and process.args in ("/:/hostfs", "/:/hostfs/"))
|
|
109
|
+
)
|
|
110
|
+
'''
|
|
111
|
+
|
|
112
|
+
[[rule.threat]]
|
|
113
|
+
framework = "MITRE ATT&CK"
|
|
114
|
+
|
|
115
|
+
[[rule.threat.technique]]
|
|
116
|
+
id = "T1059"
|
|
117
|
+
name = "Command and Scripting Interpreter"
|
|
118
|
+
reference = "https://attack.mitre.org/techniques/T1059/"
|
|
119
|
+
|
|
120
|
+
[[rule.threat.technique.subtechnique]]
|
|
121
|
+
id = "T1059.004"
|
|
122
|
+
name = "Unix Shell"
|
|
123
|
+
reference = "https://attack.mitre.org/techniques/T1059/004/"
|
|
124
|
+
|
|
125
|
+
[[rule.threat.technique]]
|
|
126
|
+
id = "T1609"
|
|
127
|
+
name = "Container Administration Command"
|
|
128
|
+
reference = "https://attack.mitre.org/techniques/T1609/"
|
|
129
|
+
|
|
130
|
+
[rule.threat.tactic]
|
|
131
|
+
id = "TA0002"
|
|
132
|
+
name = "Execution"
|
|
133
|
+
reference = "https://attack.mitre.org/tactics/TA0002/"
|
|
134
|
+
|
|
135
|
+
[[rule.threat]]
|
|
136
|
+
framework = "MITRE ATT&CK"
|
|
137
|
+
|
|
138
|
+
[[rule.threat.technique]]
|
|
139
|
+
id = "T1611"
|
|
140
|
+
name = "Escape to Host"
|
|
141
|
+
reference = "https://attack.mitre.org/techniques/T1611/"
|
|
142
|
+
|
|
143
|
+
[rule.threat.tactic]
|
|
144
|
+
id = "TA0004"
|
|
145
|
+
name = "Privilege Escalation"
|
|
146
|
+
reference = "https://attack.mitre.org/tactics/TA0004/"
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
creation_date = "2025/11/26"
|
|
3
|
+
integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike", "auditd_manager"]
|
|
4
|
+
maturity = "production"
|
|
5
|
+
updated_date = "2025/11/26"
|
|
6
|
+
|
|
7
|
+
[rule]
|
|
8
|
+
author = ["Elastic"]
|
|
9
|
+
description = """
|
|
10
|
+
This rule detects the configuration of a GitHub Actions self-hosted runner using the Runner.Listener binary.
|
|
11
|
+
When a machine is registered to a remote repository, its owner gains the ability to execute arbitrary workflow commands on that host.
|
|
12
|
+
Unexpected or unauthorized runner registration may indicate adversarial activity aimed at establishing remote code execution
|
|
13
|
+
via malicious GitHub workflows.
|
|
14
|
+
"""
|
|
15
|
+
false_positives = [
|
|
16
|
+
"Authorized github repository with no malicious workflow actions.",
|
|
17
|
+
]
|
|
18
|
+
from = "now-9m"
|
|
19
|
+
index = [
|
|
20
|
+
"endgame-*",
|
|
21
|
+
"logs-crowdstrike.fdr*",
|
|
22
|
+
"logs-endpoint.events.process-*",
|
|
23
|
+
"logs-m365_defender.event-*",
|
|
24
|
+
"logs-sentinel_one_cloud_funnel.*",
|
|
25
|
+
"logs-system.security*",
|
|
26
|
+
"logs-windows.forwarded*",
|
|
27
|
+
"logs-windows.sysmon_operational-*",
|
|
28
|
+
"winlogbeat-*",
|
|
29
|
+
"auditbeat-*",
|
|
30
|
+
"logs-auditd_manager.auditd-*"
|
|
31
|
+
]
|
|
32
|
+
language = "eql"
|
|
33
|
+
license = "Elastic License v2"
|
|
34
|
+
name = "Remote GitHub Actions Runner Registration"
|
|
35
|
+
note = """## Triage and analysis
|
|
36
|
+
|
|
37
|
+
### Investigating Remote GitHub Actions Runner Registration
|
|
38
|
+
|
|
39
|
+
Unexpected or unauthorized Github actions runner registration may indicate adversarial activity aimed at establishing remote code execution via malicious GitHub workflows.
|
|
40
|
+
|
|
41
|
+
### Possible investigation steps
|
|
42
|
+
|
|
43
|
+
- Review the remote repository details and reputation.
|
|
44
|
+
- Examine the remote repository for any suspicious workflows run commands in the `.github/workflows` folder.
|
|
45
|
+
- Examine the execution context like process tree, associated network and file activities.
|
|
46
|
+
- Verify if there is adjascent any sensitive file access or collection.
|
|
47
|
+
- Correlate with other alerts and investiguate if this activity is related to a supply chain attack.
|
|
48
|
+
|
|
49
|
+
### False positive analysis
|
|
50
|
+
|
|
51
|
+
- Authorized configuration changes.
|
|
52
|
+
|
|
53
|
+
### Response and remediation
|
|
54
|
+
|
|
55
|
+
- Immediately isolate the affected system from the network to prevent further unauthorized command execution and potential lateral movement.
|
|
56
|
+
- Terminate any suspicious child processes that were initiated by the registered Github actions runner.
|
|
57
|
+
- Conduct a thorough review of the affected system's logs and configurations to identify any unauthorized changes or additional indicators of compromise.
|
|
58
|
+
- Restore the system from a known good backup if any unauthorized changes or malicious activities are confirmed.
|
|
59
|
+
- Implement application whitelisting to prevent unauthorized execution.
|
|
60
|
+
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to assess the potential impact on the broader network."""
|
|
61
|
+
references = [
|
|
62
|
+
"https://www.elastic.co/blog/shai-hulud-worm-npm-supply-chain-compromise",
|
|
63
|
+
"https://socket.dev/blog/shai-hulud-strikes-again-v2",
|
|
64
|
+
]
|
|
65
|
+
risk_score = 47
|
|
66
|
+
rule_id = "57e118c1-19eb-4c20-93a6-8a6c30a5b48b"
|
|
67
|
+
severity = "medium"
|
|
68
|
+
tags = [
|
|
69
|
+
"Domain: Endpoint",
|
|
70
|
+
"OS: Linux",
|
|
71
|
+
"OS: Windows",
|
|
72
|
+
"OS: macOS",
|
|
73
|
+
"Use Case: Threat Detection",
|
|
74
|
+
"Tactic: Execution",
|
|
75
|
+
"Tactic: Initial Access",
|
|
76
|
+
"Data Source: Elastic Endgame",
|
|
77
|
+
"Data Source: Elastic Defend",
|
|
78
|
+
"Data Source: Windows Security Event Logs",
|
|
79
|
+
"Data Source: Microsoft Defender for Endpoint",
|
|
80
|
+
"Data Source: Sysmon",
|
|
81
|
+
"Data Source: SentinelOne",
|
|
82
|
+
"Data Source: Crowdstrike",
|
|
83
|
+
"Data Source: Auditd Manager",
|
|
84
|
+
"Resources: Investigation Guide",
|
|
85
|
+
]
|
|
86
|
+
timestamp_override = "event.ingested"
|
|
87
|
+
type = "eql"
|
|
88
|
+
|
|
89
|
+
query = '''
|
|
90
|
+
process where event.type == "start" and event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
|
|
91
|
+
process.name in ("Runner.Listener", "Runner.Listener.exe") and
|
|
92
|
+
process.args == "configure" and process.args == "--url" and process.args == "--token"
|
|
93
|
+
'''
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
[[rule.threat]]
|
|
97
|
+
framework = "MITRE ATT&CK"
|
|
98
|
+
[[rule.threat.technique]]
|
|
99
|
+
id = "T1059"
|
|
100
|
+
name = "Command and Scripting Interpreter"
|
|
101
|
+
reference = "https://attack.mitre.org/techniques/T1059/"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
[rule.threat.tactic]
|
|
106
|
+
id = "TA0002"
|
|
107
|
+
name = "Execution"
|
|
108
|
+
reference = "https://attack.mitre.org/tactics/TA0002/"
|
|
109
|
+
[[rule.threat]]
|
|
110
|
+
framework = "MITRE ATT&CK"
|
|
111
|
+
[[rule.threat.technique]]
|
|
112
|
+
id = "T1195"
|
|
113
|
+
name = "Supply Chain Compromise"
|
|
114
|
+
reference = "https://attack.mitre.org/techniques/T1195/"
|
|
115
|
+
[[rule.threat.technique.subtechnique]]
|
|
116
|
+
id = "T1195.002"
|
|
117
|
+
name = "Compromise Software Supply Chain"
|
|
118
|
+
reference = "https://attack.mitre.org/techniques/T1195/002/"
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
[rule.threat.tactic]
|
|
123
|
+
id = "TA0001"
|
|
124
|
+
name = "Initial Access"
|
|
125
|
+
reference = "https://attack.mitre.org/tactics/TA0001/"
|
|
126
|
+
|