Skip to content

Commit 6b0e8f5

Browse files
Update latest docs (#6402)
1 parent 8ad3210 commit 6b0e8f5

File tree

51 files changed

+4374
-41
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+4374
-41
lines changed
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
[[prebuilt-rule-8-15-13-azure-entra-mfa-totp-brute-force-attempts]]
2+
=== Azure Entra MFA TOTP Brute Force Attempts
3+
4+
Identifies brute force attempts against Azure Entra multi-factor authentication (MFA) Time-based One-Time Password (TOTP) verification codes. This rule detects high frequency failed TOTP code attempts for a single user in a short time-span. Adversaries with valid credentials, when attempting to login to Azure portal or other Azure services, may be prompted to provide a TOTP code as part of the MFA process. If successful, adversaries can bypass MFA and gain unauthorized access to Azure resources.
5+
6+
*Rule type*: esql
7+
8+
*Rule indices*: None
9+
10+
*Severity*: medium
11+
12+
*Risk score*: 47
13+
14+
*Runs every*: 5m
15+
16+
*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)
17+
18+
*Maximum alerts per execution*: 100
19+
20+
*References*:
21+
22+
* https://www.oasis.security/resources/blog/oasis-security-research-team-discovers-microsoft-azure-mfa-bypass
23+
* https://learn.microsoft.com/en-us/entra/identity/
24+
* https://learn.microsoft.com/en-us/entra/identity/monitoring-health/concept-sign-ins
25+
26+
*Tags*:
27+
28+
* Domain: Cloud
29+
* Domain: SaaS
30+
* Data Source: Azure
31+
* Data Source: Entra ID
32+
* Data Source: Entra ID Sign-in
33+
* Use Case: Identity and Access Audit
34+
* Use Case: Threat Detection
35+
* Tactic: Credential Access
36+
37+
*Version*: 1
38+
39+
*Rule authors*:
40+
41+
* Elastic
42+
43+
*Rule license*: Elastic License v2
44+
45+
46+
==== Investigation guide
47+
48+
49+
50+
*Triage and Analysis*
51+
52+
53+
54+
*Investigating Azure Entra MFA TOTP Brute Force Attempts*
55+
56+
57+
This rule detects high-frequency failed TOTP code attempts for a single user in a short time span. Such behavior could indicate an adversary attempting to bypass multi-factor authentication (MFA) protections using valid credentials. Understanding the context of the user's typical behavior and identifying anomalies in the log data are critical to determining the nature of the activity.
58+
59+
60+
*Possible Investigation Steps:*
61+
62+
63+
**Review the Source IP Address**:
64+
- Check the `source.ip` or `azure.signinlogs.caller_ip_address` field.
65+
- Determine if the IP address is associated with the user’s typical login locations.
66+
- Look for unusual geographic patterns or anomalous IP addresses (e.g., proxies, VPNs, or locations outside the user’s normal activity).
67+
68+
**Analyze User Activity**:
69+
- Identify the user from the `azure.signinlogs.properties.sign_in_identifier` field.
70+
- Determine if the user is currently active from another device or session. Session hijacking could explain parallel activity with failed attempts.
71+
- Review past logs for the user to determine whether MFA failures or other anomalies are consistent or new.
72+
73+
**Inspect the Authentication Method**:
74+
- Evaluate the `azure.signinlogs.properties.mfa_detail.auth_method` field: `OATH verification code`.
75+
- Confirm if the user typically uses TOTP codes or another MFA method (e.g., push notifications).
76+
- Verify if there are any recent changes to the user’s MFA settings that may explain multiple failed attempts.
77+
78+
**Evaluate the User Agent**:
79+
- Check the `user_agent.original` field.
80+
- Identify if the user agent matches a typical browser or a potentially malicious script (e.g., Python-based).
81+
- Look for deviations in operating system or browser versions from the user’s normal activity.
82+
83+
**Analyze Conditional Access Policies**:
84+
- Review the `azure.signinlogs.properties.applied_conditional_access_policies` for enforced grant controls.
85+
- Verify if MFA failures are tied to legitimate security policies (`display_name: Require multifactor authentication for admins`).
86+
87+
**Correlate with Other Events**:
88+
- Search for other authentication attempts involving the same `azure.signinlogs.caller_ip_address`, `user_principal_name`, or `azure.signinlogs.properties.app_id`.
89+
- Look for suspicious activity patterns, such as password resets, privilege escalation, or account lockouts.
90+
91+
92+
93+
*False Positive Analysis:*
94+
95+
96+
- **Unintentional User Behavior**:
97+
- Verify if the failed attempts could result from the user’s unfamiliarity with TOTP codes or issues with device synchronization.
98+
- Check if the user recently switched MFA methods or devices, which could explain multiple failures.
99+
- Determine if this is whitebox testing or a developer testing MFA integration.
100+
101+
- **Administrative Actions**:
102+
- Determine if the activity is related to legitimate administrative testing or configuration changes in the MFA system.
103+
104+
105+
*Response and Remediation:*
106+
107+
108+
- **Immediate Actions**:
109+
- If proven malicious, lock the affected account temporarily to prevent further unauthorized attempts.
110+
- Notify the user of suspicious activity and validate their access to the account.
111+
- Reset passwords and MFA settings for the affected user to prevent unauthorized access while communicating with the user.
112+
113+
- **Strengthen Authentication Policies**:
114+
- Ensure conditional access policies are configured to monitor and restrict anomalous login behavior.
115+
- Consider a different MFA method or additional security controls to prevent future bypass attempts.
116+
117+
- **Monitor and Audit**:
118+
- Implement additional monitoring to track high-frequency authentication failures across the environment.
119+
- Audit historical logs for similar patterns involving other accounts to identify broader threats.
120+
121+
- **Educate and Train Users**:
122+
- Provide guidance on the secure use of MFA and the importance of recognizing and reporting suspicious activity.
123+
124+
125+
==== Setup
126+
127+
128+
129+
*Required Azure Entra Sign-In Logs*
130+
131+
This rule requires the Azure logs integration be enabled and configured to collect all logs, including sign-in logs from Entra. In Entra, sign-in logs must be enabled and streaming to the Event Hub used for the Azure logs integration.
132+
133+
134+
==== Rule query
135+
136+
137+
[source, js]
138+
----------------------------------
139+
from logs-azure.signinlogs* metadata _id, _version, _index
140+
| where
141+
// filter for Entra Sign-In Logs
142+
event.dataset == "azure.signinlogs"
143+
and azure.signinlogs.operation_name == "Sign-in activity"
144+
145+
// filter for MFA attempts with OATH conditional access attempts or TOTP
146+
and azure.signinlogs.properties.authentication_requirement == "multiFactorAuthentication"
147+
and azure.signinlogs.properties.mfa_detail.auth_method == "OATH verification code"
148+
149+
// filter on failures only from brute-force attempts
150+
and azure.signinlogs.properties.conditional_access_status == "failure"
151+
and azure.signinlogs.result_description == "Authentication failed during strong authentication request."
152+
| keep azure.signinlogs.properties.sign_in_identifier
153+
| stats
154+
// aggregate by the sign-in account or principal
155+
failed_totp_code_attempts = count(*) by azure.signinlogs.properties.sign_in_identifier
156+
| where
157+
// filter on high frequency for a single user
158+
failed_totp_code_attempts > 30
159+
160+
----------------------------------
161+
162+
*Framework*: MITRE ATT&CK^TM^
163+
164+
* Tactic:
165+
** Name: Credential Access
166+
** ID: TA0006
167+
** Reference URL: https://attack.mitre.org/tactics/TA0006/
168+
* Technique:
169+
** Name: Brute Force
170+
** ID: T1110
171+
** Reference URL: https://attack.mitre.org/techniques/T1110/
172+
* Sub-technique:
173+
** Name: Password Guessing
174+
** ID: T1110.001
175+
** Reference URL: https://attack.mitre.org/techniques/T1110/001/
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
[[prebuilt-rule-8-15-13-creation-or-modification-of-pluggable-authentication-module-or-configuration]]
2+
=== Creation or Modification of Pluggable Authentication Module or Configuration
3+
4+
This rule monitors for the creation or modification of Pluggable Authentication Module (PAM) shared object files or configuration files. Attackers may create or modify these files to maintain persistence on a compromised system, or harvest account credentials.
5+
6+
*Rule type*: eql
7+
8+
*Rule indices*:
9+
10+
* logs-endpoint.events.file*
11+
12+
*Severity*: medium
13+
14+
*Risk score*: 47
15+
16+
*Runs every*: 5m
17+
18+
*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)
19+
20+
*Maximum alerts per execution*: 100
21+
22+
*References*:
23+
24+
* https://github.com/zephrax/linux-pam-backdoor
25+
* https://github.com/eurialo/pambd
26+
* http://0x90909090.blogspot.com/2016/06/creating-backdoor-in-pam-in-5-line-of.html
27+
* https://www.trendmicro.com/en_us/research/19/i/skidmap-linux-malware-uses-rootkit-capabilities-to-hide-cryptocurrency-mining-payload.html
28+
29+
*Tags*:
30+
31+
* Domain: Endpoint
32+
* OS: Linux
33+
* Use Case: Threat Detection
34+
* Tactic: Credential Access
35+
* Tactic: Persistence
36+
* Data Source: Elastic Defend
37+
38+
*Version*: 3
39+
40+
*Rule authors*:
41+
42+
* Elastic
43+
44+
*Rule license*: Elastic License v2
45+
46+
47+
==== Rule query
48+
49+
50+
[source, js]
51+
----------------------------------
52+
file where host.os.type == "linux" and event.action in ("rename", "creation") and
53+
process.executable != null and (
54+
(file.path like~ (
55+
"/lib/security/*", "/lib64/security/*", "/usr/lib/security/*", "/usr/lib64/security/*",
56+
"/lib/x86_64-linux-gnu/security/*", "/usr/lib/x86_64-linux-gnu/security/*"
57+
) and file.extension == "so") or
58+
(file.path like~ "/etc/pam.d/*" and file.extension == null) or
59+
(file.path like~ "/etc/security/pam_*" or file.path == "/etc/pam.conf")
60+
) and not (
61+
process.executable in (
62+
"/bin/dpkg", "/usr/bin/dpkg", "/bin/dockerd", "/usr/bin/dockerd", "/usr/sbin/dockerd", "/bin/microdnf",
63+
"/usr/bin/microdnf", "/bin/rpm", "/usr/bin/rpm", "/bin/snapd", "/usr/bin/snapd", "/bin/yum", "/usr/bin/yum",
64+
"/bin/dnf", "/usr/bin/dnf", "/bin/podman", "/usr/bin/podman", "/bin/dnf-automatic", "/usr/bin/dnf-automatic",
65+
"/bin/pacman", "/usr/bin/pacman", "/usr/bin/dpkg-divert", "/bin/dpkg-divert", "/sbin/apk", "/usr/sbin/apk",
66+
"/usr/local/sbin/apk", "/usr/bin/apt", "/usr/sbin/pacman", "/bin/podman", "/usr/bin/podman", "/usr/bin/puppet",
67+
"/bin/puppet", "/opt/puppetlabs/puppet/bin/puppet", "/usr/bin/chef-client", "/bin/chef-client",
68+
"/bin/autossl_check", "/usr/bin/autossl_check", "/proc/self/exe", "/dev/fd/*", "/usr/bin/pamac-daemon",
69+
"/bin/pamac-daemon", "/usr/lib/snapd/snapd", "/usr/local/bin/dockerd", "/usr/sbin/pam-auth-update",
70+
"/usr/lib/systemd/systemd", "/usr/libexec/packagekitd", "/usr/bin/bsdtar", "/sbin/pam-auth-update"
71+
) or
72+
file.path like (
73+
"/tmp/snap.rootfs_*/pam_*.so", "/tmp/newroot/lib/*/pam_*.so", "/tmp/newroot/usr/lib64/security/pam_*.so"
74+
) or
75+
file.extension in ("swp", "swpx", "swx", "dpkg-remove") or
76+
file.Ext.original.extension == "dpkg-new" or
77+
process.executable like (
78+
"/nix/store/*", "/var/lib/dpkg/*", "/snap/*", "/dev/fd/*", "/usr/lib/virtualbox/*"
79+
) or
80+
(process.name == "sed" and file.name like~ "sed*") or
81+
(process.name == "perl" and file.name like~ "e2scrub_all.tmp*")
82+
)
83+
84+
----------------------------------
85+
86+
*Framework*: MITRE ATT&CK^TM^
87+
88+
* Tactic:
89+
** Name: Persistence
90+
** ID: TA0003
91+
** Reference URL: https://attack.mitre.org/tactics/TA0003/
92+
* Technique:
93+
** Name: Create or Modify System Process
94+
** ID: T1543
95+
** Reference URL: https://attack.mitre.org/techniques/T1543/
96+
* Tactic:
97+
** Name: Credential Access
98+
** ID: TA0006
99+
** Reference URL: https://attack.mitre.org/tactics/TA0006/
100+
* Technique:
101+
** Name: Modify Authentication Process
102+
** ID: T1556
103+
** Reference URL: https://attack.mitre.org/techniques/T1556/

0 commit comments

Comments
 (0)