Newly Observed IPSEC NAT Traversal Peer
This rule identifies outbound IPSEC NAT Traversal (NAT-T) traffic to an external destination IP that was not observed during the previous 5 days. IPSEC is a VPN technology that allows one system to talk to another using encrypted tunnels. NAT Traversal encapsulates IPSEC ESP traffic in UDP and, once a NAT device is detected, both peers float to UDP port 4500 for the tunnel data channel. Newly observed external NAT-T peers may indicate unauthorized VPN use or an adversary tunneling command and control or exfiltration traffic over the Internet.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/02/18"
3integration = ["network_traffic", "panw", "pfsense", "zeek"]
4maturity = "production"
5updated_date = "2026/08/07"
6
7[rule]
8author = ["Elastic"]
9description = """
10This rule identifies outbound IPSEC NAT Traversal (NAT-T) traffic to an external destination IP that was not observed
11during the previous 5 days. IPSEC is a VPN technology that allows one system to talk to another using encrypted
12tunnels. NAT Traversal encapsulates IPSEC ESP traffic in UDP and, once a NAT device is detected, both peers float to UDP
13port 4500 for the tunnel data channel. Newly observed external NAT-T peers may indicate unauthorized VPN use or an
14adversary tunneling command and control or exfiltration traffic over the Internet.
15"""
16false_positives = [
17 """
18 Newly deployed legitimate site-to-site or client VPN gateways, or established gateways that were inactive for more
19 than 5 days, will generate an alert when first observed. Where these peers are expected, their external destination
20 IP addresses can be excluded.
21 """,
22]
23from = "now-7205m"
24interval = "5m"
25language = "esql"
26license = "Elastic License v2"
27name = "Newly Observed IPSEC NAT Traversal Peer"
28risk_score = 21
29rule_id = "a9cb3641-ff4b-4cdc-a063-b4b8d02a67c7"
30severity = "low"
31tags = [
32 "Tactic: Command and Control",
33 "Domain: Endpoint",
34 "Use Case: Threat Detection",
35 "Data Source: PAN-OS",
36 "Data Source: Network Traffic",
37 "Data Source: pfSense",
38 "Data Source: Zeek",
39 "Resources: Investigation Guide",
40]
41timestamp_override = "event.ingested"
42type = "esql"
43
44query = '''
45FROM packetbeat-*, auditbeat-*, filebeat-*, logs-network_traffic.flow-*, logs-panw.panos*, logs-pfsense.log-*, logs-zeek.connection-* METADATA _id
46| WHERE (
47 data_stream.dataset IN ("network_traffic.flow", "zeek.connection")
48 OR MV_CONTAINS(event.category, "network")
49 OR MV_CONTAINS(event.category, "network_traffic")
50 )
51 AND network.transport == "udp"
52 AND source.port == 4500
53 AND destination.port == 4500
54 AND CIDR_MATCH(source.ip, "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16")
55 AND NOT CIDR_MATCH(
56 destination.ip,
57 "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12",
58 "192.0.0.0/24", "192.0.0.0/29", "192.0.0.8/32", "192.0.0.9/32",
59 "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
60 "192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24",
61 "224.0.0.0/4", "100.64.0.0/10", "192.175.48.0/24", "198.18.0.0/15",
62 "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10", "FF00::/8"
63 )
64 AND (
65 data_stream.dataset IS NULL
66 OR data_stream.dataset != "panw.panos"
67 OR event.action IS NULL
68 OR event.action NOT IN ("flow_dropped", "flow_denied")
69 )
70| EVAL Esql.dataset = COALESCE(data_stream.dataset, event.dataset)
71| STATS
72 Esql.first_seen = MIN(@timestamp),
73 Esql.last_seen = MAX(@timestamp),
74 Esql.event_count = COUNT(*),
75 Esql.source_ip_count = COUNT_DISTINCT(source.ip),
76 Esql.source_ip_values = MV_SLICE(VALUES(source.ip), 0, 100),
77 Esql.event_action_values = VALUES(event.action),
78 Esql.dataset_values = VALUES(Esql.dataset),
79 Esql.observer_name_values = MV_SLICE(VALUES(observer.name), 0, 20)
80 BY destination.ip
81| EVAL Esql.recent = DATE_DIFF("minute", Esql.first_seen, NOW())
82| WHERE Esql.recent >= 0 AND Esql.recent <= 10
83| KEEP destination.ip, Esql.*
84'''
85note = """## Triage and analysis
86
87> **Disclaimer**:
88> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
89
90### Investigating Newly Observed IPSEC NAT Traversal Peer
91
92IPSEC NAT Traversal facilitates secure VPN communication across NAT devices by encapsulating IPSEC packets in UDP, typically using port 4500. While essential for legitimate encrypted traffic, adversaries exploit this to mask malicious activities and bypass network defenses. This rule surfaces an external destination the first time NAT-T traffic to it is observed within a 5-day history window.
93
94### Possible investigation steps
95
96- Review the source and destination IP addresses associated with the UDP traffic on port 4500 to determine if they are known or expected within your network environment.
97- Analyze the volume and frequency of the detected traffic to assess whether it aligns with typical IPSEC NAT Traversal usage or if it appears anomalous.
98- Check for any associated network traffic events in the same timeframe that might indicate a pattern of suspicious activity, such as unusual data transfer volumes or connections to known malicious IP addresses.
99- Investigate the endpoint or device generating the traffic to verify if it is authorized to use IPSEC NAT Traversal and if it has any history of security incidents or vulnerabilities.
100- Correlate the detected activity with any recent changes in network configurations or security policies that might explain the traffic pattern.
101- Consult threat intelligence sources to determine if the destination IP address or domain has been associated with known threat actors or command and control infrastructure.
102
103### False positive analysis
104
105- A legitimate VPN gateway will alert when it is first deployed or first observed after more than 5 days of inactivity.
106- Legitimate VPN traffic using IPSEC NAT Traversal can trigger alerts. Regularly review and whitelist known IP addresses or subnets associated with authorized VPN connections to reduce false positives.
107- Network devices or services that rely on IPSEC for secure communication may generate expected traffic on port 4500. Identify and document these devices, then create exceptions in the detection rule to prevent unnecessary alerts.
108- Automated backup or synchronization services that use IPSEC for secure data transfer might be flagged. Monitor these services and exclude their traffic patterns if they are verified as non-threatening.
109- Some enterprise applications may use IPSEC NAT Traversal for secure communication. Conduct an inventory of such applications and adjust the rule to exclude their traffic after confirming their legitimacy.
110- Regularly update the list of known safe IP addresses and services to ensure that new legitimate sources of IPSEC NAT Traversal traffic are promptly excluded from triggering alerts.
111
112### Response and remediation
113
114- Immediately isolate the affected system from the network to prevent further potential malicious activity and lateral movement.
115- Conduct a thorough analysis of the isolated system to identify any signs of compromise, such as unauthorized access or data exfiltration, focusing on logs and network traffic related to UDP port 4500.
116- Block all suspicious IP addresses associated with the detected traffic on port 4500 at the network perimeter to prevent further communication with potential threat actors.
117- Review and update firewall and intrusion detection/prevention system (IDS/IPS) rules to ensure they effectively block unauthorized IPSEC NAT Traversal traffic, particularly on UDP port 4500.
118- Restore the affected system from a known good backup if any signs of compromise are confirmed, ensuring that all security patches and updates are applied before reconnecting to the network.
119- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected.
120- Implement enhanced monitoring and logging for UDP traffic on port 4500 to detect and respond to any future suspicious activity promptly."""
121
122
123[rule.alert_suppression]
124group_by = ["destination.ip"]
125missing_fields_strategy = "suppress"
126
127[rule.alert_suppression.duration]
128unit = "h"
129value = 1
130
131[[rule.threat]]
132framework = "MITRE ATT&CK"
133[[rule.threat.technique]]
134id = "T1095"
135name = "Non-Application Layer Protocol"
136reference = "https://attack.mitre.org/techniques/T1095/"
137
138[[rule.threat.technique]]
139id = "T1572"
140name = "Protocol Tunneling"
141reference = "https://attack.mitre.org/techniques/T1572/"
142
143[[rule.threat.technique]]
144id = "T1573"
145name = "Encrypted Channel"
146reference = "https://attack.mitre.org/techniques/T1573/"
147
148
149[rule.threat.tactic]
150id = "TA0011"
151name = "Command and Control"
152reference = "https://attack.mitre.org/tactics/TA0011/"
Triage and analysis
Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
Investigating Newly Observed IPSEC NAT Traversal Peer
IPSEC NAT Traversal facilitates secure VPN communication across NAT devices by encapsulating IPSEC packets in UDP, typically using port 4500. While essential for legitimate encrypted traffic, adversaries exploit this to mask malicious activities and bypass network defenses. This rule surfaces an external destination the first time NAT-T traffic to it is observed within a 5-day history window.
Possible investigation steps
- Review the source and destination IP addresses associated with the UDP traffic on port 4500 to determine if they are known or expected within your network environment.
- Analyze the volume and frequency of the detected traffic to assess whether it aligns with typical IPSEC NAT Traversal usage or if it appears anomalous.
- Check for any associated network traffic events in the same timeframe that might indicate a pattern of suspicious activity, such as unusual data transfer volumes or connections to known malicious IP addresses.
- Investigate the endpoint or device generating the traffic to verify if it is authorized to use IPSEC NAT Traversal and if it has any history of security incidents or vulnerabilities.
- Correlate the detected activity with any recent changes in network configurations or security policies that might explain the traffic pattern.
- Consult threat intelligence sources to determine if the destination IP address or domain has been associated with known threat actors or command and control infrastructure.
False positive analysis
- A legitimate VPN gateway will alert when it is first deployed or first observed after more than 5 days of inactivity.
- Legitimate VPN traffic using IPSEC NAT Traversal can trigger alerts. Regularly review and whitelist known IP addresses or subnets associated with authorized VPN connections to reduce false positives.
- Network devices or services that rely on IPSEC for secure communication may generate expected traffic on port 4500. Identify and document these devices, then create exceptions in the detection rule to prevent unnecessary alerts.
- Automated backup or synchronization services that use IPSEC for secure data transfer might be flagged. Monitor these services and exclude their traffic patterns if they are verified as non-threatening.
- Some enterprise applications may use IPSEC NAT Traversal for secure communication. Conduct an inventory of such applications and adjust the rule to exclude their traffic after confirming their legitimacy.
- Regularly update the list of known safe IP addresses and services to ensure that new legitimate sources of IPSEC NAT Traversal traffic are promptly excluded from triggering alerts.
Response and remediation
- Immediately isolate the affected system from the network to prevent further potential malicious activity and lateral movement.
- Conduct a thorough analysis of the isolated system to identify any signs of compromise, such as unauthorized access or data exfiltration, focusing on logs and network traffic related to UDP port 4500.
- Block all suspicious IP addresses associated with the detected traffic on port 4500 at the network perimeter to prevent further communication with potential threat actors.
- Review and update firewall and intrusion detection/prevention system (IDS/IPS) rules to ensure they effectively block unauthorized IPSEC NAT Traversal traffic, particularly on UDP port 4500.
- Restore the affected system from a known good backup if any signs of compromise are confirmed, ensuring that all security patches and updates are applied before reconnecting to the network.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected.
- Implement enhanced monitoring and logging for UDP traffic on port 4500 to detect and respond to any future suspicious activity promptly.
Related rules
- RDP (Remote Desktop Protocol) from the Internet
- SMTP to the Internet on Port 26/TCP
- RPC (Remote Procedure Call) from the Internet
- RPC (Remote Procedure Call) to the Internet
- Accepted Default Telnet Port Connection