Port Forwarding Rule Addition
Identifies the creation of a new port forwarding rule. An adversary may abuse this technique to bypass network segmentation restrictions.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/11/25"
3integration = ["endpoint", "windows", "sentinel_one_cloud_funnel", "m365_defender"]
4maturity = "production"
5min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
6min_stack_version = "8.14.0"
7updated_date = "2024/10/15"
8
9[rule]
10author = ["Elastic"]
11description = """
12Identifies the creation of a new port forwarding rule. An adversary may abuse this technique to bypass network
13segmentation restrictions.
14"""
15from = "now-9m"
16index = ["winlogbeat-*", "logs-endpoint.events.registry-*", "logs-windows.sysmon_operational-*", "endgame-*", "logs-sentinel_one_cloud_funnel.*", "logs-m365_defender.event-*"]
17language = "eql"
18license = "Elastic License v2"
19name = "Port Forwarding Rule Addition"
20note = """## Triage and analysis
21
22### Investigating Port Forwarding Rule Addition
23
24Network port forwarding is a mechanism to redirect incoming TCP connections (IPv4 or IPv6) from the local TCP port to any other port number, or even to a port on a remote computer.
25
26Attackers may configure port forwarding rules to bypass network segmentation restrictions, using the host as a jump box to access previously unreachable systems.
27
28This rule monitors the modifications to the `HKLM\\SYSTEM\\*ControlSet*\\Services\\PortProxy\\v4tov4\\` subkeys.
29
30#### Possible investigation steps
31
32- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
33- Identify the user account that performed the action and whether it should perform this kind of action.
34- Contact the account and system owners and confirm whether they are aware of this activity.
35- Investigate other alerts associated with the user/host during the past 48 hours.
36- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
37- Identify the target host IP address, check the connections originating from the host where the modification occurred, and inspect the credentials used.
38 - Investigate suspicious login activity, such as unauthorized access and logins from outside working hours and unusual locations.
39
40### False positive analysis
41
42- This mechanism can be used legitimately. Analysts can dismiss the alert if the Administrator is aware of the activity and there are justifications for this configuration.
43- If this rule is noisy in your environment due to expected activity, consider adding exceptions — preferably with a combination of user and command line conditions.
44
45### Response and remediation
46
47- Initiate the incident response process based on the outcome of the triage.
48- Delete the port forwarding rule.
49- Isolate the involved host to prevent further post-compromise behavior.
50- If the triage identified malware, search the environment for additional compromised hosts.
51 - Implement temporary network rules, procedures, and segmentation to contain the malware.
52 - Stop suspicious processes.
53 - Immediately block the identified indicators of compromise (IoCs).
54 - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
55- Remove and block malicious artifacts identified during triage.
56- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
57- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
58- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
59- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
60"""
61references = [
62 "https://www.fireeye.com/blog/threat-research/2019/01/bypassing-network-restrictions-through-rdp-tunneling.html",
63]
64risk_score = 47
65rule_id = "3535c8bb-3bd5-40f4-ae32-b7cd589d5372"
66severity = "medium"
67tags = [
68 "Domain: Endpoint",
69 "OS: Windows",
70 "Use Case: Threat Detection",
71 "Tactic: Command and Control",
72 "Tactic: Defense Evasion",
73 "Resources: Investigation Guide",
74 "Data Source: Elastic Endgame",
75 "Data Source: Elastic Defend",
76 "Data Source: Sysmon",
77 "Data Source: SentinelOne",
78 "Data Source: Microsoft Defender for Endpoint",
79]
80timestamp_override = "event.ingested"
81type = "eql"
82
83query = '''
84registry where host.os.type == "windows" and registry.path : (
85 "HKLM\\SYSTEM\\*ControlSet*\\Services\\PortProxy\\v4tov4\\*",
86 "\\REGISTRY\\MACHINE\\SYSTEM\\*ControlSet*\\Services\\PortProxy\\v4tov4\\*",
87 "MACHINE\\SYSTEM\\*ControlSet*\\Services\\PortProxy\\v4tov4\\*"
88)
89'''
90
91
92[[rule.threat]]
93framework = "MITRE ATT&CK"
94[[rule.threat.technique]]
95id = "T1572"
96name = "Protocol Tunneling"
97reference = "https://attack.mitre.org/techniques/T1572/"
98
99
100[rule.threat.tactic]
101id = "TA0011"
102name = "Command and Control"
103reference = "https://attack.mitre.org/tactics/TA0011/"
104
105[[rule.threat]]
106framework = "MITRE ATT&CK"
107[[rule.threat.technique]]
108id = "T1112"
109name = "Modify Registry"
110reference = "https://attack.mitre.org/techniques/T1112/"
111
112[rule.threat.tactic]
113id = "TA0005"
114name = "Defense Evasion"
115reference = "https://attack.mitre.org/tactics/TA0005/"
Triage and analysis
Investigating Port Forwarding Rule Addition
Network port forwarding is a mechanism to redirect incoming TCP connections (IPv4 or IPv6) from the local TCP port to any other port number, or even to a port on a remote computer.
Attackers may configure port forwarding rules to bypass network segmentation restrictions, using the host as a jump box to access previously unreachable systems.
This rule monitors the modifications to the HKLM\SYSTEM\*ControlSet*\Services\PortProxy\v4tov4\
subkeys.
Possible investigation steps
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the account and system owners and confirm whether they are aware of this activity.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
- Identify the target host IP address, check the connections originating from the host where the modification occurred, and inspect the credentials used.
- Investigate suspicious login activity, such as unauthorized access and logins from outside working hours and unusual locations.
False positive analysis
- This mechanism can be used legitimately. Analysts can dismiss the alert if the Administrator is aware of the activity and there are justifications for this configuration.
- If this rule is noisy in your environment due to expected activity, consider adding exceptions — preferably with a combination of user and command line conditions.
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Delete the port forwarding rule.
- Isolate the involved host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
References
Related rules
- Adding Hidden File Attribute via Attrib
- Bypass UAC via Event Viewer
- Clearing Windows Console History
- Clearing Windows Event Logs
- Code Signing Policy Modification Through Built-in tools