Skip to content

Commit

Permalink
Update latest docs
Browse files Browse the repository at this point in the history
  • Loading branch information
protectionsmachine committed Sep 17, 2024
1 parent d576233 commit 21b4428
Show file tree
Hide file tree
Showing 63 changed files with 5,598 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[[prebuilt-rule-8-13-17-attempt-to-establish-vscode-remote-tunnel]]
=== Attempt to Establish VScode Remote Tunnel

Detects the execution of the VScode portable binary with the tunnel command line option indicating an attempt to establish a remote tunnel session to Github or a remote VScode instance.

*Rule type*: eql

*Rule indices*:

* logs-endpoint.events.process-*
* winlogbeat-*
* logs-windows.sysmon_operational-*
* logs-system.security*
* endgame-*
* logs-sentinel_one_cloud_funnel.*
* logs-m365_defender.event-*

*Severity*: medium

*Risk score*: 47

*Runs every*: 5m

*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)

*Maximum alerts per execution*: 100

*References*:

* https://badoption.eu/blog/2023/01/31/code_c2.html
* https://code.visualstudio.com/docs/remote/tunnels

*Tags*:

* Domain: Endpoint
* OS: Windows
* Use Case: Threat Detection
* Tactic: Command and Control
* Data Source: Elastic Endgame
* Data Source: Elastic Defend
* Data Source: Sysmon
* Data Source: SentinelOne
* Data Source: Microsoft Defender for Endpoint
* Data Source: System

*Version*: 1

*Rule authors*:

* Elastic

*Rule license*: Elastic License v2


==== Rule query


[source, js]
----------------------------------
process where host.os.type == "windows" and event.type == "start" and
process.args : "tunnel" and (process.args : "--accept-server-license-terms" or process.name : "code*.exe")
----------------------------------

*Framework*: MITRE ATT&CK^TM^

* Tactic:
** Name: Command and Control
** ID: TA0011
** Reference URL: https://attack.mitre.org/tactics/TA0011/
* Technique:
** Name: Remote Access Software
** ID: T1219
** Reference URL: https://attack.mitre.org/techniques/T1219/
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
[[prebuilt-rule-8-13-17-attempts-to-brute-force-a-microsoft-365-user-account]]
=== Attempts to Brute Force a Microsoft 365 User Account

Identifies potential brute-force attempts against Microsoft 365 user accounts by detecting a high number of failed login attempts or login sources within a 30-minute window. Attackers may attempt to brute force user accounts to gain unauthorized access to Microsoft 365 services.

*Rule type*: esql

*Rule indices*: None

*Severity*: medium

*Risk score*: 47

*Runs every*: 5m

*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)

*Maximum alerts per execution*: 100

*References*:

* https://blueteamblog.com/7-ways-to-monitor-your-office-365-logs-using-siem
* https://learn.microsoft.com/en-us/purview/audit-log-detailed-properties

*Tags*:

* Domain: Cloud
* Domain: SaaS
* Data Source: Microsoft 365
* Use Case: Identity and Access Audit
* Use Case: Threat Detection
* Tactic: Credential Access

*Version*: 309

*Rule authors*:

* Elastic
* Willem D'Haese
* Austin Songer

*Rule license*: Elastic License v2


==== Rule query


[source, js]
----------------------------------
from logs-o365.audit-*
// truncate the timestamp to a 30-minute window
| eval target_time_window = DATE_TRUNC(30 minutes, @timestamp)
| mv_expand event.category
| where event.dataset == "o365.audit"
and event.category == "authentication"
// filter only on Entra ID or Exchange audit logs in O365 integration
and event.provider in ("AzureActiveDirectory", "Exchange")
// filter only for UserLoginFailed or partial failures
and event.action in ("UserLoginFailed", "PasswordLogonInitialAuthUsingPassword")
// ignore specific logon errors
and not o365.audit.LogonError in (
"EntitlementGrantsNotFound",
"UserStrongAuthEnrollmentRequired",
"UserStrongAuthClientAuthNRequired",
"InvalidReplyTo",
"SsoArtifactExpiredDueToConditionalAccess",
"PasswordResetRegistrationRequiredInterrupt",
"SsoUserAccountNotFoundInResourceTenant",
"UserStrongAuthExpired",
"CmsiInterrupt"
)
// filters out non user or application logins based on target
and o365.audit.Target.Type in ("0", "2", "3", "5", "6", "10")
// filters only for logins from user or application, ignoring oauth:token
and to_lower(o365.audit.ExtendedProperties.RequestType) rlike "(.*)login(.*)"
// count the number of login sources and failed login attempts
| stats
login_source_count = count(source.ip),
failed_login_count = count(*) by target_time_window, o365.audit.UserId
// filter for users with more than 20 login sources or failed login attempts
| where (login_source_count >= 20 or failed_login_count >= 20)
----------------------------------

*Framework*: MITRE ATT&CK^TM^

* Tactic:
** Name: Credential Access
** ID: TA0006
** Reference URL: https://attack.mitre.org/tactics/TA0006/
* Technique:
** Name: Brute Force
** ID: T1110
** Reference URL: https://attack.mitre.org/techniques/T1110/
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[[prebuilt-rule-8-13-17-aws-bedrock-detected-multiple-validation-exception-errors-by-a-single-user]]
=== AWS Bedrock Detected Multiple Validation Exception Errors by a Single User

Identifies multiple validation exeception errors within AWS Bedrock. Validation errors occur when you run the InvokeModel or InvokeModelWithResponseStream APIs on a foundation model that uses an incorrect inference parameter or corresponding value. These errors also occur when you use an inference parameter for one model with a model that doesn't have the same API parameter. This could indicate attempts to bypass limitations of other approved models, or to force an impact on the environment by incurring exhorbitant costs.

*Rule type*: esql

*Rule indices*: None

*Severity*: high

*Risk score*: 73

*Runs every*: 10m

*Searches indices from*: now-60m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)

*Maximum alerts per execution*: 100

*References*:

* https://atlas.mitre.org/techniques/AML.T0015
* https://atlas.mitre.org/techniques/AML.T0034
* https://atlas.mitre.org/techniques/AML.T0046
* https://www.elastic.co/security-labs/elastic-advances-llm-security

*Tags*:

* Domain: LLM
* Data Source: AWS
* Data Source: AWS Bedrock
* Data Source: AWS S3
* Use Case: Policy Violation
* Mitre Atlas: T0015
* Mitre Atlas: T0034
* Mitre Atlas: T0046

*Version*: 1

*Rule authors*:

* Elastic

*Rule license*: Elastic License v2


==== Setup



*Setup*


This rule requires that AWS Bedrock Integration be configured. For more information, see the AWS Bedrock integration documentation:

https://www.elastic.co/docs/current/integrations/aws_bedrock


==== Rule query


[source, js]
----------------------------------
from logs-aws_bedrock.invocation-*
// truncate the timestamp to a 1-minute window
| eval target_time_window = DATE_TRUNC(1 minutes, @timestamp)
| where gen_ai.response.error_code == "ValidationException"
// count the number of users causing validation errors within a 1 minute window
| stats total_denials = count(*) by target_time_window, user.id, cloud.account.id
| where total_denials > 3
----------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
[[prebuilt-rule-8-13-17-aws-ssm-sendcommand-with-run-shell-command-parameters]]
=== AWS SSM `SendCommand` with Run Shell Command Parameters

Identifies the use of the AWS Systems Manager (SSM) `SendCommand` API with the either `AWS-RunShellScript` or `AWS-RunPowerShellScript` parameters. The `SendCommand` API call allows users to execute commands on EC2 instances using the SSM service. Adversaries may use this technique to execute commands on EC2 instances without the need for SSH or RDP access. This behavior may indicate an adversary attempting to execute commands on an EC2 instance for malicious purposes. This is a [New Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule that only flags when this behavior is observed for the first time on a host in the last 7 days.

*Rule type*: new_terms

*Rule indices*:

* logs-endpoint.events.*
* endgame-*
* auditbeat-*
* logs-auditd_manager.auditd-*

*Severity*: medium

*Risk score*: 47

*Runs every*: 5m

*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)

*Maximum alerts per execution*: 100

*References*:

* https://cloud.hacktricks.xyz/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ssm-privesc
* https://securitycafe.ro/2023/01/17/aws-post-explitation-with-ssm-sendcommand/

*Tags*:

* Domain: Endpoint
* Domain: Cloud
* OS: Linux
* OS: macOS
* OS: Windows
* Use Case: Threat Detection
* Tactic: Execution
* Data Source: Elastic Defend
* Data Source: Elastic Endgame
* Data Source: Auditd Manager

*Version*: 1

*Rule authors*:

* Elastic

*Rule license*: Elastic License v2


==== Setup



*Setup*


This rule requires data coming in from Elastic Defend.


*Elastic Defend Integration Setup*

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.


*Prerequisite Requirements:*

- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the https://www.elastic.co/guide/en/fleet/current/fleet-server.html[documentation].


*The following steps should be executed in order to add the Elastic Defend integration on a Linux System:*

- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- 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. https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html[Helper guide].
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- 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.
For more details on Elastic Agent configuration settings, refer to the https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html[helper guide].
- Click "Save and Continue".
- 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.
For more details on Elastic Defend refer to the https://www.elastic.co/guide/en/security/current/install-endpoint.html[helper guide].


==== Rule query


[source, js]
----------------------------------
event.category: "process" and event.type: "start" and process.name: "aws"
and (
host.os.type: ("windows" or "macos")
or (
host.os.type: "linux"
and event.action: ("exec" or "exec_event" or "executed" or "process_started")
)
)
and process.args: (
"send-command" and "--parameters" and commands=*
and ("AWS-RunShellScript" or "AWS-RunPowerShellScript")
)
----------------------------------

*Framework*: MITRE ATT&CK^TM^

* Tactic:
** Name: Execution
** ID: TA0002
** Reference URL: https://attack.mitre.org/tactics/TA0002/
* Technique:
** Name: Cloud Administration Command
** ID: T1651
** Reference URL: https://attack.mitre.org/techniques/T1651/
Loading

0 comments on commit 21b4428

Please sign in to comment.