Network Attacks and Defences: Sniffing, ARP and DNS Spoofing, DDoS

Networks were designed for connectivity first and security second, which is why many foundational protocols trust participants by default. Attackers take advantage of that trust. In this lesson we study common network attacks in principle, how to recognise them in traffic and logs, and the controls that stop them. The focus is understanding and defence; observation exercises are limited to your own lab.

Eavesdropping (Sniffing)

How it works: anyone who can see network traffic can read it if it is not encrypted. On shared or compromised networks, such as open Wi-Fi, an attacker may capture passwords, session cookies and messages sent in cleartext.

Defences:

  • Use encryption everywhere: HTTPS (TLS), SSH, SFTP, VPN; avoid Telnet, FTP and plain HTTP.
  • Use modern Wi-Fi security (WPA3, or WPA2 with strong passphrases and enterprise authentication).
  • Segment networks and use switched, not shared, infrastructure.

Lab observation: in your own lab, capture a login to a practice web app over HTTP and over HTTPS using Wireshark, as in Networking for Security. The difference is the entire argument for encryption.

Man-in-the-Middle (MitM)

In a man-in-the-middle attack, an attacker positions themselves between two parties and can read or modify the traffic. Ways this can happen include rogue Wi-Fi access points, abuse of local network protocols and compromised network devices.

ARP spoofing (local networks)

ARP maps IP addresses to MAC addresses and has no authentication. An attacker on the same local network can send false ARP replies so that other machines send their traffic through the attacker. Because it only works on the same local segment, it matters most on shared Wi-Fi and flat office networks.

Detection: the neighbour table suddenly shows two IP addresses mapping to the same MAC address, or the gateway’s MAC changes unexpectedly. You can inspect your own table safely:

ip neigh              # Linux: IP to MAC mappings
arp -a                # Windows and macOS

Defences: Dynamic ARP Inspection and DHCP snooping on managed switches, port security, network segmentation, 802.1X, static ARP entries for critical gateways, and above all end-to-end encryption (TLS) so intercepted traffic is useless. Tools such as arpwatch can alert on changes.

DNS attacks

  • DNS spoofing and cache poisoning: inserting false answers so users are sent to attacker-controlled servers. Defences: DNSSEC validation, randomised source ports and query IDs (standard in modern resolvers), up-to-date DNS software and trusted resolvers.
  • DNS hijacking: changing DNS settings on a router, device or at the registrar. Defences: strong router credentials, registrar account MFA and registry locks, monitoring DNS records for changes.
  • DNS tunnelling: hiding data in DNS queries to bypass controls. Defences: DNS logging, monitoring for unusually long or high-volume queries and restricting which resolvers hosts may use.
  • Encrypted DNS (DNS over HTTPS and DNS over TLS) protects queries from local eavesdropping, but also shifts where monitoring happens, so enterprises plan for it.

Other interception risks

  • SSL stripping and downgrade attacks: forcing a connection back to HTTP. Defence: HSTS and HTTPS-only sites.
  • Rogue DHCP servers: handing out malicious gateway or DNS settings. Defence: DHCP snooping.
  • Rogue access points and “evil twin” Wi-Fi: see Wi-Fi and Wireless Security.
  • Session hijacking: stealing or predicting session tokens. Defences: secure cookies, short sessions, HTTPS; see Broken Access Control and Session Flaws.

Denial of Service and DDoS

A denial-of-service (DoS) attack tries to make a service unavailable. When the traffic comes from many sources, often compromised devices in a botnet, it is a distributed denial of service (DDoS). Attackers use DDoS for extortion, distraction, activism or competitive harm.

CategoryTargetConceptMitigation
VolumetricBandwidthOverwhelm the connection with sheer traffic, sometimes amplified through misconfigured third-party serversUpstream scrubbing, CDN and anycast absorption, ISP cooperation
ProtocolNetwork devices and servers (layers 3 and 4)Exhaust state tables or connection resources, such as half-open TCP connectionsSYN cookies, rate limiting, hardened devices, DDoS protection services
Application layerWeb servers and APIs (layer 7)Many seemingly legitimate requests to expensive operationsWAF, rate limiting, caching, bot detection, CAPTCHAs, autoscaling

Preparing for DDoS:

  1. Put internet-facing services behind a CDN or DDoS protection provider.
  2. Design for scale and redundancy, with caching and autoscaling where possible.
  3. Rate-limit expensive endpoints and login pages.
  4. Hide origin server addresses and allow only the protection provider to reach them.
  5. Prepare a DDoS runbook with provider contacts and escalation steps.
  6. Monitor baseline traffic so you can recognise abnormal spikes quickly.
  7. Do not let your own devices join botnets: change default credentials on routers and IoT devices, update firmware and disable unneeded remote access.

Never test DDoS tools against systems you do not own. “Stress testing” services for hire are illegal when used against others, and in a lab, a flood can crash your own virtual network.

Port Scanning and Reconnaissance

Attackers scan networks to learn what services are exposed. Scanning is covered ethically in Network Scanning and Enumeration With Nmap. Defensive responses include closing unused ports, firewalling by default, intrusion detection alerts for scan patterns and not exposing management interfaces to the internet.

Other Network-Level Threats

  • IP spoofing: forging source addresses; mitigated with ingress and egress filtering (anti-spoofing rules).
  • Replay attacks: re-sending captured valid messages; mitigated with nonces, timestamps and encryption.
  • VLAN hopping and MAC flooding: switch-level attacks mitigated by correct switch configuration and port security.
  • Lateral movement on flat networks: mitigated by segmentation; see Firewalls, IDS/IPS and Network Segmentation.

Defender’s Network Checklist

  1. Encrypt data in transit; ban cleartext protocols.
  2. Segment networks and apply default-deny firewall rules.
  3. Enable switch security features: port security, DHCP snooping, dynamic ARP inspection.
  4. Use secure DNS configurations and monitor DNS logs.
  5. Deploy IDS/IPS and collect flow and packet metadata.
  6. Protect against DDoS with CDN, rate limits and a runbook.
  7. Harden and patch routers, switches and firewalls, and change default credentials.

Practice Exercises

  1. Record the output of ip neigh on your lab VM. Note your gateway’s MAC address. How would you notice if it changed?
  2. In Wireshark, capture an HTTP login and an HTTPS login in your lab. List what an eavesdropper can see in each.
  3. For each DDoS category, choose one mitigation and explain why it fits.
  4. Write a short policy listing which protocols your organisation will forbid on its network and the secure replacement for each (for example, Telnet to SSH).
  5. Explain why TLS defeats most man-in-the-middle attacks even when the attacker controls the network.

Mentor tip: Assume the network is hostile. If your design stays safe when an attacker sits on the same Wi-Fi, you are close to a zero-trust mindset, the design philosophy covered later in this series.

Educational use only: observe and test only networks you own or have written permission to assess. This lesson explains attack concepts for defence, not step-by-step attack instructions.

Key takeaways
  • Cleartext protocols and weakly authenticated local protocols (ARP, DHCP, DNS) enable sniffing and man-in-the-middle attacks.
  • Encryption end to end (TLS, SSH, VPN) neutralises most interception.
  • Switch features, DNSSEC and monitoring detect and block local-network and DNS attacks.
  • DDoS is mitigated by CDNs, scrubbing, rate limiting and runbooks prepared in advance.
  • Test only your own lab.

Related Lessons