Common Network Attacks
Chapters and transcript
Common Network Attacks This is a normal office network. Staff laptops reach the internet through the router. Now imagine an attacker gets onto the same network. Could they listen to the traffic? In this lesson you will learn how attackers sniff traffic, sit in the middle, flood services and plug in rogue devices. And you will learn how defenders stop them.
How a LAN works First, how traffic moves on a local network, or LAN. Devices plug into a switch, a box with many network sockets. The router connects the LAN to the internet. Every network card has a MAC address, a hardware address. Inside a LAN, devices deliver traffic using these MAC addresses, not just IP addresses.
How a LAN works So how does a laptop find the MAC address for an IP address? It uses ARP. The laptop asks the whole LAN: who has 192.168.1.1? The router replies: I do, and here is my MAC address. The laptop saves the answer in its ARP table. But ARP was built for trusted networks. It has no authentication. Devices accept replies without checking them.
Sniffing Sniffing means capturing and reading network traffic as it passes. Tools such as Wireshark do this, and engineers use them every day to fix problems. What can a sniffer see? With unencrypted traffic, like plain HTTP, FTP or Telnet, usernames and passwords can be read directly. With encrypted traffic, like HTTPS, SSH or a VPN, it only sees who is talking, how much, and when.
Sniffing On a modern switched network, a computer normally only receives its own traffic. So a sniffer needs a special position, such as the same open Wi-Fi. Watch. A user logs in over plain HTTP. The attacker reads the password. Now the same user logs in over HTTPS. This time the attacker sees only scrambled data.
Man-in-the-middle In a man-in-the-middle attack, the attacker secretly sits between two parties. Both sides think they are talking directly, but all traffic passes through the attacker. From the middle, they may try to read the traffic, change it, for example by inserting fake content into a plain HTTP page, steal session cookies to log in as the victim, or show a fake login page.
Man-in-the-middle The main defence is encryption with proper certificate checks. HTTPS uses a certificate to prove you are talking to the real website. If someone in the middle pretends to be the site, the browser shows a warning, like this one on a bank login. Never click through a certificate warning on a banking site, a JazzCash or Easypaisa page, or a company login. Go back instead.
ARP spoofing ARP spoofing uses the ARP weakness. The attacker sends false replies. To the victim: the router IP belongs to my MAC. To the router: the victim IP belongs to my MAC. Both devices update their ARP tables with the false entries. Now traffic flows through the attacker, who passes it on so nothing seems broken. This only works from inside the same local network.
ARP spoofing How do defenders stop it? Dynamic ARP Inspection, on many managed switches, checks ARP replies against a trusted list and drops false ones. Encryption, like HTTPS, SSH and VPNs, keeps captured traffic unreadable. Segmentation stops an attacker on one part of the network from reaching others. And monitoring can alert when one MAC address suddenly claims many IP addresses.
Denial of service A denial of service attack does not steal anything. Its goal is to make a service unavailable. In a distributed attack, a DDoS, many machines attack at once. Often they are a botnet: infected computers, cameras and home routers controlled by one attacker. They flood the website with traffic. The link fills up, and real users are turned away.
Denial of service Compare the two. A DoS comes from one machine or connection, so you can block the source. A DDoS comes from many machines, so you cannot simply block one IP. A small company cannot stop a large DDoS with its own firewall, because the internet link fills up first. Help comes upstream: the internet provider, a DDoS protection service, or a CDN that spreads the load.
Rogue devices A rogue device is any device connected without permission. Here, someone plugged a Wi-Fi access point into an office socket. It creates a back door into the wired network. Not every rogue device is malicious, but nobody patches or watches it. With 802.1X, a device must prove its identity first, so the switch refuses the unknown device.
Try it yourself You can safely look at your own ARP table. On Windows or Linux, type arp dash a. On Linux, ip neigh is the modern way. You see IP addresses with their MAC addresses. The router IP should map to one MAC address. If two different IPs share the router MAC unexpectedly, that can be a sign of ARP spoofing.
Quick check Quick check. You run arp dash a on your office laptop. Two different IP addresses show the same MAC address as the router. What should you think, and what should you do? Choose an answer.
Key takeaways Let us put it together. Encrypt everything, and retire Telnet, FTP and plain HTTP logins. Never ignore certificate warnings on important sites. Protect the LAN: lock network cabinets and disable unused sockets. Use managed switches with Dynamic ARP Inspection and port security. Plan for DDoS with your provider before an attack. And know which devices are on your network. Only run tools like Wireshark on networks you own or may test.
In the Linux and Networking path you learned about IP addresses, ports and scanning. Now we look at what attackers do once they can reach a network, and how defenders stop them. Everything here is at concept level, so you can recognise these attacks and defend against them.
How traffic moves on a local network
A local network (or LAN, local area network) is the network inside one home or office. Devices on it connect to a switch (a box with many network sockets) or to a Wi-Fi access point. The router connects the LAN to the internet.
Every network card has a MAC address, a hardware address such as aa:bb:cc:11:22:33. Inside a LAN, devices deliver traffic using MAC addresses, not just IP addresses. So a computer needs a way to find the MAC address that belongs to an IP address.
That job is done by ARP (Address Resolution Protocol). A computer asks the whole LAN: "Who has 192.0.2.1?" The device with that IP replies: "I do, my MAC address is aa:bb:cc:11:22:33." The computer saves the answer in its ARP table (also called the ARP cache).
ARP was designed decades ago for trusted networks. It has no authentication. A device accepts ARP replies without checking whether they are true. Keep this in mind, because several attacks depend on it.
Sniffing
Sniffing means capturing and reading network traffic as it passes. Tools such as Wireshark do this, and network engineers use them every day to fix problems. The same ability helps an attacker.
What can a sniffer see?
- Unencrypted traffic: websites using plain HTTP, FTP and Telnet logins, and old email protocols. Usernames, passwords and messages can be read directly.
- Encrypted traffic: with HTTPS, SSH or a VPN, the sniffer only sees which IP addresses are talking, how much data moves, and when. The content is unreadable.
On a modern switched network, a computer normally only receives traffic meant for it. To sniff other people's traffic, an attacker usually needs to be in a special position: on the same open Wi-Fi network, on a compromised router, or in the middle of the connection using one of the tricks below.
Man-in-the-middle
In a man-in-the-middle (MITM) attack, the attacker secretly places themselves between two parties. Both sides think they are talking directly to each other, but all traffic passes through the attacker.
From the middle, an attacker may try to:
- Read the traffic (sniffing)
- Change it, for example by inserting fake content into a plain HTTP page
- Steal session cookies and log in as the victim
- Show a fake login page that looks like the real one
There are several ways to get into the middle. ARP spoofing on a LAN is one. A fake Wi-Fi hotspot is another, and you will meet it in the Wi-Fi lesson. Changing the DNS settings on a weak home router is a third.
The main defence is encryption with proper certificate checks. HTTPS uses a certificate to prove that you are talking to the real website. If someone in the middle tries to pretend to be the site, the browser shows a certificate warning. This is why you must never click through a certificate warning on a banking site, JazzCash or Easypaisa page, or company login.
ARP spoofing
ARP spoofing (also called ARP poisoning) uses the weakness you saw earlier. The attacker sends false ARP replies on the LAN:
- To the victim: "The router's IP address belongs to my MAC address."
- To the router: "The victim's IP address belongs to my MAC address."
- Both devices update their ARP tables with the false entries.
- Traffic between the victim and the internet now flows through the attacker's machine, who passes it on so nothing seems broken.
The attacker is now a man in the middle. This only works from inside the same local network, which is why physical security and Wi-Fi security matter so much.
Defences include:
- Dynamic ARP Inspection, a feature on many managed switches that checks ARP replies against a trusted list and drops false ones
- Encryption (HTTPS, SSH, VPN), so captured traffic is unreadable even if spoofing succeeds
- Network segmentation, so an attacker on one part of the network cannot reach others (covered in the next lesson)
- Monitoring tools that alert when one MAC address suddenly claims many IP addresses
Denial of service: DoS and DDoS
A denial of service (DoS) attack does not steal anything. Its goal is to make a website or service unavailable, which attacks the availability part of the CIA triad. The attacker sends so much traffic, or so many requests, that the server or its internet link cannot cope, and real users are turned away.
A distributed denial of service (DDoS) attack uses many machines at once. Often these are part of a botnet: thousands of infected computers, cameras and home routers controlled by one attacker. Because the traffic comes from so many addresses, you cannot simply block one IP.
| Type | Source | How hard to block |
|---|---|---|
| DoS | One machine or connection | Easier: block the source |
| DDoS | Many machines, often a botnet | Hard: needs help upstream |
A small company cannot stop a large DDoS with its own firewall, because the internet link fills up before traffic even reaches the firewall. Defence usually comes from upstream: the internet service provider, a DDoS protection service, or a content delivery network (CDN) that spreads the load across many servers. Some attackers use DDoS to demand money, or to distract staff while another attack happens.
Rogue devices
A rogue device is any device connected to a network without permission. Examples:
- A rogue access point: a Wi-Fi device plugged into an office socket, which creates a back door into the wired network
- A small computer hidden behind a desk, giving an attacker remote access
- An employee's personal router or laptop that nobody manages or updates
Not every rogue device is malicious. Often a staff member simply wanted better Wi-Fi in their room. But any unmanaged device is a risk, because nobody patches it or watches it.
Defences include keeping a list of known devices, disabling unused network sockets, and using port security or 802.1X network access control. 802.1X makes a device prove its identity before the switch lets it onto the network.
How to defend
Most of these attacks become much harder with a few habits:
- Encrypt everything. Use HTTPS, SSH and SFTP, and retire Telnet, FTP and plain HTTP logins.
- Never ignore certificate warnings on important sites.
- Protect the LAN. Lock network cabinets, disable unused sockets and use strong Wi-Fi security.
- Use managed switches with features such as Dynamic ARP Inspection and port security where possible.
- Plan for DDoS with your provider before an attack happens, if your website is important to the business.
- Know your devices. Check regularly which devices are on the network.
You can safely look at your own ARP table. On Windows, open Command Prompt; on Linux, open a terminal:
arp -a # Windows and Linux: show the ARP table
ip neigh # Linux: the modern way to show neighbours
You will see IP addresses with their MAC addresses. Your router's IP should map to one MAC address. If two different IPs share the router's MAC address unexpectedly, that can be a sign of ARP spoofing. Only run tools like Wireshark on networks you own or have written permission to test. Capturing other people's traffic without permission is illegal in most countries.
Check your understanding
Answer every question correctly to complete this lesson. If you miss one, try the quiz again.
1. On a shared office network, an attacker tells every computer that the router's IP address belongs to the attacker's MAC address. What is this attack called?
2. What is the main difference between a DoS attack and a DDoS attack?
3. An employee finds a small unknown device plugged into a network socket behind the reception desk. What is the best first step?
Locked: answer every quiz question above correctly to complete this lesson.
Spotted a mistake or something unclear? Report a mistake