In this article, I will show how you can inject false routes into an EIGRP domain in Python. With some luck, such an injection will allow an attacker to carry out a MITM attack or cause chaos in the routing domain for a while. We will analyze in detail the process of establishing proximity to a router and exchanging routing information, and as a bonus we will create a simple graphical interface.
A brief educational program on EIGRP
EIGRP is a dynamic routing protocol classified as an Internal Gateway Distance Vector (IGP) protocol. Below is a diagram of the structure of EIGRP.
Each EIGRP packet contains a 20-byte header with the following fields.
- Version — the protocol version has never been changed and has a value of 2.
- Opcode (Operation Code) – a field that determines the type of packet. We are only interested in two values of this field: 1 and 5. The value 5 defines the Hello packet, and the value 1 defines the Update packet. We'll talk about package types a little later.
- Checksum – check sum.
- Flags – this field takes only four values: 0x1, 0x2, 0x4 and 0x8. We will only be interested in the first and last values.
- Sequence Number (SEQ) and Acknowledgment Number (ACK) is the packet sequence number and acknowledgment number, respectively (just like in TCP and UDP). These fields ensure reliable delivery of EIGRP packets.
- Virtual Router ID — virtual identifier of the router.
- Autonomous System Number — the number of the autonomous system (AS) in which the router operates.
This header is followed by a TLV (Type, Length, Value) – roughly speaking, this is a second variable value header that can contain information about routes, router parameters, firmware version, authentication, and so on. This is similar to the structure of DHCP, where the IP header is followed by DHCP, followed by the BOOTP header.
Now let's talk about EIGRP messages. During the routing process, EIGRP operates on the following types of packets (messages):
- Hello. Hello messages are sent to the multicast address 224.0.0.10 and have an opcode of 5. The default interval for sending Hello packets is 5 seconds.
- Update. Using Update packets, routers communicate to each other information about all networks known to them (during the initial establishment of the neighborhood), information about specific networks in the event that the route to them is rebuilt or when the destination network is no longer available. Such messages can be sent to both unicast and multicast addresses. The body of the Update packet contains the following information: destination network address, netmask prefix, next-hop address, number of hops, throughput, latency, reliability, load and MTU. Receipt of the Update packet is confirmed by sending an ACK.
- ACK. This message type is sent as a response to the successful receipt of all other message types except Hello. A numeric value is written into the ACK field of the EIGRP header: the SEQ field of the message to which the acknowledgment is sent is taken and one is added.
info
In both the Hello message and the ACK message the field opcode always equals 5. What does this mean? It turns out that, for example, in response to an Update message, essentially a Hello packet is sent? Partly yes, but this is not entirely true. A non-zero value for the ACK field turns the Hello message into an ACK message. Thus, despite the same opcode field value, the messages are distinguished by the ACK field value.
EIGRP also operates with several more messages: Query, Reply, SIA-Query and SIA-Reply. But we are not interested in them, so we skip them.
Before we establish a neighborhood, I will list the conditions necessary for it:
- authentication parameters must be the same (if authentication itself is available);
- the values of K-coefficients must also be the same;
- The routers must be in the same autonomous system (AS).
By default, Hello and Dead intervals are 5 and 15 seconds, respectively. Unlike OSPF, these intervals do not have to match on routers to establish adjacency. But we will set identical timer values.
Graphical interface. Find out the necessary router parameters
As you already understand, I will write the code in Python. To generate network packets, we need the Scapy library. The combination of Scapy and Python is simple, convenient and practical.
Along the way, we won’t have to look for a router that supports EIGRP or set up a virtual one. It is enough to have access to a network with an EIGRP domain.
Before searching for EIGRP routers and establishing adjacency with them, I want to show the interactive graphical interface of my script.

To establish a neighborhood, several parameters must match on the routers; in addition, in order to send EIGRP packets to a specific router, we need to know its channel and network addresses. Therefore, we would not want to look for traffic in Wireshark and look for the parameters of the router with which we want to “make friends”. It will be much more convenient to simply start listening and capturing EIGRP packets, and then write the parameters (IP address, MAC address, AS number, Hold timer and K-coefficient values) into variables convenient for us, so that we can further operate with them when crafting packets.