SyntaxPilot
Courses/Cybersecurity Fundamentals/Lesson 23

Cybersecurity Fundamentals · Lesson 23 of 90 · 18 min

Network attacks conceptually, and their defences

sniffingARP spoofingMAC floodingrogue DHCPVLAN hoppingsession hijackingDoSDDoSvolumetric vs protocol vs application-layer DDoSreflection and amplificationbotnets in DDoSDDoS mitigation servicesport securityDHCP snooping

These are the notes for Cybersecurity Fundamentals (defensive), episode 23. Last episode TLS protected what is inside a connection. Today we look at attacks on the network itself, and we invent, one problem at a time, the features that stop them: sniffing and MAC flooding (stopped by port security), ARP spoofing (stopped by Dynamic ARP Inspection), rogue DHCP (stopped by DHCP snooping and its binding table), VLAN hopping and session hijacking, DoS and DDoS in their three kinds (volumetric, protocol, application-layer), botnets, reflection and amplification (stopped at the source by BCP 38), rate limiting and DDoS mitigation services, and finally lies told to the internet's own routing map, BGP hijacking, stopped by RPKI. Every term is explained the first time it appears, and the Glossary at the end defines them all again.

Everything here is conceptual and defensive. Every attack is a tiny toy simulation in plain Python: no packets are sent, nothing touches a real network, and you will never need more than a dictionary and a loop to see why the attack works and why the fix works. All hosts, MAC addresses (gw:01, evil:66 are toy labels, not real MAC format), IP prefixes and AS numbers are made up, taken from private or documentation-only ranges. Every code sample runs with Python 3.13 using only the standard library; outputs are real, copied from actual runs.

The problems you'll solve

Problem Idea it teaches
Someone listens in Sniffing, hub, switch, frame, MAC table, MAC flooding, port security
Someone pretends to be the router ARP, ARP cache, gateway, ARP spoofing, man-in-the-middle, Dynamic ARP Inspection
A fake receptionist hands out addresses DHCP, rogue DHCP, DHCP snooping, trusted ports, binding table
Jumping between networks, stealing logins VLAN, trunk, tag, native VLAN, switch spoofing, double tagging, VLAN hopping, session hijacking
A flood knocks you offline DoS, DDoS, botnet, volumetric vs protocol vs application-layer attacks
Tiny request, giant reply Spoofing, reflection, amplification, bandwidth amplification factor, BCP 38
5,000 polite bots Rate limiting, DDoS mitigation services, scrubbing centre, anycast, blackhole routing
The internet's map is wrong Autonomous system, ASN, BGP, prefix, longest prefix match, BGP hijacking, RPKI, ROA, maxLength, Valid / Invalid / NotFound

Problem 1: sniffing and MAC flooding

Shouting in a hall vs a sorting clerk

Think of an office where every letter is announced over a loudspeaker to the whole hall. Everyone hears everything. Now think of an office with a clerk who keeps a notebook: "Asha sits at desk 1, Ravi at desk 2", and walks each letter to one desk only.

  • A frame (episode 17) is one chunk of data on the local network, addressed by MAC address, the hardware address of a network card.
  • A hub is the loudspeaker: an old, simple box that repeats every frame out of every port (every socket you plug a cable into).
  • A switch is the clerk. It keeps a MAC table: which MAC address lives on which port. It learns by looking at the sender of every frame ("a frame from asha:20 came in on port 1, so Asha is on port 1"), then delivers each frame only to the owner's port.
  • Sniffing means capturing traffic that was not meant for you. On a hub it is trivial: you receive everything anyway. On a switch you only see your own traffic, plus anything sent to everyone (a broadcast).

Sniffing is not always evil: network teams capture traffic legitimately to troubleshoot, with tools like Wireshark. The question for a defender is: how could someone on a switch get everyone's traffic?

The weak spot: a full notebook

A switch's MAC table is finite. And when a frame arrives for a MAC address the switch does not know, it floods it to every port, just in case (exactly like a hub). So if an attacker fills the table with fake addresses, real devices can't be learned, and their traffic floods everywhere. That is MAC flooding.

Demo 1: a toy switch, with and without port security

The toy table has room for only 8 addresses (real ones hold thousands, but they are still finite). The attacker on port 3 sends 1,000 frames, each from a made-up MAC. Then Asha joins on port 1.

def run(port_security):
    table, SIZE = {}, 8                             # the switch's MAC table: MAC -> port (tiny, for the demo)
    def frame(src, dst, port):
        if port_security and port == 3 and src not in table and sum(p == 3 for p in table.values()) >= 2:
            return "dropped, port 3 shut down"      # port security: at most 2 MACs on port 3
        if src not in table and len(table) < SIZE: table[src] = port      # learn where src lives
        return f"port {table[dst]} only" if dst in table else "ALL ports (flooded)"
    frame("gw:01", "ff:ff", port=2)                 # the gateway (router) speaks once
    for i in range(1000):                           # the attacker: 1000 frames from made-up MACs
        frame(f"fake:{i:03}", "gw:01", port=3)
    frame("asha:20", "gw:01", port=1)               # Asha arrives... is there room to learn her?
    print("port security:" if port_security else "no protection:", f"table {len(table)}/{SIZE} full,",
          "gateway -> Asha goes to", frame("gw:01", "asha:20", port=2))
run(port_security=False)
run(port_security=True)

Output:

no protection: table 8/8 full, gateway -> Asha goes to ALL ports (flooded)
port security: table 4/8 full, gateway -> Asha goes to port 1 only
  • No protection: the table is 8 out of 8, full of fakes. There is no room to learn Asha, so every frame for her floods to all ports, including the attacker's. The switch now behaves like a hub.
  • Port security: the switch allows at most 2 MAC addresses on port 3. The third new one is dropped and the port shut. The table holds only 4 entries (the gateway, two fakes, Asha), Asha is learned, and her frames go to port 1 only.

Port security

Port security is a switch feature that limits how many MAC addresses one port may use, often just 1 or 2, because a desk usually has one computer.

  • Sticky mode remembers the first device's MAC address it sees on the port and refuses others.
  • On a violation the switch can shut the port (and alert someone), or quietly drop and log the extra frames.
  • Disable unused ports outright, so a stranger can't simply plug in, and alert on "table full" events.
  • And the deeper defence is last episode's: if traffic is encrypted with TLS, a sniffer only captures gibberish.

Problem 2: ARP spoofing

"Who sits at desk 1?" "Me!"

Port security stops the flood, so the attacker changes plan. Recall ARP, the Address Resolution Protocol (episode 18). Asha's laptop knows the gateway's IP address, 192.168.1.1 (the gateway is the router that leads out of the local network to the internet), but it needs the gateway's MAC address to send frames. So it shouts to everyone:

  1. ARP request: "Who has 192.168.1.1?"
  2. ARP reply: the real gateway answers "Me, at MAC gw:01." The laptop stores this in its ARP cache, its little notebook of IP → MAC.
  3. The lie: ARP has no proof at all. Anyone can answer, even without being asked: "The gateway is me, evil:66!", sent again and again.

Lying in ARP replies to redirect traffic is called ARP spoofing (or ARP poisoning, because it poisons the cache).

Demo 2: plain ARP vs Dynamic ARP Inspection

A toy ARP cache. Asha's laptop correctly maps the gateway to gw:01. Then a fake reply arrives saying the gateway is at evil:66. First plain ARP, then with Dynamic ARP Inspection (DAI), which checks each reply against a table of who really has which address.

BINDINGS = {"192.168.1.1": "gw:01", "192.168.1.20": "asha:20"}  # DHCP snooping's table: IP -> real MAC

def arp_reply(cache, ip, mac, dai):        # an ARP reply arrives: "ip is at mac"
    if dai and BINDINGS.get(ip) != mac:    # Dynamic ARP Inspection checks it first
        return f"DROPPED by DAI: {ip} is not at {mac}"
    cache[ip] = mac                        # plain ARP just believes it
    return f"cache updated: {ip} is at {mac}"

for dai in (False, True):
    asha_cache = {"192.168.1.1": "gw:01"}  # Asha's ARP cache: the gateway's MAC
    print("DAI on: " if dai else "DAI off:", arp_reply(asha_cache, "192.168.1.1", "evil:66", dai))
    print("         Asha's internet traffic now goes to", asha_cache["192.168.1.1"])

Output:

DAI off: cache updated: 192.168.1.1 is at evil:66
         Asha's internet traffic now goes to evil:66
DAI on:  DROPPED by DAI: 192.168.1.1 is not at evil:66
         Asha's internet traffic now goes to gw:01
  • DAI off: plain ARP believed it. Asha's internet traffic now goes to evil:66. The attacker can quietly forward everything on to the real gateway so nobody notices: that is the man-in-the-middle position from last episode (an attacker sitting between two parties, able to read or change what passes).
  • DAI on: dropped, because 192.168.1.1 is not at evil:66. The cache keeps gw:01.

Dynamic ARP Inspection is a switch feature that inspects every ARP message arriving on an untrusted port and drops any whose IP-to-MAC claim doesn't match a trusted record. But where does that trusted table (BINDINGS) come from? From the moment each device got its address. Which brings us to DHCP.

Problem 3: rogue DHCP

A fake receptionist hands out the badges

DHCP, the Dynamic Host Configuration Protocol (episode 18), is how a new device gets its settings. It shouts "I'm new, who gives me an address?", and a DHCP server answers with an offer: an IP address, the gateway to use, and the DNS server to use.

Now imagine a fake receptionist handing out visitor badges. A rogue DHCP server is an unauthorised one on the network: sometimes a misconfigured home router someone plugged in at their desk, sometimes an attacker's laptop. If it answers first, the new laptop uses the attacker as its gateway and its DNS server. Every packet and every name lookup goes to them, with no ARP lies needed. Laptops generally take the first offer that arrives.

Demo 3: offers with and without DHCP snooping

Two offers arrive: the rogue laptop on port 7, which answers first, and the real DHCP server through port 24, the uplink (the port that connects this switch toward the rest of the network, where the real server lives). With DHCP snooping, the switch lets offers in only from trusted ports.

offers = [("port 7",  "rogue laptop", "gateway 192.168.1.66, DNS 192.168.1.66"),   # answers first
          ("port 24", "real server",  "gateway 192.168.1.1, DNS 192.168.1.1")]
TRUSTED = {"port 24"}                     # DHCP snooping: only the uplink may send offers

def new_laptop(snooping):                 # DHCP: "I'm new, who gives me an address?"
    print("snooping on:" if snooping else "no snooping:")
    for port, who, settings in offers:
        if snooping and port not in TRUSTED:
            print(f"   switch drops the offer from {port} ({who})")
            continue
        print(f"   laptop accepts {who}: {settings}")   # the first offer wins
        return

new_laptop(snooping=False)
new_laptop(snooping=True)

Output:

no snooping:
   laptop accepts rogue laptop: gateway 192.168.1.66, DNS 192.168.1.66
snooping on:
   switch drops the offer from port 7 (rogue laptop)
   laptop accepts real server: gateway 192.168.1.1, DNS 192.168.1.1
  • No snooping: the laptop accepts the rogue: gateway and DNS 192.168.1.66.
  • Snooping on: the switch drops the offer from port 7, and the laptop gets the real settings.

DHCP snooping feeds DAI

DHCP snooping  ──►  binding table  ──►  Dynamic ARP Inspection
(trusted ports       (IP · MAC · port)    (checks every ARP reply
 only)                                     against the table)
  • DHCP snooping marks ports as trusted (uplinks toward the real DHCP server) or untrusted (user desks). DHCP offers from untrusted ports are dropped.
  • While it watches each real DHCP exchange, it writes down the result: this IP, this MAC, on this port. That record is the binding table.
  • DAI then checks every ARP reply against that table and drops the ones that don't match, exactly as in Demo 2.
  • Devices with fixed addresses, like printers and servers, never use DHCP, so their bindings are added by hand (static bindings).

One switch feature builds the facts; the next one uses them.

Problem 4: VLAN hopping and session hijacking

VLANs and trunks

Networks are often split into VLANs, virtual LANs: one physical switch divided into separate networks, say guests on one, payment terminals on another. Like one office building with separate locked floors.

  • An access port belongs to exactly one VLAN; the computer plugged into it doesn't even know VLANs exist.
  • Between switches, many VLANs share one link, called a trunk. Each frame on a trunk carries a small VLAN tag saying which VLAN it belongs to.
  • On a trunk, one VLAN is sent untagged: the native VLAN.

VLAN hopping: jumping the wall (conceptually)

VLAN hopping means reaching a VLAN you are not supposed to reach. Two ideas:

  • Switch spoofing: a computer pretends to be a switch, and some switches automatically agree to turn its port into a trunk, carrying every VLAN.
  • Double tagging: a frame carries two tags. The first switch strips the outer tag (it matches the native VLAN, which travels untagged), and the inner tag then carries the frame into another VLAN. It only works one way, but one way is enough to deliver something.

The defences are configuration:

  • Set every user port to access mode (one VLAN only).
  • Turn off automatic trunk negotiation on user ports.
  • Don't put users on the native VLAN; make the native VLAN an unused one.

Full segmentation design is next episode.

Session hijacking

Combine these attacks and you get session hijacking. In episode 21 a cookie carried a session ID, and anyone holding a copy became you. Session hijacking means stealing a valid session after the real user has logged in, so the attacker never needs the password.

How the ID leaks: over plain HTTP on a sniffed or ARP-spoofed network, or through malicious scripts in a page. Defences:

  • HTTPS everywhere with HSTS (the header that tells browsers "only ever use HTTPS for this site").
  • Cookies marked Secure (only sent over HTTPS) and HttpOnly (page scripts can't read them).
  • A brand-new session ID at login, short timeouts, and asking again before payments.

Episode 28 goes deep. The lesson: protect the session, not just the password.

Problem 5: DoS, DDoS and botnets

Blocking the shop's door

Some attackers don't want your data. They want you offline.

  1. One prankster stands in a shop's doorway. That is a denial-of-service attack (DoS): making a service unavailable to its real users. One source is easy to spot and block.
  2. Now 5,000 fake customers arrive at once from every direction. That is distributed denial of service (DDoS): the flood comes from many machines, so there is no single source to block.
  3. Where do thousands of machines come from? A botnet: a crowd of hacked devices, the bots, all obeying one controller.

On 21 October 2016, the Mirai botnet, made of hacked cameras, video recorders (DVRs) and home routers that still had their factory-default passwords, knocked the DNS provider Dyn offline. GitHub, Twitter, Reddit, Netflix and Airbnb were unreachable for hours. Default passwords build botnets.

Three kinds of DDoS

Kind Goal Example Measured in
Volumetric Fill the pipe: more traffic than your internet link can carry UDP floods, amplification (Problem 6) bits per second (Gbps, Tbps)
Protocol Exhaust a table that tracks connections The SYN flood from episode 19, filling a server's half-open connections packets per second
Application-layer Send real-looking requests that are expensive to answer Floods of searches, logins, checkouts requests per second

Each kind needs a different defence, at a different layer. Let's take the biggest first.

Problem 6: reflection and amplification

Ordering catalogues to someone else's house

A prankster mails postcards to a thousand companies: "please send your catalogue", and writes the victim's address as the sender.

  • On the internet, writing someone else's address as the sender is spoofing the source IP address. UDP (episode 19) has no handshake, so nobody checks who really sent a request.
  • Each company sends its catalogue to the victim. That is reflection: innocent servers (the reflectors) bounce traffic onto the victim, and they hide the attacker.
  • A tiny postcard turns into a heavy parcel. That is amplification: some services reply with far more bytes than the request. The ratio is the bandwidth amplification factor:
bandwidth amplification factor = reply bytes / request bytes

Demo 4: real amplification factors, and BCP 38

The factors below were published by the US agency CISA in alert TA14-017A, "UDP-Based Amplification Attacks". An attacker with an ordinary 10 megabits per second upload sends spoofed requests. How much hits the victim? Then the fix: BCP 38.

import ipaddress
# Bandwidth amplification factors from CISA alert TA14-017A (reply bytes / request bytes)
BAF = {"DNS": 54, "SSDP": 30.8, "CharGEN": 358.8, "NTP": 556.9, "Memcached": 51000}
attacker_mbps = 10                        # spoofed requests from one home connection
for proto, factor in BAF.items():
    print(f"{proto:10} x{factor:<7} -> the victim receives {attacker_mbps * factor / 1000:7.1f} Gbps")

# The fix that stops the spoofing itself: BCP 38 ingress filtering at the ISP's edge
CUSTOMER = ipaddress.ip_network("198.51.100.0/24")    # the addresses this ISP gave its customer
def isp_edge(src, bcp38):
    if bcp38 and ipaddress.ip_address(src) not in CUSTOMER:
        return "DROPPED: not this customer's address"
    return "forwarded to the internet"
for bcp38 in (False, True):
    print(f"BCP 38 {'on ' if bcp38 else 'off'}: request 'from' the victim 203.0.113.9 ->",
          isp_edge("203.0.113.9", bcp38))

Output:

DNS        x54      -> the victim receives     0.5 Gbps
SSDP       x30.8    -> the victim receives     0.3 Gbps
CharGEN    x358.8   -> the victim receives     3.6 Gbps
NTP        x556.9   -> the victim receives     5.6 Gbps
Memcached  x51000   -> the victim receives   510.0 Gbps
BCP 38 off: request 'from' the victim 203.0.113.9 -> forwarded to the internet
BCP 38 on : request 'from' the victim 203.0.113.9 -> DROPPED: not this customer's address
  • DNS (the phone book of the internet, episode 20), up to 54 times (CISA gives 28 to 54): half a gigabit.
  • NTP, the time protocol, 556.9 times: 5.6 gigabits.
  • SSDP (a discovery protocol devices use to find each other on a local network) 30.8, and CharGEN (an old test service that replies with a stream of characters) 358.8.
  • Memcached, a caching server never meant to face the internet: CISA lists 10,000 to 51,000 times. At the top of that range, 10 megabits becomes 510 gigabits per second.

That's not theory. On 28 February 2018, GitHub was hit by memcached amplification (up to 51,000x) peaking at 1.35 terabits per second.

BCP 38: stop the spoofing at the source

RFC 2827, published as BCP 38 (a "Best Current Practice", by P. Ferguson and D. Senie, May 2000), says: an internet provider should forward a customer's traffic only if its source address is in the customer's assigned prefix. This is called ingress filtering. In the demo, the customer was given 198.51.100.0/24; a request claiming to come from the victim 203.0.113.9 is dropped at the attacker's own provider, before it can bounce anywhere.

CISA's list of mitigations: BCP 38 ingress filtering, rate limiting, remotely triggered blackhole routing, and coordination with your upstream provider. And if you run a server: never leave memcached, NTP or similar UDP services open to the whole internet, or your server becomes an amplifier attacking someone else.

Problem 7: rate limits and DDoS mitigation services

Demo 5: a per-IP rate limit vs one attacker and vs a botnet

Now the application layer. A shop serves 1,000 requests a second. The obvious defence is rate limiting: at most 20 requests per second from any one IP address. Test one: a single machine sends 50,000 requests a second. Test two: a botnet of 5,000 bots, each sending only 3.

from collections import Counter
CAPACITY, PER_IP_LIMIT = 1000, 20         # the shop handles 1000 req/s; 20 per IP per second is plenty

def one_second(requests, limit):          # requests: a list of source IPs
    per_ip, served = Counter(), 0
    for ip in requests:
        per_ip[ip] += 1
        if limit and per_ip[ip] > PER_IP_LIMIT: continue        # rate limited
        served += 1
    return "OK" if served <= CAPACITY else f"DOWN ({served} req/s > {CAPACITY})"

customers = [f"user{i}" for i in range(300)]                      # 300 real shoppers, 1 req each
one_bot   = customers + ["10.6.6.6"] * 50_000                     # one machine, 50,000 req/s
botnet    = customers + [f"bot{i}" for i in range(5000)] * 3      # 5,000 bots, 3 req/s each
for name, traffic in [("one attacker", one_bot), ("botnet", botnet)]:
    print(f"{name:12} no limit: {one_second(traffic, False):24} per-IP limit: {one_second(traffic, True)}")

Output:

one attacker no limit: DOWN (50300 req/s > 1000) per-IP limit: OK
botnet       no limit: DOWN (15300 req/s > 1000) per-IP limit: DOWN (15300 req/s > 1000)
  • One attacker: down without a limit (300 shoppers + 50,000), fine with it (300 + 20). The rate limit works.
  • Botnet: down either way. Each bot sends just 3 requests a second, politely under the limit, and together they are 15,000 (plus 300 shoppers = 15,300).

Why? A per-IP limit assumes one attacker = one address. A botnet breaks that assumption. And no single server has enough capacity to absorb a big flood alone.

DDoS mitigation services

So big services rent capacity.

  • A DDoS mitigation service (sometimes called a scrubbing service) has huge network capacity spread around the world. Your traffic is routed through its scrubbing centres, attack traffic is filtered out, and the clean part is passed on to you. In 2018, GitHub moved its traffic to Akamai, and the attack was handled within minutes.
  • CDNs (episode 21) help too. With anycast, the same IP address is announced and answered from many cities, so a flood is split many ways instead of landing on one building.
  • At the application layer: challenges (prove you are a real browser or person), caching (answer repeated requests without doing the expensive work again), and limits per user and per expensive action, not only per IP.
  • Blackhole routing, the last resort: asking providers to drop all traffic to the target address. It finishes the attacker's job for that one address, but saves everything else on the network.
  • Plan before the attack: emergency contacts at your internet provider and mitigation provider, and a written runbook (step-by-step instructions for the bad day).

Problem 8: BGP hijacking and RPKI

24 February 2008: YouTube goes missing

The internet is tens of thousands of separate networks run by different organisations. Each is called an autonomous system (AS) and has a number, an ASN. They tell each other which addresses they can reach using BGP, the Border Gateway Protocol. Think of it as the internet's shared map, built entirely from what neighbours say: "send traffic for this block of addresses to me." That message is a route announcement, and the block is a prefix like 10.20.0.0/22 (the /22 says how many leading bits are fixed: a /22 is a bigger block than a /24).

Routers follow the longest prefix match: when several routes cover an address, the most specific one (the biggest number after the slash) wins. Like a postal sorter preferring "Building 4, MG Road" over just "MG Road".

What happened, from the RIPE NCC case study:

  1. On 24 February 2008, from 18:47 UTC, Pakistan Telecom (AS17557) announced a /24 route covering part of YouTube's /22. It was meant to block YouTube inside Pakistan, but it leaked to the world.
  2. The more specific /24 won, so much of the internet sent YouTube's traffic to Pakistan.
  3. YouTube answered by announcing more-specific routes of its own, and PCCW (AS3491) withdrew the bad route at 21:01 UTC: about two hours.

Announcing addresses you don't own, on purpose or by accident, is BGP hijacking. BGP believes its neighbours.

Demo 6: a toy router, with and without RPKI

The owner, AS 64500, announces a /22. A hijacker, AS 64666, announces a /24 inside it. The fix is RPKI, the Resource Public Key Infrastructure: the owner publishes a cryptographically signed record, a ROA (Route Origin Authorisation), saying "this prefix, at most this length (maxLength), may only be announced by my AS".

import ipaddress as ip
net = ip.ip_network
# Announcements a router hears (made-up prefixes and AS numbers): the owner's, then a hijacker's
routes = [(net("10.20.0.0/22"), 64500),            # VideoSite (AS64500) owns 10.20.0.0/22
          (net("10.20.1.0/24"), 64666)]            # AS64666 claims a MORE SPECIFIC piece of it
ROAS = [(net("10.20.0.0/22"), 22, 64500)]          # RPKI: owner-signed (prefix, maxLength, origin AS)

def rpki(prefix, origin):                          # route origin validation, as in RFC 6811
    covering = [r for r in ROAS if prefix.subnet_of(r[0])]
    if not covering: return "NotFound"
    ok = any(prefix.prefixlen <= maxlen and origin == asn for _, maxlen, asn in covering)
    return "Valid" if ok else "Invalid"

for check in (False, True):
    table = [r for r in routes if not check or rpki(*r) != "Invalid"]
    hits = [r for r in table if ip.ip_address("10.20.1.10") in r[0]]
    prefix, asn = max(hits, key=lambda r: r[0].prefixlen)       # longest prefix match wins
    print(f"RPKI {'on ' if check else 'off'}: traffic for 10.20.1.10 -> {prefix} via AS{asn}",
          "" if not check else f"| hijack is {rpki(*routes[1])}, dropped")

Output:

RPKI off: traffic for 10.20.1.10 -> 10.20.1.0/24 via AS64666 
RPKI on : traffic for 10.20.1.10 -> 10.20.0.0/22 via AS64500 | hijack is Invalid, dropped
  • RPKI off: traffic for 10.20.1.10 follows the more specific /24, to the hijacker.
  • RPKI on: the hijacker's route is Invalid (wrong origin AS, and longer than maxLength 22), so it is dropped, and traffic goes to the real owner.

The three states come from RFC 6811 (January 2013), BGP prefix origin validation:

State Meaning
Valid A ROA covers the prefix, its length is ≤ maxLength, and the origin AS matches
Invalid A ROA covers the prefix, but the origin AS or the length is wrong
NotFound No ROA covers the prefix at all

NotFound is why both halves matter: owners must actually publish ROAs, and networks must actually drop Invalid routes. Sign your routes, drop Invalid.

The next problem

Look back: every defence today was a filter, deciding allow or drop: port security for frames, DAI for ARP replies, snooping for DHCP offers, BCP 38 for spoofed sources, RPKI for routes. But if the whole company is one flat network, one hacked laptop can still reach every server. We need walls between zones, and rules for what may cross them: firewalls and network segmentation, next episode.

The whole chain

  1. Listening in → switches; MAC flooding → port security
  2. Fake gateway via ARP → Dynamic ARP Inspection
  3. Rogue DHCP → DHCP snooping (and its binding table)
  4. VLAN hopping → access ports, no auto-trunking; session hijacking → HTTPS, Secure/HttpOnly cookies
  5. Floods → DoS, DDoS: volumetric, protocol, application
  6. ×51,000 → reflection, amplification; BCP 38
  7. Botnets beat per-IP limits → DDoS mitigation services
  8. Lies to the internet's map → BGP hijacking, RPKI

...and you just invented network defence.

Common mistakes (and what they print)

Mistake What you get Why Fix
Unused switch ports left enabled A stranger plugs in and floods or sniffs No limit, no owner Disable them; port security on the rest
No port security no protection: table 8/8 full, gateway -> Asha goes to ALL ports (flooded) Unknown MACs are flooded Limit MACs per port
Plain ARP, no DAI Asha's internet traffic now goes to evil:66 ARP believes any answer DAI, fed by DHCP snooping
DHCP snooping without trusted ports laptop accepts rogue laptop: gateway 192.168.1.66, DNS 192.168.1.66 First offer wins Trust only the uplink ports
DAI on, but printers/servers have no bindings Real devices' ARP replies dropped They never used DHCP Add static bindings by hand
User ports allowed to negotiate trunks A PC gets every VLAN Automatic trunking Access mode, auto-trunking off, unused native VLAN
Memcached / NTP open to the internet Your server amplifies attacks on others UDP replies to spoofed sources Bind locally, firewall, patch
ISP without BCP 38 BCP 38 off: ... -> forwarded to the internet Spoofed sources leave the network Ingress filtering at the edge
Only per-IP rate limits botnet ... per-IP limit: DOWN (15300 req/s > 1000) 5,000 IPs, each under the limit Mitigation service + per-user limits
ROAs published, Invalid not dropped (or vice versa) traffic for 10.20.1.10 -> 10.20.1.0/24 via AS64666 Validation needs both halves Publish ROAs and drop Invalid
No DDoS plan Hours lost finding the right phone number Panic during the attack Contacts + runbook, written in advance

Mini project: a switch-log anomaly checker

A small defensive tool: it reads made-up events a monitoring system saw on a switch (ARP replies, DHCP offers, MAC addresses per port), compares them with the DHCP snooping binding table, and raises alerts for exactly today's attacks.

from collections import defaultdict

# DHCP snooping's binding table (made up): IP -> (MAC, port)
BINDINGS = {"192.168.1.1":  ("gw:01",   "port 24"),
            "192.168.1.20": ("asha:20", "port 1"),
            "192.168.1.21": ("ravi:21", "port 2"),
            "192.168.1.30": ("prn:30",  "port 5")}   # printer: added by hand
TRUSTED_DHCP = {"port 24"}                           # only the uplink may offer addresses
MAX_MACS_PER_PORT = 2

# Events a monitoring tool saw on the switch (made up)
events = """arp 192.168.1.1 gw:01 port 24
arp 192.168.1.20 asha:20 port 1
arp 192.168.1.1 evil:66 port 3
arp 192.168.1.21 evil:66 port 3
dhcp-offer gateway=192.168.1.66 from port 7
dhcp-offer gateway=192.168.1.1 from port 24
mac a1:01 port 9
mac a1:02 port 9
mac a1:03 port 9
mac a1:04 port 9"""

alerts, macs_on_port, ips_per_mac = [], defaultdict(set), defaultdict(set)
for line in events.splitlines():
    kind, *rest = line.split()
    if kind == "arp":
        ip, mac, port = rest[0], rest[1], " ".join(rest[2:])
        ips_per_mac[mac].add(ip)
        if BINDINGS.get(ip, (mac, port)) != (mac, port):
            alerts.append(f"ARP SPOOF?  {mac} on {port} claims {ip}, binding says {BINDINGS[ip][0]}")
    elif kind == "dhcp-offer":
        settings, port = rest[0], " ".join(rest[2:])
        if port not in TRUSTED_DHCP:
            alerts.append(f"ROGUE DHCP? offer '{settings}' from untrusted {port}")
    elif kind == "mac":
        mac, port = rest[0], " ".join(rest[1:])
        macs_on_port[port].add(mac)

for port, macs in macs_on_port.items():
    if len(macs) > MAX_MACS_PER_PORT:
        alerts.append(f"MAC FLOOD?  {len(macs)} MACs seen on {port} (limit {MAX_MACS_PER_PORT})")
for mac, ips in ips_per_mac.items():
    if len(ips) > 1:
        alerts.append(f"ONE MAC, MANY IPs: {mac} claims {sorted(ips)}")

print(f"{len(alerts)} alerts")
for a in alerts: print(" -", a)

Output:

5 alerts
 - ARP SPOOF?  evil:66 on port 3 claims 192.168.1.1, binding says gw:01
 - ARP SPOOF?  evil:66 on port 3 claims 192.168.1.21, binding says ravi:21
 - ROGUE DHCP? offer 'gateway=192.168.1.66' from untrusted port 7
 - MAC FLOOD?  4 MACs seen on port 9 (limit 2)
 - ONE MAC, MANY IPs: evil:66 claims ['192.168.1.1', '192.168.1.21']

Every attack from Problems 1 to 3 shows up: evil:66 claiming the gateway's and Ravi's addresses (ARP spoofing, and one MAC claiming many IPs is a classic sign of a man-in-the-middle), an offer from port 7 (rogue DHCP), and four MACs on port 9 (MAC flooding, or someone plugging in an unauthorised switch). Notice the printer's static binding: without it, its ARP replies would look suspicious too. Ideas to extend it: alert on ARP claims for IPs that have no binding at all, and add timestamps so a burst of new MACs within one second scores higher.

Practice

1. Homework: add an aging timer to the toy switch. Real switches forget MAC entries that have been silent for a while. Show that once the flood stops, the fakes age out and Asha is learned again.

Solution
AGE_LIMIT, SIZE = 300, 8                      # forget a MAC after 300 s of silence
table = {}                                    # MAC -> (port, last_seen)

def frame(src, dst, port, now):
    for mac, (p, seen) in list(table.items()):        # aging: drop stale entries
        if now - seen > AGE_LIMIT: del table[mac]
    if src in table or len(table) < SIZE:
        table[src] = (port, now)                       # learn or refresh src
    return f"port {table[dst][0]} only" if dst in table else "ALL ports (flooded)"

frame("gw:01", "ff:ff", port=2, now=0)
for i in range(1000):                                  # the flood at t = 10 s
    frame(f"fake:{i:03}", "gw:01", port=3, now=10)
frame("asha:20", "gw:01", port=1, now=20)
where = frame("gw:01", "asha:20", port=2, now=20)
print(f"t=20 : table {len(table)}/{SIZE}, gateway -> Asha goes to {where}")
frame("asha:20", "gw:01", port=1, now=400)             # flood stopped; fakes age out
where = frame("gw:01", "asha:20", port=2, now=400)
print(f"t=400: table {len(table)}/{SIZE}, gateway -> Asha goes to {where}")

Output:

t=20 : table 8/8, gateway -> Asha goes to ALL ports (flooded)
t=400: table 2/8, gateway -> Asha goes to port 1 only

During the flood the table is full and Asha's frames flood everywhere. Once the attacker stops, the fake entries are older than 300 seconds and are removed; Asha and the gateway are learned again and delivery goes back to port 1 only. Aging helps the network recover, but it does not stop an attacker who keeps flooding: that still needs port security.

2. Homework: make DAI log every dropped reply with the port.

Solution
BINDINGS = {"192.168.1.1": ("gw:01", "port 24"), "192.168.1.20": ("asha:20", "port 1")}
drop_log = []

def arp_reply(cache, ip, mac, port):
    expected = BINDINGS.get(ip)
    if expected != (mac, port):                        # wrong MAC, or right MAC on the wrong port
        drop_log.append(f"DROP {ip} claimed by {mac} on {port} (expected {expected})")
        return
    cache[ip] = mac

cache = {}
arp_reply(cache, "192.168.1.1", "gw:01", "port 24")     # the real gateway
arp_reply(cache, "192.168.1.1", "evil:66", "port 3")    # a lie
arp_reply(cache, "192.168.1.20", "evil:66", "port 3")   # another lie
print("cache:", cache)
for line in drop_log: print(line)

Output:

cache: {'192.168.1.1': 'gw:01'}
DROP 192.168.1.1 claimed by evil:66 on port 3 (expected ('gw:01', 'port 24'))
DROP 192.168.1.20 claimed by evil:66 on port 3 (expected ('asha:20', 'port 1'))

The binding now stores the port too, so a reply is accepted only if both the MAC and the port match. The log tells the network team exactly where to look: port 3.

3. Homework: add a per-user limit to the rate demo. Keep the 5,000-bot botnet. Logged-in shoppers get 20 requests per second each; requests with no account share a small budget (beyond it they get a challenge or "try later").

Solution
from collections import Counter
CAPACITY, PER_USER_LIMIT, ANON_BUDGET = 1000, 20, 200   # anonymous search gets a shared budget

def one_second(requests):                 # requests: (source IP, logged-in user or None)
    per_user, anon, served = Counter(), 0, 0
    for ip, user in requests:
        if user:
            per_user[user] += 1
            if per_user[user] > PER_USER_LIMIT: continue
        else:
            anon += 1
            if anon > ANON_BUDGET: continue   # beyond the budget: challenge / "try later"
        served += 1
    return "OK" if served <= CAPACITY else f"DOWN ({served} req/s > {CAPACITY})"

customers = [(f"203.0.113.{i % 250}", f"user{i}") for i in range(300)]
botnet    = [(f"bot{i}", None) for i in range(5000)] * 3          # bots have no accounts
print("botnet vs per-user limit + anonymous budget:", one_second(customers + botnet))

Output:

botnet vs per-user limit + anonymous budget: OK

The bots have 5,000 different IPs, but no accounts, so together they can only use the shared anonymous budget of 200. Real shoppers are limited per account, not per IP. In practice this is combined with challenges for anonymous visitors and, for floods bigger than your link, a mitigation service, because a rate limit can't help if the pipe itself is full.

4. Comment question: which of today's attacks does TLS NOT stop?

Answer

TLS protects the contents of a connection, so sniffing, ARP spoofing and rogue DHCP can't read or silently change HTTPS traffic (the attacker can't present a valid certificate). But TLS does not stop: MAC flooding itself, ARP spoofing or rogue DHCP redirecting traffic (they can still drop it, or watch who talks to whom), VLAN hopping, any DoS or DDoS (a flood doesn't need to read anything), amplification, or BGP hijacking sending traffic to the wrong network (TLS makes the hijacker unable to impersonate the site, but the site is still unreachable). Session hijacking is stopped only if every request is HTTPS (hence HSTS and Secure cookies).

5. Classify these routes with RFC 6811 route origin validation. ROAs: 10.20.0.0/22 maxLength 22 for AS64500, and 10.30.0.0/16 maxLength 24 for AS64510.

Solution
import ipaddress as ip
net = ip.ip_network
ROAS = [(net("10.20.0.0/22"), 22, 64500), (net("10.30.0.0/16"), 24, 64510)]

def rpki(prefix, origin):                          # RFC 6811 states
    covering = [r for r in ROAS if prefix.subnet_of(r[0])]
    if not covering: return "NotFound"
    ok = any(prefix.prefixlen <= maxlen and origin == asn for _, maxlen, asn in covering)
    return "Valid" if ok else "Invalid"

for p, asn in [("10.20.0.0/22", 64500), ("10.20.1.0/24", 64500), ("10.20.0.0/22", 64666),
               ("10.30.5.0/24", 64510), ("10.30.5.0/25", 64510), ("10.99.0.0/16", 64666)]:
    print(f"{p:14} from AS{asn} -> {rpki(net(p), asn)}")

Output:

10.20.0.0/22   from AS64500 -> Valid
10.20.1.0/24   from AS64500 -> Invalid
10.20.0.0/22   from AS64666 -> Invalid
10.30.5.0/24   from AS64510 -> Valid
10.30.5.0/25   from AS64510 -> Invalid
10.99.0.0/16   from AS64666 -> NotFound
  • 10.20.1.0/24 from the right AS is still Invalid: it is longer than maxLength 22. If the owner really wants to announce /24s, it must publish a ROA with a larger maxLength. Keep maxLength as tight as you actually use, or a hijacker could announce a more specific with your own ASN as origin.
  • 10.30.5.0/25 is Invalid for the same reason (maxLength 24).
  • 10.99.0.0/16 has no ROA covering it: NotFound, so most networks still accept it.

6. A made-up service replies with 3,000 bytes to a 60-byte request. What is its amplification factor, and what reaches the victim from a 10 Mbps and a 100 Mbps attacker?

Solution
def baf(request_bytes, reply_bytes):            # bandwidth amplification factor
    return reply_bytes / request_bytes

f = baf(request_bytes=60, reply_bytes=3000)
print("factor:", f)
for upload_mbps in (10, 100):
    print(f"{upload_mbps} Mbps of spoofed requests -> {upload_mbps * f / 1000} Gbps at the victim")

Output:

factor: 50.0
10 Mbps of spoofed requests -> 0.5 Gbps at the victim
100 Mbps of spoofed requests -> 5.0 Gbps at the victim

Factor 50 (close to DNS's 54 in CISA's table). The defences: don't run such a service open to the internet, rate-limit replies, and, for the whole internet, BCP 38 so the spoofed requests never leave the attacker's provider.

7. Why is blackhole routing called a "last resort"?

Answer

Because it drops all traffic to the attacked address, good and bad alike. The target goes offline, which is exactly what the attacker wanted. It is used when the flood threatens everything else sharing the same links (other customers, other servers), sacrificing one address to save the rest.

8. Your office uses DHCP snooping and DAI, but the network team forgot to mark the uplink port as trusted. What happens?

Answer

The real DHCP server's offers arrive on an untrusted port and are dropped, so new devices get no address at all. Correct trust settings matter in both directions: user ports untrusted, uplinks toward the real server trusted. (The opposite mistake, defining no untrusted ports at all, lets the rogue win.)

Quick quiz

# Users on floor 3 suddenly get
#   gateway 192.168.1.66
# from DHCP. The real gateway is 192.168.1.1.
#
# Which switch feature stops this?

A. Port security B. DHCP snooping C. RPKI D. BCP 38

Answer

B. DHCP snooping. A rogue DHCP server is answering. DHCP snooping lets DHCP offers in only through trusted (uplink) ports, so the rogue's offers are dropped. Port security limits MACs per port, RPKI protects BGP routes and BCP 38 stops spoofed source addresses.

Interview questions

  1. How does a switch decide where to send a frame, and how does MAC flooding abuse it? It learns sender MACs into a MAC table (MAC → port) and forwards to the known port; unknown destinations are flooded to all ports. Filling the table with fake MACs makes real destinations unknown, so traffic floods everywhere and can be sniffed. Defence: port security (MAC limits per port), disabling unused ports, alerting.
  2. What is ARP spoofing and why is it possible? Sending forged ARP replies so victims map an IP (usually the gateway) to the attacker's MAC, giving a man-in-the-middle position. ARP has no authentication; hosts accept unsolicited replies. Defence: Dynamic ARP Inspection, plus encryption.
  3. How do DHCP snooping and Dynamic ARP Inspection work together? Snooping allows DHCP server messages only on trusted ports and records each lease in a binding table (IP, MAC, port); DAI validates ARP messages on untrusted ports against that table. Static devices need manual bindings.
  4. What is VLAN hopping, and how do you prevent it? Reaching another VLAN via switch spoofing (negotiating a trunk) or double tagging (abusing the native VLAN). Prevent by setting user ports to access mode, disabling trunk auto-negotiation, and using an unused native VLAN.
  5. DoS vs DDoS? DoS: making a service unavailable, often from one source. DDoS: the same from many sources (usually a botnet), so there's no single source to block.
  6. Name the three kinds of DDoS and how each is measured. Volumetric (fill bandwidth, bits per second), protocol (exhaust state such as connection tables, packets per second), application-layer (expensive requests, requests per second).
  7. Explain reflection and amplification. The attacker spoofs the victim's IP as the source of small UDP requests to many servers; their larger replies go to the victim (reflection), multiplied by the bandwidth amplification factor (reply/request bytes), e.g. up to 51,000 for memcached per CISA.
  8. What is BCP 38? RFC 2827 ingress filtering: providers forward customer traffic only if its source address is within the customer's assigned prefix, which stops spoofed packets at the source.
  9. Why don't per-IP rate limits stop a DDoS, and what does? Botnets spread traffic over thousands of IPs, each under the limit, and volumetric floods fill the link before any server-side limit runs. Use DDoS mitigation/scrubbing services, CDNs with anycast, per-user and per-action limits, challenges, caching, upstream coordination and a prepared runbook; blackholing as a last resort.
  10. What is BGP hijacking and how does RPKI help? Announcing prefixes you don't hold (often more specific ones, which win by longest prefix match), as in the 2008 YouTube event. RPKI lets holders publish signed ROAs (prefix, maxLength, origin AS); routers doing origin validation (RFC 6811) mark routes Valid, Invalid or NotFound and drop Invalid ones.

Glossary

Term Meaning in plain words Example
Network attack An attack on how the network delivers traffic, not on an app's code ARP spoofing, DDoS
Frame One chunk of data on the local network, addressed by MAC address (episode 17) Laptop → gateway
MAC address The hardware address of a network card asha:20 (toy label)
Port (switch) A socket on a switch where one cable plugs in Port 3
Hub Old box that repeats every frame out of every port Everyone hears everything
Switch Box that delivers each frame only to the port where its owner lives Office network
MAC table A switch's notebook: which MAC is on which port asha:20 → port 1
Flooding (unknown destination) Sending a frame out of every port because its destination isn't in the MAC table ALL ports (flooded)
Broadcast A frame addressed to everyone on the local network An ARP request
Sniffing Capturing traffic that was not meant for you Reading frames on a hub
Packet capture tool Software that records network traffic, used legitimately to troubleshoot Wireshark
MAC flooding Filling a switch's MAC table with fake addresses so traffic floods to every port 1,000 fake MACs on port 3
Port security Switch feature limiting how many MACs a port may use At most 2 on port 3
Sticky MAC Port security mode that remembers the first MAC and refuses others A desk port locked to one PC
Violation action What the switch does when the limit is broken: shut the port, or drop and log port 3 shut down
ARP Address Resolution Protocol: finds the MAC for an IP on the local network (episode 18) "Who has 192.168.1.1?"
ARP cache A device's notebook of IP → MAC learned from ARP {"192.168.1.1": "gw:01"}
Gateway The router that leads out of the local network 192.168.1.1
ARP spoofing / poisoning Sending false ARP replies to redirect traffic "The gateway is at evil:66"
Spoofing Faking an identity: a sender address, a MAC, an ARP answer Spoofed source IP
Man-in-the-middle An attacker between two parties, able to read or change traffic Traffic via evil:66
Dynamic ARP Inspection (DAI) Switch feature that drops ARP messages not matching the binding table DROPPED by DAI
DHCP Dynamic Host Configuration Protocol: gives new devices IP, gateway and DNS "I'm new, who gives me an address?"
DHCP offer A DHCP server's answer with proposed settings gateway 192.168.1.1
Rogue DHCP server An unauthorised DHCP server on the network Offer from port 7
DHCP snooping Switch feature allowing DHCP offers only from trusted ports, and recording leases Drops port 7's offer
Trusted / untrusted port Ports allowed / not allowed to send DHCP server messages Uplink trusted, desks untrusted
Uplink The port connecting a switch toward the rest of the network Port 24
Binding table DHCP snooping's record of IP, MAC and port for each device 192.168.1.20 → asha:20, port 1
Static binding A binding added by hand for a device that doesn't use DHCP The printer
VLAN Virtual LAN: one physical switch split into separate networks Guests vs payments
Access port / access mode A port carrying exactly one VLAN, for an end device A desk port
Trunk A link carrying many VLANs, each frame tagged Switch-to-switch link
VLAN tag A small label on a frame saying which VLAN it belongs to Added on trunks
Native VLAN The one VLAN sent untagged on a trunk Should be an unused VLAN
Switch spoofing A computer pretending to be a switch to get a trunk Auto-negotiated trunk
Double tagging A frame with two VLAN tags; the outer one is stripped, the inner one leads into another VLAN Abuses the native VLAN
VLAN hopping Reaching a VLAN you shouldn't Guest → payments
Session ID Random token identifying a logged-in session (episode 21) session=7e14...
Session hijacking Stealing a valid session after login to act as the user Copied cookie
HSTS Header telling browsers to use only HTTPS for a site Episode 22
Secure / HttpOnly Cookie flags: only sent over HTTPS / not readable by page scripts Set-Cookie: ...; Secure; HttpOnly
DoS Denial of service: making a service unavailable to real users One prankster in the doorway
DDoS Distributed DoS: the flood comes from many machines 5,000 bots
Bot A hacked device obeying a remote controller A camera with a default password
Botnet A crowd of bots under one controller, used e.g. for DDoS Mirai, October 2016
Default password The factory password a device ships with Never changed → botnet
Volumetric DDoS Fills the network link with more traffic than it can carry Amplification, Gbps
Protocol DDoS Exhausts a table that tracks connections SYN flood
SYN flood Many half-open TCP connections filling a server's table (episode 19) Packets per second
Application-layer DDoS Real-looking but expensive requests Search or login floods
bps / pps / rps Bits / packets / requests per second 1.35 Tbps
Mbps / Gbps / Tbps Million / billion / trillion bits per second 10 Mbps → 510 Gbps
UDP Connectionless transport with no handshake (episode 19), so the source isn't verified DNS, NTP queries
Reflection Bouncing traffic off innocent servers onto the victim by spoofing the source Catalogues to the victim
Reflector An innocent server that replies to the spoofed victim An open NTP server
Amplification Replies much larger than requests Postcard in, parcel out
Bandwidth amplification factor Reply payload bytes ÷ request payload bytes (CISA) NTP 556.9
DNS / NTP Name lookup / time synchronisation protocols, both usable as amplifiers DNS up to 54
SSDP A discovery protocol devices use to find each other on a local network Factor 30.8
CharGEN An old test service that replies with a stream of characters Factor 358.8
Memcached A caching server, never meant to face the internet Up to 51,000
BCP 38 / ingress filtering RFC 2827: forward customer traffic only if its source is in the customer's prefix Drops "from 203.0.113.9"
Rate limiting Capping how many requests one source may make per second 20 req/s per IP
Per-user limit A cap per account or action instead of per IP 20 req/s per shopper
Challenge A test that a visitor is a real browser or person Before an expensive search
Caching Keeping answers to reuse instead of recomputing them A popular product page
DDoS mitigation service A provider with huge capacity that filters attack traffic for you GitHub → Akamai, 2018
Scrubbing centre A provider's site where traffic is cleaned and the clean part forwarded "Scrubbing service"
CDN Content delivery network: servers near users (episode 21) Edge servers
Anycast The same IP address announced and answered from many places A flood split across cities
Blackhole routing Dropping all traffic to an attacked address (remotely triggered: asking your provider to) Last resort
Runbook Written step-by-step instructions for an incident "DDoS: call these numbers"
Upstream provider The network that connects yours to the rest of the internet Your ISP
Autonomous system (AS) One network under one organisation's routing control An ISP, a big website
ASN Autonomous System Number AS64500 (toy), AS17557
BGP Border Gateway Protocol: how autonomous systems tell each other routes The internet's map
Route announcement A BGP message: "send traffic for this prefix to me" 10.20.0.0/22 from AS64500
Prefix A block of IP addresses, written address/length 10.20.0.0/22
More specific A smaller block inside a bigger one (larger number after /) /24 inside /22
Longest prefix match The most specific matching route wins /24 beats /22
BGP hijacking Announcing prefixes you don't hold, on purpose or by accident YouTube, 24 Feb 2008
RPKI Resource Public Key Infrastructure: signed records of who may announce what ROAs
ROA Route Origin Authorisation: signed (prefix, maxLength, origin AS) 10.20.0.0/22, 22, AS64500
maxLength The longest prefix length a ROA allows 22 → a /24 is Invalid
Route origin validation Checking routes against ROAs (RFC 6811) rpki() in Demo 6
Valid / Invalid / NotFound ROA matches / ROA covers but origin or length wrong / no ROA covers it The hijack is Invalid
RFC "Request for Comments": a numbered internet standards document RFC 2827, RFC 6811
Filter A rule deciding allow or drop Every defence today

Summary

  • Switches deliver frames only to the owner's port, which makes sniffing hard, until MAC flooding fills the MAC table. Port security limits MACs per port; disable unused ports; encrypt anyway.
  • ARP believes any answer, so ARP spoofing makes you send traffic to the attacker. Dynamic ARP Inspection checks ARP against facts.
  • A rogue DHCP server can hand out itself as gateway and DNS. DHCP snooping allows offers only from trusted ports and builds the binding table that DAI uses.
  • VLAN hopping abuses trunks and the native VLAN: user ports in access mode, no auto-trunking. Session hijacking steals a logged-in session: HTTPS, HSTS, Secure/HttpOnly cookies, new IDs at login.
  • DoS vs DDoS; volumetric, protocol and application-layer; botnets built from default passwords (Mirai, 2016).
  • Reflection and amplification turn 10 Mbps into 510 Gbps (memcached up to 51,000x; GitHub, 1.35 Tbps, 2018). BCP 38 stops spoofing at the source.
  • Per-IP rate limits stop one attacker, not a botnet: DDoS mitigation services, anycast, per-user limits, a runbook, and blackhole routing as a last resort.
  • BGP trusts neighbours and longest prefix match wins, so BGP hijacking works (YouTube, 2008). RPKI ROAs + dropping Invalid routes fix it.

Next episode: Firewalls and network segmentation: packet filters, stateful firewalls, NGFWs, default deny, DMZs, VLANs, microsegmentation and jump boxes, and why one flat network is a gift to attackers.

Sources: CISA alert TA14-017A, "UDP-Based Amplification Attacks" (amplification factors and mitigations); GitHub, "February 28th DDoS Incident Report" (28 Feb 2018); The Register, 21 Oct 2016 (Mirai botnet and Dyn); RFC 2827 / BCP 38, Network Ingress Filtering (P. Ferguson, D. Senie, May 2000); RIPE NCC, "YouTube Hijacking: A RIPE NCC RIS case study" (24 Feb 2008); RFC 6811, BGP Prefix Origin Validation (January 2013). Code outputs from Python 3.13. Fetched 2 Nov 2026.