<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
---
name: implementing-icmp-c2-tunneling
description: >-
  Implement ICMP-based C2 tunneling to exfiltrate data and receive commands through ICMP echo request/reply packets, bypassing firewall rules that allow ping traffic.
domain: cybersecurity
subdomain: c2-frameworks
tags:
  - icmp-c2
  - icmp-tunnel
  - ping
  - firewall-bypass
version: "1.0"
author: defconxt
license: AGPL-3.0
metadata:
  mitre-attack: ["T1095"]
  frameworks: ["MITRE ATT&CK"]
  tools: ["icmpsh", "ptunnel", "scapy"]
---

# Implementing Icmp C2 Tunneling

## Overview

Implement ICMP-based C2 tunneling to exfiltrate data and receive commands through ICMP echo request/reply packets, bypassing firewall rules that allow ping traffic.

## Prerequisites

| Tool / Requirement | Details |
|---|---|
| `icmpsh` | Security tooling |
| `ptunnel` | Security tooling |
| `scapy` | Security tooling |
| Raw socket capability, icmpsh or custom ICMP tunnel, Scapy | Environment requirement |

## Quick Reference

```bash
# Quick start commands
node scripts/agent.js --help
node scripts/agent.js listen --interface eth0 --icmp-type echo
```

## Workflow

### Step 1: Configure ICMP Listener

```bash
node scripts/agent.js listen --interface eth0 --icmp-type echo
```

### Step 2: Deploy ICMP Agent

```bash
node scripts/agent.js deploy --target 10.0.0.50 --method icmpsh
```

### Step 3: Test Data Exfiltration

```bash
node scripts/agent.js exfiltrate --data test.txt --method icmp
```

## Detection

```yaml
title: Icmp C2 Tunneling Detection
id: 8c9df293-174b-470e-96f4-40a311ccd603
status: experimental
description: Detects suspicious activity related to implementing icmp c2 tunneling techniques in c2 frameworks context
logsource:
  category: network_connection
  product: windows
detection:
  selection:
    DestinationPort: 443
    Initiated: "true"
  condition: selection
level: high
tags:
  - attack.t1095
  - attack.command_and_control
falsepositives:
  - Authorized penetration testing tools during scheduled assessments
```


**Detection Opportunities**

| Indicator | Source | Detection Logic |
|---|---|---|
| Icmp C2 Tunneling Detection | windows/network_connection | Sigma rule (high) |
| ATT&CK Coverage | MITRE ATT&CK | T1095 |

## Verification

- **Verify listener**: `node scripts/agent.js verify --component listener`
- **Confirm tunnel**: `node scripts/agent.js verify --component tunnel`

## References

- MITRE ATT&CK: T1095
- Frameworks: MITRE ATT&CK
- Tools: icmpsh, ptunnel, scapy
