b28338c680
* adjusted Potential Widespread Malware Infection Across Multiple Hosts * adjusted Microsoft Azure or Mail Sign-in from a Suspicious Source * adjusted AWS EC2 Multi-Region DescribeInstances API Calls * adjusted AWS Discovery API Calls via CLI from a Single Resource * adjusted AWS Service Quotas Multi-Region Requests * adjusted AWS EC2 EBS Snapshot Shared or Made Public * adjusted AWS S3 Bucket Enumeration or Brute Force * adjusted AWS EC2 EBS Snapshot Access Removed * adjusted Potential AWS S3 Bucket Ransomware Note Uploaded * adjusted AWS S3 Object Encryption Using External KMS Key * adjusted AWS S3 Static Site JavaScript File Uploaded * adjusted AWS Access Token Used from Multiple Addresses * adjusted AWS Signin Single Factor Console Login with Federated User * adjusted AWS IAM AdministratorAccess Policy Attached to Group * adjusted AWS IAM AdministratorAccess Policy Attached to Role * adjusted AWS IAM AdministratorAccess Policy Attached to User * adjusted AWS Bedrock Invocations without Guardrails Detected by a Single User Over a Session * adjusted AWS Bedrock Guardrails Detected Multiple Violations by a Single User Over a Session * adjusted AWS Bedrock Guardrails Detected Multiple Policy Violations Within a Single Blocked Request * adjusted Unusual High Confidence Content Filter Blocks Detected * adjusted Potential Abuse of Resources by High Token Count and Large Response Sizes * AWS Bedrock Detected Multiple Attempts to use Denied Models by a Single User * Unusual High Denied Sensitive Information Policy Blocks Detected * adjusted Unusual High Denied Topic Blocks Detected * adjusted AWS Bedrock Detected Multiple Validation Exception Errors by a Single User * adjusted Unusual High Word Policy Blocks Detected * adjusted Microsoft Entra ID Concurrent Sign-Ins with Suspicious Properties * adjusted Azure Entra MFA TOTP Brute Force Attempts * adjusted Microsoft Entra ID Sign-In Brute Force Activity * adjusted Microsoft Entra ID Exccessive Account Lockouts Detected * adjusted Microsoft 365 Brute Force via Entra ID Sign-Ins * deprecated Azure Entra Sign-in Brute Force Microsoft 365 Accounts by Repeat Source * adjusted Microsoft Entra ID Session Reuse with Suspicious Graph Access * adjusted Suspicious Microsoft OAuth Flow via Auth Broker to DRS * adjusted Potential Denial of Azure OpenAI ML Service * adjusted Azure OpenAI Insecure Output Handling * adjusted Potential Azure OpenAI Model Theft * adjusted M365 OneDrive Excessive File Downloads with OAuth Token * adjusted Multiple Microsoft 365 User Account Lockouts in Short Time Window * adjusted Potential Microsoft 365 User Account Brute Force * adjusted Suspicious Microsoft 365 UserLoggedIn via OAuth Code * adjusted Multiple Device Token Hashes for Single Okta Session * adjusted Multiple Okta User Authentication Events with Client Address * adjusted Multiple Okta User Authentication Events with Same Device Token Hash * adjusted High Number of Okta Device Token Cookies Generated for Authentication * adjusted Okta User Sessions Started from Different Geolocations * adjusted High Number of Egress Network Connections from Unusual Executable * adjusted Unusual Base64 Encoding/Decoding Activity * adjusted Potential Port Scanning Activity from Compromised Host * adjusted Potential Subnet Scanning Activity from Compromised Host * adjusted Unusual File Transfer Utility Launched * adjusted Potential Malware-Driven SSH Brute Force Attempt * adjusted Unusual Process Spawned from Web Server Parent * adjusted Unusual Command Execution from Web Server Parent * adjusted Rare Connection to WebDAV Target * adjusted Potential PowerShell Obfuscation via Invalid Escape Sequences * adjusted Potential PowerShell Obfuscation via Backtick-Escaped Variable Expansion * adjusted Unusual File Creation by Web Server * adjusted Potential PowerShell Obfuscation via High Special Character Proportion * adjusted Potential Malicious PowerShell Based on Alert Correlation * adjusted Potential PowerShell Obfuscation via Character Array Reconstruction * adjusted Potential PowerShell Obfuscation via String Reordering * adjusted Potential PowerShell Obfuscation via String Concatenation * adjusted Potential PowerShell Obfuscation via Reverse Keywords * adjusted PowerShell Obfuscation via Negative Index String Reversal * adjusted Dynamic IEX Reconstruction via Method String Access * adjusted Potential Dynamic IEX Reconstruction via Environment Variables * adjusted Potential PowerShell Obfuscation via High Numeric Character Proportion * adjusted Potential PowerShell Obfuscation via Concatenated Dynamic Command Invocation * adjusted Rare Connection to WebDAV Target * adjusted Potential PowerShell Obfuscation via Invalid Escape Sequences * adjusted Potential PowerShell Obfuscation via Backtick-Escaped Variable Expansion * adjusted Potential PowerShell Obfuscation via Character Array Reconstruction * adjusted Potential PowerShell Obfuscation via High Special Character Proportion * adjusted Potential PowerShell Obfuscation via Special Character Overuse * adjusted Potential PowerShell Obfuscation via String Reordering * adjusted Suspicious Microsoft 365 UserLoggedIn via OAuth Code * adjusted fields that were inconsistent * adjusted additional fields * adjusted esql to Esql * adjusted several rules for common field names * updating rules * updated dates * updated dates * updated ESQL fields * lowercase all functions and logical operators * adjusted dates for unit tests * Update Esql_priv to Esql_temp as these don't hold PII * PowerShell adjustments * Make query comments consistent * update comment * reverted 2856446a-34e6-435b-9fb5-f8f040bfa7ed * Update rules/windows/discovery_command_system_account.toml * removed dot notation --------- Co-authored-by: Jonhnathan <26856693+w0rk3r@users.noreply.github.com>
204 lines
10 KiB
TOML
204 lines
10 KiB
TOML
[metadata]
|
|
creation_date = "2025/02/21"
|
|
integration = ["endpoint"]
|
|
maturity = "production"
|
|
updated_date = "2025/07/16"
|
|
|
|
[rule]
|
|
author = ["Elastic"]
|
|
description = """
|
|
This rule leverages ESQL to detect unusual base64 encoding/decoding activity on Linux systems. Attackers may use base64
|
|
encoding/decoding to obfuscate data, such as command and control traffic or payloads, to evade detection by host- or
|
|
network-based security controls. ESQL rules have limited fields available in its alert documents. Make sure to review
|
|
the original documents to aid in the investigation of this alert.
|
|
"""
|
|
from = "now-61m"
|
|
interval = "1h"
|
|
language = "esql"
|
|
license = "Elastic License v2"
|
|
name = "Unusual Base64 Encoding/Decoding Activity"
|
|
note = """## Triage and analysis
|
|
|
|
> **Disclaimer**:
|
|
> 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.
|
|
|
|
### Investigating Unusual Base64 Encoding/Decoding Activity
|
|
Base64 encoding is a method to convert binary data into ASCII text, often used for data transmission. Adversaries exploit this to obfuscate malicious payloads or commands, bypassing security controls. The detection rule identifies suspicious Base64 activity on Linux by monitoring specific processes and command patterns, flagging anomalies for further investigation.
|
|
|
|
### Possible investigation steps
|
|
|
|
- Review the process name and command line arguments to understand the context of the Base64 activity. Check if the process name matches known legitimate applications or scripts.
|
|
- Examine the timestamp of the event to determine if the activity occurred during normal operational hours or if it coincides with other suspicious activities.
|
|
- Investigate the host operating system type and agent ID to identify the specific Linux system involved and assess if it has a history of similar alerts or other security incidents.
|
|
- Analyze the process command line for any unusual patterns or parameters that might indicate obfuscation or malicious intent, such as the presence of decode flags or unexpected Base64 operations.
|
|
- Correlate the event with other logs or alerts from the same host or network to identify potential lateral movement or coordinated attacks.
|
|
- Check for any recent changes or deployments on the affected system that might explain the Base64 activity, such as new software installations or updates.
|
|
- Consult threat intelligence sources to determine if the observed Base64 patterns or command line arguments are associated with known malware or attack techniques.
|
|
|
|
### False positive analysis
|
|
|
|
- Routine administrative scripts may use base64 encoding for legitimate data processing tasks. Review the process.command_line and process.args fields to identify known scripts and consider excluding them from the rule.
|
|
- Backup or data transfer operations might employ base64 encoding to handle binary data. Verify the process.name and process.command_line to ensure these operations are recognized and add exceptions for these specific processes.
|
|
- Development environments often use base64 encoding for testing purposes. Identify development-related processes by examining the process.name and process.command_line and exclude them if they are part of regular development activities.
|
|
- Automated system monitoring tools might trigger this rule if they use base64 encoding for log or data analysis. Check the agent.id and process.command_line to confirm these tools and exclude them from the rule if they are verified as non-threatening.
|
|
- Security tools that perform data encoding for analysis or reporting could be flagged. Validate these tools by reviewing the process.name and process.command_line and create exceptions for them if they are part of the security infrastructure.
|
|
|
|
### Response and remediation
|
|
|
|
- Isolate the affected Linux system from the network to prevent further data exfiltration or lateral movement by the adversary.
|
|
- Terminate any suspicious processes identified by the alert, particularly those involving base64 encoding/decoding, to halt potential malicious activity.
|
|
- Conduct a thorough review of the process command lines and arguments flagged by the alert to identify any malicious scripts or payloads. Remove or quarantine these files as necessary.
|
|
- Check for any unauthorized user accounts or privilege escalations that may have been established during the attack and revoke access immediately.
|
|
- Restore any affected systems or files from a known good backup to ensure the integrity of the system and data.
|
|
- Implement additional monitoring on the affected system and similar environments to detect any recurrence of the suspicious base64 activity.
|
|
- Escalate the incident to the security operations center (SOC) or incident response team for further analysis and to determine if broader organizational impacts exist.
|
|
"""
|
|
risk_score = 21
|
|
rule_id = "c5637438-e32d-4bb3-bc13-bd7932b3289f"
|
|
setup = """## Setup
|
|
|
|
This rule requires data coming in from one of the following integrations:
|
|
- 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 [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
|
|
|
|
#### 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. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
|
|
- 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 [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
|
|
- 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 [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
|
|
"""
|
|
severity = "low"
|
|
tags = [
|
|
"Domain: Endpoint",
|
|
"OS: Linux",
|
|
"Use Case: Threat Detection",
|
|
"Tactic: Defense Evasion",
|
|
"Data Source: Elastic Defend",
|
|
"Resources: Investigation Guide",
|
|
]
|
|
timestamp_override = "event.ingested"
|
|
type = "esql"
|
|
|
|
query = '''
|
|
from logs-endpoint.events.process-*
|
|
| where
|
|
@timestamp > now() - 1h and
|
|
host.os.type == "linux" and
|
|
event.type == "start" and
|
|
event.action == "exec" and (
|
|
(
|
|
process.name in ("base64", "base64plain", "base64url", "base64mime", "base64pem", "base32", "base16") and
|
|
process.command_line like "*-*d*"
|
|
) or
|
|
(
|
|
process.name == "openssl" and
|
|
process.args == "enc" and
|
|
process.args in ("-d", "-base64", "-a")
|
|
) or
|
|
(
|
|
process.name like "python*" and (
|
|
(
|
|
process.args == "base64" and
|
|
process.args in ("-d", "-u", "-t")
|
|
) or
|
|
(
|
|
process.args == "-c" and
|
|
process.command_line like "*base64*" and
|
|
process.command_line like "*b64decode*"
|
|
)
|
|
)
|
|
) or
|
|
(
|
|
process.name like "perl*" and
|
|
process.command_line like "*decode_base64*"
|
|
) or
|
|
(
|
|
process.name like "ruby*" and
|
|
process.args == "-e" and
|
|
process.command_line like "*Base64.decode64*"
|
|
)
|
|
)
|
|
| keep
|
|
@timestamp,
|
|
host.os.type,
|
|
event.type,
|
|
event.action,
|
|
process.name,
|
|
process.args,
|
|
process.command_line,
|
|
agent.id,
|
|
host.name
|
|
| stats
|
|
Esql.event_count = count(),
|
|
Esql.agent_id_count_distinct = count_distinct(agent.id),
|
|
Esql.host_name_values = values(host.name),
|
|
Esql.agent_id_values = values(agent.id)
|
|
by process.name, process.command_line
|
|
| where
|
|
Esql.agent_id_count_distinct == 1 and
|
|
Esql.event_count < 15
|
|
| sort Esql.event_count asc
|
|
| limit 100
|
|
'''
|
|
|
|
|
|
[[rule.threat]]
|
|
framework = "MITRE ATT&CK"
|
|
[[rule.threat.technique]]
|
|
id = "T1027"
|
|
name = "Obfuscated Files or Information"
|
|
reference = "https://attack.mitre.org/techniques/T1027/"
|
|
|
|
[[rule.threat.technique]]
|
|
id = "T1140"
|
|
name = "Deobfuscate/Decode Files or Information"
|
|
reference = "https://attack.mitre.org/techniques/T1140/"
|
|
|
|
|
|
[rule.threat.tactic]
|
|
id = "TA0005"
|
|
name = "Defense Evasion"
|
|
reference = "https://attack.mitre.org/tactics/TA0005/"
|
|
[[rule.threat]]
|
|
framework = "MITRE ATT&CK"
|
|
[[rule.threat.technique]]
|
|
id = "T1059"
|
|
name = "Command and Scripting Interpreter"
|
|
reference = "https://attack.mitre.org/techniques/T1059/"
|
|
[[rule.threat.technique.subtechnique]]
|
|
id = "T1059.004"
|
|
name = "Unix Shell"
|
|
reference = "https://attack.mitre.org/techniques/T1059/004/"
|
|
|
|
|
|
[[rule.threat.technique]]
|
|
id = "T1204"
|
|
name = "User Execution"
|
|
reference = "https://attack.mitre.org/techniques/T1204/"
|
|
[[rule.threat.technique.subtechnique]]
|
|
id = "T1204.002"
|
|
name = "Malicious File"
|
|
reference = "https://attack.mitre.org/techniques/T1204/002/"
|
|
|
|
|
|
|
|
[rule.threat.tactic]
|
|
id = "TA0002"
|
|
name = "Execution"
|
|
reference = "https://attack.mitre.org/tactics/TA0002/"
|
|
|