Skip to content

Commit ae87655

Browse files
authored
Merge branch 'main' into deprecate-deprecated-rules
2 parents bcec34f + 3bd9ab8 commit ae87655

File tree

7 files changed

+286
-2
lines changed

7 files changed

+286
-2
lines changed

detection_rules/etc/non-ecs-schema.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@
198198
},
199199
"logs-o365.audit-*": {
200200
"o365.audit.ExtendedProperties.ResultStatusDetail": "keyword",
201-
"o365.audit.OperationProperties.Value": "keyword"
201+
"o365.audit.OperationProperties.Name": "keyword",
202+
"o365.audit.OperationProperties.Value": "keyword",
203+
"o365.audit.OperationCount": "long"
202204
},
203205
"logs-okta*": {
204206
"okta.debug_context.debug_data.flattened.requestedScopes": "keyword",
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Potential Spoofed `microsoftonline.com` via Fuzzy Match
2+
3+
---
4+
5+
## Metadata
6+
7+
- **Author:** Elastic
8+
- **Description:** This hunting query identifies potential spoofed domain activity targeting Microsoft online services by detecting fuzzy matches to the domain `microsoftonline.com`. The approach uses approximate string matching (fuzziness) on domain and URL fields, then scores each result by similarity. A static confidence threshold is applied to filter out high-confidence legitimate matches while surfacing potential typosquats and lookalikes.
9+
10+
This technique is useful for identifying phishing campaigns, misconfigured infrastructure, or domain squatting activity targeting Microsoft users and applications. It relies on string similarity scoring and known-good domain exclusions to reduce false positives and focus the hunt on medium- to high-risk spoofed domains.
11+
12+
- **UUID:** `e912f5c6-eed3-11ef-a5d7-6f9f7a1e2e00`
13+
- **Integration:** [endpoint](https://docs.elastic.co/integrations/endpoint), [network_traffic](https://docs.elastic.co/integrations/network_traffic), [system](https://docs.elastic.co/integrations/system), [azure](https://docs.elastic.co/integrations/azure), [o365](https://docs.elastic.co/integrations/o365), [windows](https://docs.elastic.co/integrations/windows)
14+
- **Language:** `[ES|QL]`
15+
- **Source File:** [Potential Spoofed `microsoftonline.com` via Fuzzy Match](../queries/potentially_spoofed_microsoft_authentication_domain.toml)
16+
17+
## Query
18+
19+
```sql
20+
FROM logs-* METADATA _score
21+
| WHERE (
22+
url.domain IS NOT NULL OR
23+
url.original IS NOT NULL OR
24+
destination.domain IS NOT NULL OR
25+
dns.question.name IS NOT NULL
26+
)
27+
| EVAL domain = COALESCE(url.domain, url.original, destination.domain, dns.question.name)::STRING
28+
| WHERE NOT(
29+
domain RLIKE "^(login|portal|api)\\.microsoftonline\\.com$" OR
30+
domain RLIKE ".*\\.onmicrosoft\\.com$" OR
31+
domain == "microsoftonline.com")
32+
| WHERE (
33+
match(url.domain, "microsoftonline.com", { "fuzziness": "AUTO", "max_expansions": 10 }) OR
34+
match(url.original, "microsoftonline.com", { "fuzziness": "AUTO", "max_expansions": 10 }) OR
35+
match(destination.domain, "microsoftonline.com", { "fuzziness": "AUTO", "max_expansions": 10 }) OR
36+
match(dns.question.name, "microsoftonline.com", { "fuzziness": "AUTO", "max_expansions": 10 })
37+
)
38+
| EVAL confidence = CASE(
39+
_score >= 5.999, "low",
40+
_score > 4, "medium",
41+
"high"
42+
)
43+
| WHERE confidence != "low"
44+
OR domain IN ("micsrosoftonline.com", "outlook-office.micsrosoftonline.com")
45+
| SORT _score DESC
46+
| KEEP @timestamp, source.ip, user.id, domain, _score, confidence
47+
```
48+
49+
## Notes
50+
51+
- Investigate domains that resemble `microsoftonline.com` but have slight character substitutions (e.g., `micros0ftonline.com`, `m1crosoftonline.com`).
52+
- Fuzzy matching assigns a `_score` based on edit distance. Higher scores mean a closer match to the legitimate domain.
53+
- Only medium- and high-confidence results are surfaced by excluding `_score >= 6`, which usually represents exact or near-exact matches.
54+
- Legitimate Microsoft domains like `login.microsoftonline.com`, `portal.microsoftonline.com`, and tenant domains ending in `.onmicrosoft.com` are excluded from results to reduce noise.
55+
- Results are ranked by `_score DESC` and tagged with a confidence level: `low`, `medium`, or `high`.
56+
- This query is best used interactively during hunts and may require tuning for specific environments with high Microsoft traffic.
57+
58+
## MITRE ATT&CK Techniques
59+
60+
- [T1566.002](https://attack.mitre.org/techniques/T1566/002)
61+
- [T1583.001](https://attack.mitre.org/techniques/T1583/001)
62+
63+
## References
64+
65+
- https://www.microsoft.com/en-us/security/blog/2025/05/27/new-russia-affiliated-actor-void-blizzard-targets-critical-sectors-for-espionage/
66+
67+
## License
68+
69+
- `Elastic License v2`
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[hunt]
2+
author = "Elastic"
3+
description = """
4+
This hunting query identifies potential spoofed domain activity targeting Microsoft online services by detecting fuzzy matches to the domain `microsoftonline.com`. The approach uses approximate string matching (fuzziness) on domain and URL fields, then scores each result by similarity. A static confidence threshold is applied to filter out high-confidence legitimate matches while surfacing potential typosquats and lookalikes.
5+
6+
This technique is useful for identifying phishing campaigns, misconfigured infrastructure, or domain squatting activity targeting Microsoft users and applications. It relies on string similarity scoring and known-good domain exclusions to reduce false positives and focus the hunt on medium- to high-risk spoofed domains.
7+
"""
8+
integration = ["endpoint", "network_traffic", "system", "azure", "o365", "windows"]
9+
uuid = "e912f5c6-eed3-11ef-a5d7-6f9f7a1e2e00"
10+
name = "Potential Spoofed `microsoftonline.com` via Fuzzy Match"
11+
language = ["ES|QL"]
12+
license = "Elastic License v2"
13+
notes = [
14+
"Investigate domains that resemble `microsoftonline.com` but have slight character substitutions (e.g., `micros0ftonline.com`, `m1crosoftonline.com`).",
15+
"Fuzzy matching assigns a `_score` based on edit distance. Higher scores mean a closer match to the legitimate domain.",
16+
"Only medium- and high-confidence results are surfaced by excluding `_score >= 6`, which usually represents exact or near-exact matches.",
17+
"Legitimate Microsoft domains like `login.microsoftonline.com`, `portal.microsoftonline.com`, and tenant domains ending in `.onmicrosoft.com` are excluded from results to reduce noise.",
18+
"Results are ranked by `_score DESC` and tagged with a confidence level: `low`, `medium`, or `high`.",
19+
"This query is best used interactively during hunts and may require tuning for specific environments with high Microsoft traffic."
20+
]
21+
mitre = ["T1566.002", "T1583.001"]
22+
query = [
23+
'''
24+
FROM logs-* METADATA _score
25+
| WHERE @timestamp > now() - 30 day
26+
| WHERE (
27+
url.domain IS NOT NULL OR
28+
url.original IS NOT NULL OR
29+
destination.domain IS NOT NULL OR
30+
dns.question.name IS NOT NULL
31+
)
32+
| EVAL domain = COALESCE(url.domain, url.original, destination.domain, dns.question.name)::STRING
33+
| WHERE NOT(
34+
domain RLIKE "^(login|portal|api)\\.microsoftonline\\.com$" OR
35+
domain RLIKE ".*\\.onmicrosoft\\.com$" OR
36+
domain == "microsoftonline.com")
37+
| WHERE (
38+
match(url.domain, "microsoftonline.com", { "fuzziness": "AUTO", "max_expansions": 10 }) OR
39+
match(url.original, "microsoftonline.com", { "fuzziness": "AUTO", "max_expansions": 10 }) OR
40+
match(destination.domain, "microsoftonline.com", { "fuzziness": "AUTO", "max_expansions": 10 }) OR
41+
match(dns.question.name, "microsoftonline.com", { "fuzziness": "AUTO", "max_expansions": 10 })
42+
)
43+
| EVAL confidence = CASE(
44+
_score >= 5.999, "low",
45+
_score > 4, "medium",
46+
"high"
47+
)
48+
| WHERE confidence != "low"
49+
OR domain IN ("micsrosoftonline.com", "outlook-office.micsrosoftonline.com")
50+
| SORT _score DESC
51+
| KEEP @timestamp, source.ip, user.id, domain, _score, confidence
52+
'''
53+
]
54+
references = [
55+
"https://www.microsoft.com/en-us/security/blog/2025/05/27/new-russia-affiliated-actor-void-blizzard-targets-critical-sectors-for-espionage/"
56+
]

hunting/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ Here are the queries currently available:
4141
- [Microsoft Entra Infrequent Suspicious OData Client Requests](./azure/docs/entra_suspicious_odata_client_requests.md) (ES|QL)
4242

4343

44+
## cross-platform
45+
- [Potential Spoofed `microsoftonline.com` via Fuzzy Match](./cross-platform/docs/potentially_spoofed_microsoft_authentication_domain.md) (ES|QL)
46+
47+
4448
## linux
4549
- [Defense Evasion via Capitalized Process Execution](./linux/docs/defense_evasion_via_capitalized_process_execution.md) (ES|QL)
4650
- [Drivers Load with Low Occurrence Frequency](./linux/docs/persistence_via_driver_load_with_low_occurrence_frequency.md) (ES|QL)

hunting/index.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,3 +771,10 @@ azure:
771771
path: ./azure/queries/entra_rare_actions_by_service_principal.toml
772772
mitre:
773773
- T1098.001
774+
cross-platform:
775+
e912f5c6-eed3-11ef-a5d7-6f9f7a1e2e00:
776+
name: Potential Spoofed `microsoftonline.com` via Fuzzy Match
777+
path: ./cross-platform/queries/potentially_spoofed_microsoft_authentication_domain.toml
778+
mitre:
779+
- T1566.002
780+
- T1583.001

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "detection_rules"
3-
version = "1.2.24"
3+
version = "1.2.25"
44
description = "Detection Rules is the home for rules used by Elastic Security. This repository is used for the development, maintenance, testing, validation, and release of rules for Elastic Security’s Detection Engine."
55
readme = "README.md"
66
requires-python = ">=3.12"
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
[metadata]
2+
creation_date = "2025/06/17"
3+
integration = ["o365"]
4+
maturity = "production"
5+
updated_date = "2025/06/17"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
Identifies an excessive number of Microsoft 365 mailbox items accessed by a user either via aggregated counts or
11+
throttling. Microsoft audits mailbox access via the MailItemsAccessed event, which is triggered when a user accesses
12+
mailbox items. If more than 1000 mailbox items are accessed within a 24-hour period, it is then throttled. Excessive
13+
mailbox access may indicate an adversary attempting to exfiltrate sensitive information or perform reconnaissance on a
14+
target's mailbox. This rule detects both the throttled and unthrottled events with a high threshold.
15+
"""
16+
false_positives = [
17+
"""
18+
Legitimate users may access a large number of mailbox items in a short period, especially in environments with high
19+
email volume or during data migrations. If this is expected behavior, consider adjusting the rule or adding
20+
exceptions for specific users or groups.
21+
""",
22+
]
23+
from = "now-9m"
24+
index = ["filebeat-*", "logs-o365.audit-*"]
25+
language = "kuery"
26+
license = "Elastic License v2"
27+
name = "Excessive Microsoft 365 Mailbox Items Accessed"
28+
note = """## Triage and analysis
29+
30+
### Investigating Excessive Microsoft 365 Mailbox Items Accessed
31+
32+
Identifies an excessive number of Microsoft 365 mailbox items accessed by a user either via aggregated counts or throttling. Microsoft audits mailbox access via the MailItemsAccessed event, which is triggered when a user accesses mailbox items. If more than 1000 mailbox items are accessed within a 24-hour period, it is then throttled. Excessive mailbox access may indicate an adversary attempting to exfiltrate sensitive information or perform reconnaissance on a target's mailbox. This rule detects both the throttled and unthrottled events with a high threshold.
33+
34+
### Possible investigation steps
35+
- Review `host.name` to identify the tenant where the mailbox access occurred.
36+
- Review `o365.audit.UserId` or `o365.audit.MailboxOwnerUPN` to identify the user associated with the mailbox access.
37+
- Examine `o365.audit.ExternalAccess` to determine if the mailbox access was performed by an external user or application.
38+
- Check the geolocation data to identify the location from which the mailbox access occurred. Is this an expected location for the user?
39+
- Check `o365.audit.ClientAppId` to identify the application used for mailbox access. Look for any unusual or unexpected applications but be aware that some legitimate applications may also trigger this rule if OAuth phishing was used.
40+
- Review `o365.audit.Folders.Path` and `o365.audit.Folders.FolderItems.Id` to identify the specific folders and items accessed within the mailbox. Look for any sensitive or high-value folders that may indicate targeted access.
41+
- For specific items accessed, examine `o365.audit.Folders.FolderItems.Id` to gather more context on the accessed mailbox items.
42+
- User types can be identified by checking `o365.audit.UserType`. Review if the mailbox of the user is a member, admin or delegate.
43+
- If Entra ID logs are available, checking the risk status via `azure.signinlogs.properties.risk_state` and `azure.signinlogs.properties.risk_level` can provide additional context on the user's risk status during the mailbox access.
44+
45+
### False positive analysis
46+
- Legitimate users may access a large number of mailbox items in a short period, especially in environments with high email volume or during data migrations. If this is expected behavior, consider adjusting the rule or adding exceptions for specific users or groups.
47+
- Automated processes or scripts that access mailbox items may also trigger this rule. If these processes are legitimate and necessary, consider adding exceptions for the specific applications or users involved.
48+
- Users with high email activity, such as helpdesk or support roles, may trigger this rule due to their job responsibilities. If this is expected behavior, consider adjusting the rule or adding exceptions for specific users or groups.
49+
50+
### Response and remediation
51+
- Investigate the user account associated with the excessive mailbox access to determine if it has been compromised or if the activity is expected behavior.
52+
- If the mailbox access is confirmed to be suspicious or unauthorized, take immediate action to revoke the access token and prevent further access.
53+
- Disable the user account temporarily to prevent any potential compromise or unauthorized access.
54+
- Review the user's recent sign-in activity and access patterns to identify any potential compromise or unauthorized access.
55+
- If the user account is compromised, initiate a password reset and enforce multi-factor authentication (MFA) for the user.
56+
- Review the conditional access policies in place to ensure they are sufficient to prevent unauthorized access to sensitive resources.
57+
- Examine how the mailbox access was performed. If it was done via a third-party application, review the permissions granted to that application and consider revoking them if they are not necessary.
58+
"""
59+
references = [
60+
"https://learn.microsoft.com/en-us/purview/audit-log-investigate-accounts#use-mailitemsaccessed-audit-records-for-forensic-investigations",
61+
"https://www.microsoft.com/en-us/security/blog/2025/05/27/new-russia-affiliated-actor-void-blizzard-targets-critical-sectors-for-espionage/",
62+
]
63+
risk_score = 47
64+
rule_id = "7fc95782-4bd1-11f0-9838-f661ea17fbcd"
65+
severity = "medium"
66+
tags = [
67+
"Domain: Cloud",
68+
"Domain: Email",
69+
"Data Source: Microsoft 365",
70+
"Data Source: Microsoft 365 Audit Logs",
71+
"Use Case: Threat Detection",
72+
"Tactic: Collection",
73+
"Resources: Investigation Guide",
74+
]
75+
timestamp_override = "event.ingested"
76+
type = "query"
77+
78+
query = '''
79+
event.dataset: "o365.audit" and
80+
event.provider: "Exchange" and
81+
event.action: "MailItemsAccessed" and
82+
event.code: "ExchangeItemAggregated" and
83+
(
84+
(
85+
o365.audit.OperationProperties.Name: "IsThrottled" and
86+
o365.audit.OperationProperties.Value: "True"
87+
) or o365.audit.OperationCount >= 100
88+
)
89+
'''
90+
91+
92+
[[rule.threat]]
93+
framework = "MITRE ATT&CK"
94+
[[rule.threat.technique]]
95+
id = "T1114"
96+
name = "Email Collection"
97+
reference = "https://attack.mitre.org/techniques/T1114/"
98+
[[rule.threat.technique.subtechnique]]
99+
id = "T1114.002"
100+
name = "Remote Email Collection"
101+
reference = "https://attack.mitre.org/techniques/T1114/002/"
102+
103+
104+
105+
[rule.threat.tactic]
106+
id = "TA0009"
107+
name = "Collection"
108+
reference = "https://attack.mitre.org/tactics/TA0009/"
109+
110+
[rule.investigation_fields]
111+
field_names = [
112+
"user.id",
113+
"user.name",
114+
"user.email",
115+
"user.domain",
116+
"event.id",
117+
"event.action",
118+
"event.outcome",
119+
"event.provider",
120+
"source.ip",
121+
"related.ip",
122+
"related.user",
123+
"o365.audit.ClientAppId",
124+
"o365.audit.AppId",
125+
"o365.audit.AppAccessContext.UniqueTokenId",
126+
"o365.audit.OperationCount",
127+
"o365.audit.MailboxOwnerUPN",
128+
"o365.audit.MailboxOwnerSid",
129+
"o365.audit.MailboxGuid",
130+
"o365.audit.UserKey",
131+
"o365.audit.LogonUserSid",
132+
"o365.audit.TokenTenantId",
133+
"o365.audit.OriginatingServer",
134+
"o365.audit.ClientInfoString",
135+
"o365.audit.CreationTime",
136+
"o365.audit.ResultStatus",
137+
"source.geo.country_iso_code",
138+
"source.geo.country_name",
139+
"source.geo.continent_name",
140+
"source.geo.location",
141+
"cloud.account.id",
142+
"cloud.provider",
143+
"cloud.region",
144+
"cloud.service.name",
145+
]
146+

0 commit comments

Comments
 (0)