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"]
  4maturity = "production"
  5min_stack_comments = "SentinelOne integration package minimum version for validation."
  6min_stack_version = "8.11.0"
  7updated_date = "2024/05/16"
  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.*"]
 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"
 66setup = """## Setup
 67
 68If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
 69events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
 70Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
 71`event.ingested` to @timestamp.
 72For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
 73"""
 74severity = "medium"
 75tags = [
 76    "Domain: Endpoint",
 77    "OS: Windows",
 78    "Use Case: Threat Detection",
 79    "Tactic: Command and Control",
 80    "Tactic: Defense Evasion",
 81    "Resources: Investigation Guide",
 82    "Data Source: Elastic Endgame",
 83    "Data Source: Elastic Defend",
 84    "Data Source: Sysmon",
 85    "Data Source: SentinelOne"
 86]
 87timestamp_override = "event.ingested"
 88type = "eql"
 89
 90query = '''
 91registry where host.os.type == "windows" and registry.path : (
 92  "HKLM\\SYSTEM\\*ControlSet*\\Services\\PortProxy\\v4tov4\\*",
 93  "\\REGISTRY\\MACHINE\\SYSTEM\\*ControlSet*\\Services\\PortProxy\\v4tov4\\*",
 94  "MACHINE\\SYSTEM\\*ControlSet*\\Services\\PortProxy\\v4tov4\\*"
 95)
 96'''
 97
 98
 99[[rule.threat]]
100framework = "MITRE ATT&CK"
101[[rule.threat.technique]]
102id = "T1572"
103name = "Protocol Tunneling"
104reference = "https://attack.mitre.org/techniques/T1572/"
105
106
107[rule.threat.tactic]
108id = "TA0011"
109name = "Command and Control"
110reference = "https://attack.mitre.org/tactics/TA0011/"
111
112[[rule.threat]]
113framework = "MITRE ATT&CK"
114[[rule.threat.technique]]
115id = "T1112"
116name = "Modify Registry"
117reference = "https://attack.mitre.org/techniques/T1112/"
118
119[rule.threat.tactic]
120id = "TA0005"
121name = "Defense Evasion"
122reference = "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

to-top