GRE
IP-IN-IP
PROTOCOL 47
TUNNEL.LOG
DetectionBlue TeamSOCOctober 12, 2026•9 min read

Detecting GRE and IP-in-IP Covert Tunnels: Unexpected IP Protocols

Most egress policy is written for TCP and UDP. A host that can send raw IP protocol 47 or 4 past the firewall has an unmonitored tunnel to anywhere that answers.

Scroll

GRE (IP protocol 47) and IP-in-IP (protocol 4) wrap one IP packet inside another with almost no overhead. They are normal between routers, but unexpected from endpoints and servers. Because they are not TCP or UDP, they are skipped by port-based monitoring and often by allow-list firewalls that treat them as infrastructure traffic.

Signals at a Glance

SignalWhereATT&CK
IP protocol 47 (GRE) or 4 (IPIP) or 41 (IPv6 encapsulation) leaving the networkFirewall, NetFlow, ZeekT1572
Zeek tunnel.log records for GRE or IP-in-IP between external endpointsZeek tunnel.logT1095
ip tunnel add or ip link add type gre/ipip on a hostauditd, EDRT1572
Traffic from a host to an external address with only protocol 47/4 and no application sessionsNetFlowT1095
Firewall policies that permit any IP protocol outboundPolicy reviewT1572

Edge and Flow Detection

The first control is an inventory of the places GRE and IPIP are legitimate: WAN routers, cloud VPN gateways and a few vendor links. Anything else crossing the boundary is exceptional. Zeek decodes encapsulated traffic into tunnel.log, which reports the tunnel type and both endpoints:

# Splunk (Zeek tunnel.log) - external GRE / IP-in-IP tunnels
index=zeek sourcetype=bro_tunnel tunnel_type IN ("Tunnel::GRE","Tunnel::IP")
| stats count AS events, min(_time) AS first, max(_time) AS last
    BY id.orig_h, id.resp_h, tunnel_type
| where NOT cidrmatch("10.0.0.0/8", 'id.resp_h')
| sort - events

# Linux edge: log, then review, any encapsulation protocols
iptables -I FORWARD -p 47 -j LOG --log-prefix "GRE-FWD "
iptables -I FORWARD -p 4  -j LOG --log-prefix "IPIP-FWD "
# tune/validate: add source and destination allow-lists for sanctioned
# router and cloud-gateway peers before turning logging into alerting.

Host Tunnel Interfaces

Creating a GRE or IPIP tunnel on Linux needs root and leaves a clear command or netlink trail. A workstation or application server with no routing role should never create one:

title: Linux GRE or IPIP Tunnel Interface Creation
logsource:
  category: process_creation
  product: linux
detection:
  selection_ip:
    Image|endswith: '/ip'
  selection_tunnel:
    CommandLine|contains:
      - 'tunnel add'
      - 'link add'
  selection_mode:
    CommandLine|contains:
      - 'mode gre'
      - 'mode ipip'
      - 'type gre'
      - 'type ipip'
      - 'type sit'
  condition: selection_ip and selection_tunnel and selection_mode
level: high
# tune/validate: container and network-automation hosts create tunnels by
# design; scope by host role.
Vetted sources

Use Zeek tunnel.log documentation, your firewall’s protocol-level logs and policy export, SigmaHQ Linux process-creation content and Elastic network rules for unusual IP protocols. Always baseline your own environment — sanctioned router and VPN gateway links will appear and must be allow-listed.

Build Detections That Fire

Mjolnir Security helps blue teams turn threat intelligence into high-fidelity detections across endpoint, network, identity and cloud telemetry.

Detection EngineeringManaged Detection & ResponseThreat HuntingIncident ResponsePurple Teaming
  • Detection Engineering We build and tune detections mapped to ATT&CK from your own telemetry.
  • Threat Hunting as a Service Hypothesis-driven hunts for the behaviours on this page.
  • 24/7 Incident Response Containment when a detection fires. Call +1 833 403 5875.
Written by: Mjolnir Threat Research (MTAC)  |  Published: October 12, 2026  |  Last reviewed: October 12, 2026