Skip to content

Commit 39936af

Browse files
committed
[New] Potential Machine Account Relay Attack via SMB
Identify a server machine account accessing itself via SMB but from a remote source.ip, this behavior is abnormal and match SMB relay:
1 parent 718b64f commit 39936af

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
[metadata]
2+
creation_date = "2025/06/16"
3+
integration = ["system", "windows"]
4+
maturity = "production"
5+
updated_date = "2025/06/16"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
Identifies potential relay attacks against a machine account by identifying network share access events coming from a
11+
remote source.ip but using the target server computer account. This may indicate a successful SMB relay attack.
12+
"""
13+
from = "now-9m"
14+
index = ["logs-system.security*", "logs-windows.forwarded*", "winlogbeat-*"]
15+
language = "eql"
16+
license = "Elastic License v2"
17+
name = "Potential Machine Account Relay Attack via SMB"
18+
note = """## Triage and analysis
19+
20+
### Investigating Potential Machine Account Relay Attack via SMB
21+
22+
### Possible investigation steps
23+
- Compare the source.ip to the target server host.ip to make sure it's indeed a remote use of the machine account.
24+
- Examine the source.ip activities as this is the attacker IP address used to relay.
25+
- Review all relevant activities such as services creation, file and process events on the target server within the same period.
26+
- Verify the machine account names that end with a dollar sign ($) to ensure they match the expected hostnames, and investigate any discrepancies.
27+
- Check the network logon types to confirm if they align with typical usage patterns for the identified machine accounts.
28+
- Investigate the context of the source IP addresses that do not match the host IP, looking for any signs of unauthorized access or unusual network activity.
29+
- Correlate the findings with other security logs and alerts to identify any patterns or additional indicators of compromise related to the potential relay attack.
30+
31+
### False positive analysis
32+
33+
- Machine accounts performing legitimate network logons from different IP addresses can trigger false positives. To manage this, identify and whitelist known IP addresses associated with legitimate administrative tasks or automated processes.
34+
- Scheduled tasks or automated scripts that use machine accounts for network operations may be flagged. Review and document these tasks, then create exceptions for their associated IP addresses and hostnames.
35+
- Load balancers or proxy servers that alter the source IP address of legitimate authentication requests can cause false alerts. Ensure these devices are accounted for in the network architecture and exclude their IP addresses from the rule.
36+
- Temporary network reconfigurations or migrations might result in machine accounts appearing to log in from unexpected hosts. During such events, temporarily adjust the rule parameters or disable the rule to prevent unnecessary alerts.
37+
- Regularly review and update the list of exceptions to ensure they reflect current network configurations and operational practices, minimizing the risk of overlooking genuine threats.
38+
39+
### Response and remediation
40+
41+
- Immediately isolate the affected domain controller from the network to prevent further unauthorized access and potential lateral movement by the attacker.
42+
- Conduct a password reset for the domain controller's machine account and any other accounts that may have been compromised or are at risk, ensuring the use of strong, unique passwords.
43+
- Review and analyze recent authentication logs and network traffic to identify any other potentially compromised systems or accounts, focusing on the source IP addresses flagged in the alert.
44+
- Implement network segmentation to limit the ability of attackers to relay credentials between systems, particularly between domain controllers and other critical infrastructure.
45+
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine the full scope of the breach.
46+
- Deploy additional monitoring and detection mechanisms to identify similar relay attack patterns in the future, enhancing the detection capabilities for NTLM relay attacks.
47+
- Conduct a post-incident review to identify any gaps in security controls and update policies or procedures to prevent recurrence, ensuring lessons learned are applied to improve overall security posture."""
48+
references = [
49+
"https://github.com/p0dalirius/windows-coerced-authentication-methods",
50+
"https://www.thehacker.recipes/a-d/movement/mitm-and-coerced-authentications",
51+
"https://attack.mitre.org/techniques/T1187/",
52+
]
53+
risk_score = 73
54+
rule_id = "d84a11c0-eb12-4e7d-8a0a-718e38351e29"
55+
severity = "high"
56+
tags = [
57+
"Domain: Endpoint",
58+
"OS: Windows",
59+
"Use Case: Threat Detection",
60+
"Tactic: Credential Access",
61+
"Data Source: Elastic Defend",
62+
"Data Source: Active Directory",
63+
"Use Case: Active Directory Monitoring",
64+
"Data Source: Windows Security Event Logs",
65+
"Resources: Investigation Guide",
66+
]
67+
timestamp_override = "event.ingested"
68+
type = "eql"
69+
70+
query = '''
71+
file where event.code == "5145" and endswith(user.name, "$") and
72+
startswith~(winlog.computer_name, substring(user.name, 0, -1)) and
73+
not cidrmatch(source.ip, "127.0.0.1", "::1") and not string(source.ip) like "*:*" and
74+
not endswith(string(source.ip), string(host.ip)) and
75+
source.ip != null and source.ip != "::1" and source.ip != "127.0.0.1"
76+
'''
77+
78+
79+
[[rule.threat]]
80+
framework = "MITRE ATT&CK"
81+
[[rule.threat.technique]]
82+
id = "T1187"
83+
name = "Forced Authentication"
84+
reference = "https://attack.mitre.org/techniques/T1187/"
85+
86+
[[rule.threat.technique]]
87+
id = "T1557"
88+
name = "Adversary-in-the-Middle"
89+
reference = "https://attack.mitre.org/techniques/T1557/"
90+
[[rule.threat.technique.subtechnique]]
91+
id = "T1557.001"
92+
name = "LLMNR/NBT-NS Poisoning and SMB Relay"
93+
reference = "https://attack.mitre.org/techniques/T1557/001/"
94+
95+
96+
97+
[rule.threat.tactic]
98+
id = "TA0006"
99+
name = "Credential Access"
100+
reference = "https://attack.mitre.org/tactics/TA0006/"
101+

0 commit comments

Comments
 (0)