
However, some methods listed above are not realistic for the real-world environment. Organizations have adopted many ways to prevent ICMP tunneling, like blocking all ICMP traffic, limiting the size of ICMP packets, etc.

It can also be used to set a backdoor into a target system and execute commands on the machine with admin privileges, as well as leak information and start/stop critical services without users’ knowledge. By using LOKI, one can transmit data secretly by hiding the traffic so networking devices cannot detect the transmission.

It uses the ICMP echo-response packet to carry its payload. The most common ICMP tunneling program is LOKI. So if we want to detect ICMP tunneling via any IDS/IPS devices we need to write a rule stating that if any data is present in the data header of the ICMP, then fire an alert. In the above scenario, the total size is 72 bytes out of which 30 bytes is the data “sending packets via tunneling”. In a normal ICMP echo request, the packet length will be 42 bytes, where the data length is 0, and if we append any data into the ICMP data field then the size of the packet increases. If we sniff the destination then we can see the entire data as well. Now I am going to send data, “sending packets via tunneling”, via ping message, by typing the below command.
#PACKET SENDER HACKING CODE#
So if we want to send a particular ICMP request with a particular type or code set then we can use Hping (we can do this in cmd prompt also, but changing code and type of ICMP in cmd is not possible). For a normal ping message that we send using a command prompt, it sends four packets of data. Hping is a packet crafter tool used to conduct a test or attack on a device. Now let’s showcase this scenario by using the Hping tool. So the network administrator or security administrators will not be able to detect such encrypted communication unless a deep packet inspection is carried out. Application-based firewalls are only capable of detecting such a type of traffic, as they do a deep packet inspection on the entire packet. These mechanisms can be used to bypass firewalls’ rules through obfuscation of the actual traffic. This type of communication traffic remains undetectable for a proxy-based firewall, as they are more focused on the source and destination IP addresses. The remote computer injects an answer into another ICMP packet and sends it back. So by using ICMP tunneling, one can inject arbitrary data into an echo packet and send it to a remote computer.

ICMP tunneling is a covert connection between two endpoints using ICMP echo requests and reply packets. An ICMP tunnel establishes a channel between the client and server, forcing a firewall not to trigger an alarm if data are sent via ICMP. ICMP tunnels are one form of a covert channel that is created wherein the information flow is not controlled by any security mechanism. There are 15 different types of ICMP messages and some are categorized as error reporting and query. If any mismatch is found, then it confirms that an error or change has occurred. So at the receiving end, the checksum is calculated again and verified against the checksum field.

Before an ICMP message is transmitted, the checksum is computed and is inserted into the field. The last field talks about the Checksum, which is used to check errors while transmitting data and is calculated from the ICMP header and data. So in fact when a type 0 (echo reply) is sent, the reply will no longer be a Type 8 (echo request). So the receiving unit gets to associate the error with the process. When an ICMP error is sent, it always sends the IP header and the datagram that caused the error. ICMP error messages are not sent in response to an ICMP error. We need to know this as we will particularly deal with ICMP error messages. The first two columns will determine whether the ICMP is a query message or an error message. If you look at RFC you will get to know the different types and their descriptions. So a type of ICMP message will use different values of the code field to specify the condition. There are different values for the type field, which identify the ICMP message. ICMP messages are transmitted within packets, as shown below.īelow shows the format of an ICMP message.
