Network Traffic & Flow Analysis: Data Link Layer
Network Traffic & Flow Analysis: Data Link Layer
Network Traffic & Flow Analysis: Data Link Layer
Normal: ARP broadcasts are normal from both clients and servers, including
network devices at a reasonable flow.
The following are the steps for a successful attack (ARP Poisoning):
1. M would pretend to be B to A: it will send a gratuitous ARP reply with the pair:
IP_B->MAC_M
Because of the TTL in hosts ARP caches, an attacker would need to send these
packets at intervals lower than the timeout (usually every 30 seconds is a good
choice).
Once the gratuitous ARP packet is sent, B’s ARP cache gets poisoned with the
entry: IP_A->MAC_M . Next time B wants to send a packet to A, it will be
Another gratuitous ARP with correct values would restore the correct values
after the sniffing is completed
The default gateway MAC address must be used to forward the packet along
with the correct IP address configured by the administrator or given by DHCP.
The use of ARP poisoning in this scenario leads to a MITM attack from local to
remote.
1. Host A wants to send packets to the Internet. It already has the IP of the
gateway (IP_G), and it needs the associated MAC address.
2. M can use a gratuitous ARP reply to advertise itself as the default gateway:
binds IP_G with his own (MAC_M).
3. All the traffic meant to leave the LAN will pass through M(the attacker), which
will then redirect it to the real gateway.
2. Tools like arpwatch can detect but not stop such attacks
When the space in the CAM is filled with fake MAC addresses, the switch
cannot learn new MAC addresses so it to forces switches to behave like a hub
and then forward frames on all the ports.
Additionally, there are switches that can be configured in such a way so that
acting like a hub is prohibited.
Authentication packets
Beacon packets
Request-to-send packets
Clear-to-send packets
Data: Those packets are the actual data containers. They are the only packet
kind that can be passed from the wireless to the wired network.
Beacon packets are broadcasted from a wireless access point to inform other
listening wireless clients of its existence and its connection requirements.
3. Private network addresses or the loopback mode address also require your
attention
When it comes to fragmented packets, IDS/IPS must act just if they were the
destination host, in terms of packet reassembling. This is for obvious
reasons, IDS/IPS need the whole packet in order to inspect it
For the IDS/IPS to safely perform such packet reassembling and inspection, it
should act just like the destination host does. (wait as long as the destination
does for a fragment to arrive)
IP packet exceeding the 65535 bytes limit of data via a ping command (ping-of-
death)
IPv6
IPv6 Tunneling
It is a known fact that attackers have been using tunnelbased IPv6 transition
mechanisms for hide communication and stealthy exfiltration over an IPv4-only
or dual-stack network.
1. An attacker on the same local network can tamper with a returned Neighbor
Advertisement (NA) spoofing an address, after a Neighbor Solicitation
(NS) request is sent; this is the equivalent of ARP poisoning in IPv4.
2. An attacker can also craft an NS request containing the fake IPv6 host
address/link layer pairing. Listening neighbors will introduce this not
requested pairing in their neighbor cache; this is the equivalent of abused
Gratuitous ARP in IPv4.
Those, are only a subset of the attacks that can be executed against an IPv6
implementation. For more, please refer to the following resources:
1. https://www.ripe.net/support/training/material/ipv6-
security/ipv6security-slides.pdf
2. https://www.blackhat.com/docs/sp-14/materials/arsenal/sp-14-
Schaefer-Workshop-Slides.pdf
3. https://www.tno.nl/media/3274/testing_the_security_of_ipv6_imple
mentations.pdf
5. Conversation Multiplexing
TCP
- Transmission Control Protocol. Enables reliable communication between
processes running on separate hosts and provides reliable, acknowledged
transmissions that confirm successful delivery. (segments) (Connection-
Oriented=must first establish a connection between the sender and the receiver)
TCP provides reliability and flow control using these basic operations:
An individual server cannot have two services assigned to the same port
number within the same transport layer services.
It verifies that the destination device has an active service and is accepting
requests on the destination port number that the initiating client intends to
use.
It informs the destination device that the source client intends to establish a
communication session on that port number.
TCP Retransmission
Live video and voice applications can tolerate some data loss with minimal or
no noticeable effect, and are perfectly suited to UDP.
The socket is used to identify the server and service being requested by the
client
One of the ways using which the venerable Nmap tool tries to perform OS
fingerprinting, is by examining the Initial Sequence Numbers (ISNs)
generated by the target host (after connections are being attempted to a
listening port).
Each TCP/IP stack (and subsequently each OS) features its own way of
generating Initial Sequence Numbers.
Nmap repeatedly used the ISN from the scanning host, while scanning the
different ports of the remote host.
when sending a SYN request to Port 0 if the host responds with RST, ACK then
it’s alive
an existing TCP connection can be cut apart through a crafted TCP RST packet
sent either to the client or the server.
the attacker spoofed the src ip and sent a TCP RST packet to the server ti
cut the connection.
Telnet offers no encryption and thus, we can see every command the client
issued and every result returned by the server in clear text.
It looks like an attacker has taken over (hijacked) the whole Telnet session.
This is also apparent in packet #17, that includes the MAC address of the
attacker and the
command the attacker issued (uname –a)
The server has no defense mechanism to detect that the Telnet session is
hijacked and sends the output of the uname –a command back to the
192.168.1.4 client.
https://www.scip.ch/en/?labs.20150305
TCP/IP stacks, support a subset of the available TCP options and also, perform
TCP option storing in their own unique order. Nmap leverages the above (and
other things), in order to perform OS fingerprinting.
https://nmap.org/nmap-fingerprinting-article.txt
UDP-based attacks
DNS Command & Control, DNS exfiltration (to be disscused)
ICMP Abuse
1. ICMP Echo Request (8)
4. Smurf Attack(DDoS)
is executed as follows:
3. all hosts on the network will send an ICMP echo reply to the target server
causing it to get down
5. ICMP Tunneling
Numerous ICMP tunneling solutions exists, but attackers seem to prefer the
ptunnel one.
An Echo request and the associated Echo reply should have the same length.
This isn’t the case in this capture file
The payload size in some ICMP packets is a lot bigger than normal. see
packet #16.
all ICMP packets of this capture file include the previously mentioned ptunnel
magic value (0xD5200880), inside the ICMP payload.
When two machines want to communicate with each other the router has to find
the shortest path between them.
If there is an alternate shorter path between the two machines then, the router
will send an ICMP redirect packet to the sender machine to change its routing
such ICMP redirect packets can be forged by an attacker and make the sender
host redirect its packet to an attacker-controlled or non-existing destination.
In those packets the router instructs the client 10.100.13.126 to make a change
in its routing table to use
the gateway 10.100.13.20 for all subsequent packets. At this moment, you
should check if the gateway 10.100.13.20 is a legitimate gateway.
If you filter the whole capture file, based on the MAC address of the router
(10.100.13.1) [eth.src==72:9b:2f:a0:90:91], you will notice that this MAC address
is associated with the 10.100.13.20 machine.
Even though it is not clearly visible in the capture file, every HTTP request can
now be sniffed by the 10.100.13.20 host, as a result of the ICMP Redirect attack.
Application Layer
Network Basic Input/Output System NetBIOS
a set of protocols developed in for Windows only in order to provide services for
the session layer
1. (NBNS) Name service (works over UDP port 137) for name registration and
name to IP address resolution.
2. (NBDS) Datagram distribution service (works over UDP port 138) for service
announcements by clients and servers.
3. (NBSS) Session service (works over TCP port 139) for session negotiation
between hosts. This is used for accessing files, opening directories, and so
on.
SMB
a protocol that is used for browsing directories, copying files, accessing services
such as printers, and several other operations over the network
SMB runs on top of the session layer protocols such as NetBIOS as originally
designed
Detection
SMB works in a client-server model
Code 0 means STATUS_OK, which implies that everything works fine and there
is no problem. Any other code should be examined.
HTTP
HTTP uses methods to perform various operations.
Packets 3-6 is the TCP Handshake. HTTP relies on TCP for reliability.
port 80 is used
we can see the content of the HTTP Stream with Follow -> Follow TCP Stream
Strangely, packet #56, and the packet after that, packet #73, don’t seem to
contain any SQL injection queries. Maybe he quit?
taking a closer look we found out that The User-Agent for this HTTP GET
Request is Sqlmap. So the attacker didn’t quit, he escalated.
Both the client and the server need to agree on the protocol version.
Both the client and the server need to select cryptographic algorithms.
The traffic is unreadable, but if this is internal traffic within our corporate
environment, then, it is feasible to decrypt this traffic using the private key from
the internal server.
it looks like we are dealing with a TLS Renegotiation Attack (DoS attack
against the TLS layer)
DNS tunnels