Skip to content

Commit 720cba0

Browse files
authored
Merge branch 'main' into runner-via-runner-tracking-id
2 parents dac78b7 + 4a042d1 commit 720cba0

File tree

37 files changed

+1258
-177
lines changed

37 files changed

+1258
-177
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
[metadata]
2+
creation_date = "2025/11/28"
3+
integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike", "auditd_manager"]
4+
maturity = "production"
5+
updated_date = "2025/11/28"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
This rule detects the execution of Gitleaks, a tool used to search for high-entropy strings and secrets in code
11+
repositories, which may indicate an attempt to access credentials.
12+
"""
13+
false_positives = [
14+
"""
15+
Gitleaks is a legitimate open-source tool used by security professionals and developers to search for sensitive
16+
information, such as passwords, API keys, and other secrets, within code repositories. It is commonly employed
17+
during security assessments and code reviews to identify potential vulnerabilities.
18+
""",
19+
]
20+
from = "now-9m"
21+
index = [
22+
"endgame-*",
23+
"logs-crowdstrike.fdr*",
24+
"logs-endpoint.events.process-*",
25+
"logs-m365_defender.event-*",
26+
"logs-sentinel_one_cloud_funnel.*",
27+
"logs-system.security*",
28+
"logs-windows.forwarded*",
29+
"logs-windows.sysmon_operational-*",
30+
"winlogbeat-*",
31+
"auditbeat-*",
32+
"logs-auditd_manager.auditd-*"
33+
]
34+
language = "eql"
35+
license = "Elastic License v2"
36+
name = "Potential Secret Scanning via Gitleaks"
37+
note = """## Triage and analysis
38+
39+
> **Disclaimer**:
40+
> 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.
41+
42+
### Investigating Potential Secret Scanning via Gitleaks
43+
44+
This alert fires when a host launches Gitleaks, a secret-scanning utility that hunts high-entropy strings and credentials in source code and repositories, signaling potential credential harvesting. An attacker may clone internal repos or traverse local workspace directories, drop a portable gitleaks binary in /tmp or %TEMP%, run recursive scans with wide rule sets and JSON output, then archive the results to exfiltrate tokens, API keys, and passwords for lateral movement and service impersonation.
45+
46+
### Possible investigation steps
47+
48+
- Review the full command line to identify --path/--repo/--report/--format flags, which reveal scope and whether results are being written for exfiltration.
49+
- Examine parent and ancestry plus user session to determine if it was launched by CI/dev tooling versus an interactive shell, and note execution from temp or unusual directories suggesting a dropped portable binary.
50+
- Locate and inspect newly created artifacts (gitleaks.json, .sarif, .csv, zip archives) near the event time, confirm the presence of secrets, and map their sensitivity to affected systems.
51+
- Correlate with network and data movement around the event for clones to internal repos and outbound transfers to cloud storage, paste sites, or email, and capture repository URLs or destinations if present.
52+
- Trace how the binary arrived by checking recent downloads and file writes (curl/wget, package managers, GitHub releases), verify the binary’s hash and signer, and compare against known-good sources.
53+
54+
### False positive analysis
55+
56+
- A developer or security team member intentionally runs gitleaks to audit internal code for secrets during routine hygiene, producing local report artifacts and showing normal parent processes without exfiltration behavior.
57+
- A user invokes gitleaks with --version or --help to validate installation or review usage, which generates a process start event but performs no scanning or credential access.
58+
59+
### Response and remediation
60+
61+
- If the run was unauthorized or executed from /tmp, %TEMP%, or a user profile, terminate gitleaks.exe/gitleaks, isolate the host from the network, and capture the binary path and hash for forensics.
62+
- Quarantine report artifacts produced by the run (gitleaks.json, .sarif, .csv, and any zip archives) by securing copies for evidence, removing world-readable permissions, and deleting residual copies from the working directory, Downloads, repo folders, and CI workspaces after collection.
63+
- Eradicate tooling by removing the dropped gitleaks binary and any wrapper scripts or CI job steps that invoke it, and enforce execution blocking for gitleaks in user-writable paths via application control or EDR policy.
64+
- Immediately revoke and rotate any secrets confirmed in the reports or repository (cloud API keys, service tokens, SSH keys, credentials), purge them from repo history (git filter-repo/BFG) if present, redeploy updated secrets from the vault, and force password resets for affected accounts.
65+
- Review git activity and data movement around the event for repo clones and exports, and inspect outbound transfers of report files to cloud storage, paste sites, or email; escalate to Incident Response and Legal if any report left the device or if production/customer credentials are exposed.
66+
- Harden going forward by enabling approved server-side and CI secret scanning, enforcing pre-commit hooks, prohibiting PATs with broad scopes, restricting egress to paste/file-sharing sites, and blocking execution of portable binaries from temp and user-writable locations."""
67+
references = [
68+
"https://www.elastic.co/blog/shai-hulud-worm-npm-supply-chain-compromise",
69+
"https://socket.dev/blog/shai-hulud-strikes-again-v2",
70+
]
71+
risk_score = 47
72+
rule_id = "f92171ed-a4d3-4baa-98f9-4df1652cb11b"
73+
severity = "medium"
74+
tags = [
75+
"Domain: Endpoint",
76+
"OS: Linux",
77+
"OS: Windows",
78+
"OS: macOS",
79+
"Use Case: Threat Detection",
80+
"Tactic: Credential Access",
81+
"Data Source: Elastic Endgame",
82+
"Data Source: Elastic Defend",
83+
"Data Source: Windows Security Event Logs",
84+
"Data Source: Microsoft Defender for Endpoint",
85+
"Data Source: Sysmon",
86+
"Data Source: SentinelOne",
87+
"Data Source: Crowdstrike",
88+
"Data Source: Auditd Manager",
89+
"Resources: Investigation Guide",
90+
]
91+
timestamp_override = "event.ingested"
92+
type = "eql"
93+
query = '''
94+
process where event.type == "start" and event.action like ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started", "Process Create*") and
95+
process.name : ("gitleaks.exe", "gitleaks")
96+
'''
97+
98+
[[rule.threat]]
99+
framework = "MITRE ATT&CK"
100+
101+
[[rule.threat.technique]]
102+
id = "T1003"
103+
name = "OS Credential Dumping"
104+
reference = "https://attack.mitre.org/techniques/T1003/"
105+
106+
[[rule.threat.technique]]
107+
id = "T1555"
108+
name = "Credentials from Password Stores"
109+
reference = "https://attack.mitre.org/techniques/T1555/"
110+
111+
[rule.threat.tactic]
112+
id = "TA0006"
113+
name = "Credential Access"
114+
reference = "https://attack.mitre.org/tactics/TA0006/"
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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/"

rules/cross-platform/multiple_alerts_elastic_defend_netsecurity_by_host.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2025/11/18"
33
integration = ["endpoint", "panw", "fortinet_fortigate", "suricata"]
44
maturity = "production"
5-
updated_date = "2025/11/18"
5+
updated_date = "2025/11/28"
66

77
[rule]
88
author = ["Elastic"]
@@ -65,6 +65,9 @@ FROM logs-* metadata _id
6565
Esql.destination_ip_values = VALUES(destination.ip)
6666
by Esql.source_ip
6767
| where Esql.event_module_distinct_count >= 2
68+
| eval concat_module_values = MV_CONCAT(Esql.event_module_values, ",")
69+
// Make sure an endpoint alert is present along one of the network ones
70+
| where concat_module_values like "*endpoint*"
6871
| keep Esql.alerts_count, Esql.source_ip, Esql.destination_ip_values, Esql.host_id_values, Esql.user_name_values, Esql.event_module_values, Esql.message_values, Esql.process_executable_values
6972
'''
7073
note = """## Triage and analysis

0 commit comments

Comments
 (0)