Common Network Attacks: DoS, Spoofing, and MITM
Identify denial-of-service, IP/ARP spoofing, and man-in-the-middle attacks, and understand the network controls that detect or prevent each.
Common Network Attacks: DoS, Spoofing, and MITM is a free Cloud & IT Cert Prep lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cloud & IT Cert Prep learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Denial-of-Service Attack Fundamentals
A Denial-of-Service (DoS) attack aims to make a system, service, or network unavailable to legitimate users by overwhelming it with traffic or exploiting a vulnerability that causes it to crash. DoS attacks target the Availability pillar of the CIA triad. A single-source DoS is relatively easy to block by rate-limiting the source IP; however, many modern attacks use multiple sources simultaneously to make mitigation much harder.
Distributed Denial-of-Service (DDoS)
A DDoS attack uses thousands or millions of compromised devices (a botnet) to flood a target from many different source addresses simultaneously. This makes blocking by source IP impractical. DDoS attacks are categorized as volumetric (floods bandwidth, e.g., UDP flood), protocol (exhausts stateful resources, e.g., SYN flood), or application-layer (exhausts server capacity with valid-looking HTTP requests, e.g., Slowloris). Mitigation services like Cloudflare, Akamai, and AWS Shield absorb volumetric attacks before they reach the origin.
# Types of DDoS attacks:
# Volumetric: UDP flood, ICMP flood, DNS amplification
# Protocol: SYN flood, Ping of Death, Smurf attack
# Application: HTTP flood, Slowloris, R.U.D.Y
# SYN flood defense: SYN cookies
# sysctl -w net.ipv4.tcp_syncookies=1Amplification and Reflection Attacks
Amplification attacks exploit protocols that produce much larger responses than the initial request. DNS amplification uses a small UDP query to generate a response up to 70x larger, all directed at the victim. NTP monlist amplification can achieve a 4,000x amplification factor. The attacker spoofs the victim's IP as the source address so that thousands of reflectors send their large replies to the victim — this is why it is also called a reflection attack. Mitigation includes BCP38 (ISP-level source address validation) and disabling amplification services.
# DNS amplification example:
# Attacker sends 40-byte query for 'ANY example.com'
# Spoofed source: victim's IP (1.2.3.4)
# Open DNS resolver replies with 3000-byte response to victim
# With 1000 reflectors: 40KB request -> 3GB response to victim
# Disable NTP monlist (amplification mitigation):
# ntpdc -c 'disable monitor'IP Spoofing
IP spoofing is the act of crafting packets with a forged source IP address. Spoofing is used in DoS/DDoS reflection attacks, to bypass IP-based access control lists, and to disguise the attacker's true location. Raw socket privileges are required to send spoofed packets. Defenses include ingress filtering (BCP38), which instructs ISPs and routers to drop packets arriving on an interface with a source IP that could not legitimately originate from that network. Stateful firewalls also help by rejecting unsolicited inbound packets that do not match established sessions.
# BCP38 ingress filtering on a router:
# If a packet arrives on the Internet-facing interface
# with a source IP from the internal RFC1918 range,
# it is clearly spoofed and should be dropped.
ip access-list extended ANTI-SPOOF
deny ip 10.0.0.0 0.255.255.255 any
deny ip 172.16.0.0 0.15.255.255 any
deny ip 192.168.0.0 0.0.255.255 any
permit ip any anyARP Spoofing (ARP Poisoning)
ARP spoofing (also called ARP poisoning) involves sending unsolicited ARP replies that associate the attacker's MAC address with a legitimate IP address. Hosts that receive the fake ARP update their ARP cache and send traffic destined for that IP to the attacker's MAC address instead. This enables man-in-the-middle attacks on local segments. Tools like Arpspoof, Ettercap, and Bettercap automate this attack. Defenses include Dynamic ARP Inspection (DAI) on managed switches, which validates ARP packets against a trusted DHCP snooping binding table.
# Attack: ARP spoof (attacker poisons victim and gateway)
# arpspoof -i eth0 -t 192.168.1.10 192.168.1.1
# Defense: Dynamic ARP Inspection on a Cisco switch
ip arp inspection vlan 10
ip dhcp snooping vlan 10
# Verify DAI:
show ip arp inspection vlan 10Man-in-the-Middle (MitM) Attacks
A man-in-the-middle (MitM) attack occurs when an attacker secretly relays and potentially alters communications between two parties who each believe they are communicating directly. MitM can be achieved through ARP spoofing, DNS spoofing, rogue Wi-Fi access points, or BGP route hijacking. Once positioned in the middle, the attacker can eavesdrop, inject content, strip encryption (SSL stripping), or replay credentials. The key defense is mutual authentication and encryption — TLS with valid certificates prevents most MitM attacks because the client can verify the server's identity.
# SSL stripping attack flow:
# 1. Victim requests http://bank.com
# 2. Attacker intercepts, upgrades to HTTPS with bank.com
# 3. Attacker maintains HTTP connection with victim
# 4. Victim sees HTTP; attacker sees plaintext credentials
# Defense: HTTP Strict Transport Security (HSTS)
# Strict-Transport-Security: max-age=31536000; includeSubDomainsDNS Spoofing and Cache Poisoning
DNS cache poisoning injects malicious DNS records into a resolver's cache so that legitimate domain names resolve to attacker-controlled IP addresses. The classic Kaminsky attack (2008) exploited predictable transaction IDs to poison resolvers at scale. When a user's resolver is poisoned, they are redirected to fake sites that may steal credentials or serve malware. DNSSEC (DNS Security Extensions) digitally signs DNS records so resolvers can verify authenticity, and DNS over HTTPS (DoH) prevents on-path interception of queries.
# Check if a domain has DNSSEC enabled:
dig +dnssec example.com
# Valid DNSSEC response includes RRSIG records
# If DNSSEC is enabled and signatures are invalid,
# a validating resolver will return SERVFAIL (rejects poisoned records)On-Path vs Off-Path Attackers
An on-path (in-path) attacker has a network position that allows them to see and modify traffic in transit — they are physically or logically between the two communicating endpoints. ARP spoofing creates an on-path position on a local segment. An off-path attacker cannot see the traffic but may attempt blind attacks, such as injecting spoofed TCP RST packets to tear down connections using guessed sequence numbers. TLS mitigates both scenarios because even if traffic is intercepted, it cannot be decrypted or forged without the private key.
BGP Hijacking
BGP (Border Gateway Protocol) hijacking occurs when a malicious or misconfigured Autonomous System announces more-specific IP prefixes to attract traffic destined for another organization. This can redirect internet-wide traffic through an attacker's network. BGP hijacking has been used to intercept cryptocurrency transactions, steal email, and redirect bank traffic. Defenses include RPKI (Resource Public Key Infrastructure), which cryptographically validates route origin authorizations, and monitoring BGP announcements for unexpected changes.
SYN Flood Attack and Defenses
A SYN flood exploits the TCP three-way handshake by sending many SYN packets with spoofed source IPs, causing the server to allocate state for half-open connections (waiting for ACKs that never arrive). The server's connection table fills up and it cannot accept new legitimate connections. Defenses include SYN cookies (server encodes state in the SYN-ACK's sequence number and only allocates resources after the ACK is received), reducing the SYN timeout, and rate-limiting SYN packets per source address.
# Enable SYN cookies on Linux:
sysctl -w net.ipv4.tcp_syncookies=1
# Reduce SYN-RECEIVED timeout:
sysctl -w net.ipv4.tcp_synack_retries=2
# Rate-limit SYN packets with iptables:
iptables -A INPUT -p tcp --syn -m limit --limit 10/s -j ACCEPT
iptables -A INPUT -p tcp --syn -j DROPDetecting and Responding to Network Attacks
Detecting DoS, spoofing, and MitM attacks requires visibility at multiple points. NetFlow/IPFIX data reveals sudden traffic spikes from many sources. SIEM correlation rules can alert on anomalous ARP activity (one MAC claiming many IPs) or DNS responses with suspiciously short TTLs. IDS/IPS signatures detect SYN floods and ARP spoofing tools. Response actions include rate-limiting at edge routers, activating DDoS scrubbing services, isolating affected segments, and re-enabling dynamic ARP inspection or flushing poisoned caches.
# Detect ARP poisoning:
arp -n | awk '{print $3}' | sort | uniq -d
# Duplicate MACs for different IPs = possible ARP spoofing
# Monitor for SYN flood:
netstat -n | awk '/SYN_RECV/ {count++} END {print count}'
# Check NetFlow for DDoS:
# Look for high packet-per-second rates from diverse source IPsQuick Check
Test your understanding of CompTIA Security+ (SY0-701) concepts from this lesson.
Lesson Recap
In this lesson you learned: DDoS attacks use botnets to overwhelm targets from many sources and are categorized as volumetric, protocol, or application-layer, ARP spoofing poisons local network caches to enable MitM attacks and is mitigated by Dynamic ARP Inspection, and SYN floods exhaust server connection state and are defended with SYN cookies and rate-limiting. Next up we explore Wi-Fi security protocols from WEP through WPA3.
Frequently asked questions
Is the “Common Network Attacks: DoS, Spoofing, and MITM” lesson free?
Yes — the full text of “Common Network Attacks: DoS, Spoofing, and MITM” is free to read here on the web, and the Cloud & IT Cert Prep course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cloud & IT Cert Prep course, upgrade to CoddyKit PRO.
What will I learn in “Common Network Attacks: DoS, Spoofing, and MITM”?
Identify denial-of-service, IP/ARP spoofing, and man-in-the-middle attacks, and understand the network controls that detect or prevent each. You practise Cloud & IT Cert Prep with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Cloud & IT Cert Prep?
No prior experience is required. Cloud & IT Cert Prep on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Common Network Attacks: DoS, Spoofing, and MITM” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Cloud & IT Cert Prep lesson?
Yes. Every Cloud & IT Cert Prep lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- TCP/IP Model and Common Ports
- Firewalls: Packet Filtering vs Next-Gen
- Network Segmentation and VLANs
- Common Network Attacks: DoS, Spoofing, and MITM