GHOSTNET›MODULES›MOD-08 // NETWORK ATTACKS
CONCEPTLAB ->
ADVANCED MODULE · MOD-08 · 8 CHAPTERS · CONCEPT PAGE

NETWORK ATTACKS

TCP/IP internals · Scanning · Wireshark · ARP poisoning · MITM · Protocol attacks · Evasion · DoS · Pivoting

8
CHAPTERS
~2.8hr
TOTAL READ
ADVANCED
DIFFICULTY
MOD-08
IDENTIFIER
BEGINNER~18 min READCHAPTER 1 OF 8

Network Fundamentals for Attackers

KEY POINTS · THE QUICK VERSION
  • The OSI layer an attack targets determines which tools detect it and which defenses apply - always identify the layer first
  • Every TCP/IP header field is attack surface: spoof src IP for amplification, manipulate TTL for OS fingerprinting, abuse flags for firewall bypass
  • SYN flood works by exhausting the server connection backlog before handshakes complete - SYN cookies mitigate this without memory allocation
  • IPv6 is frequently less monitored than IPv4 on dual-stack networks - NDP (Neighbor Discovery) is the ARP equivalent and equally unauthenticated
  • DNS has no authentication by default - every step in the resolution chain is a potential interception or poisoning point
Scan these first, then read below for the depth and examples — or jump straight to the lab.

Before launching any network attack you need to understand the infrastructure you are attacking. Every tool, every technique, and every defense maps to a specific layer of the network stack. This chapter builds that mental model from the ground up.

◈ PICTURE IT — MTAANI EDITION

When you send a parcel to your people up at the shamba, it does not teleport there. You wrap the gift, a counter clerk seals it in a sack and writes the destination, a sorting office decides the route, and finally a rider carries it the last stretch to the gate. Each stage only handles its own layer of wrapping and passes it to the next — and at the far end the wrapping comes off in reverse. The network's seven layers work exactly like that chain, and an attacker can tamper at any single stage along the way.

OSI Model - Attacker Perspective

The OSI (Open Systems Interconnection) model has 7 layers. Each layer has its own protocols, vulnerabilities, and attack tools. Knowing which layer you are operating at tells you which defenses apply and which tools to reach for.

👁 WATCH THIS · you don't need to run it yet — just read along
// OSI LAYERS AND ASSOCIATED ATTACKS
Layer 7 - Application
  Protocols: HTTP, HTTPS, DNS, FTP, SMTP, LDAP, SMB
  Attacks: SQLi, XSS, credential brute force, DNS poisoning,
           HTTP flood, Slowloris, SMTP open relay
  Tools: Burp Suite, sqlmap, Hydra, dnschef

Layer 6 - Presentation
  Protocols: TLS/SSL, JPEG, MPEG, ASCII encoding
  Attacks: SSL stripping, POODLE, BEAST, cert forgery
  Tools: sslstrip, mitmproxy, testssl.sh

Layer 5 - Session
  Protocols: SMB, NetBIOS, RPC, SQL sessions
  Attacks: Session hijacking, NTLM relay, pass-the-hash
  Tools: Responder, ntlmrelayx, CrackMapExec

Layer 4 - Transport
  Protocols: TCP, UDP
  Attacks: SYN flood, TCP hijacking, port scanning,
           UDP amplification, connection exhaustion
  Tools: hping3, nmap, scapy, netcat

Layer 3 - Network
  Protocols: IP, ICMP, OSPF, BGP
  Attacks: IP spoofing, ICMP redirect, route injection,
           TTL manipulation, BGP hijacking
  Tools: hping3, scapy, nemesis, quagga

Layer 2 - Data Link
  Protocols: ARP, Ethernet, 802.1Q (VLAN), STP, CDP
  Attacks: ARP spoofing, MAC flooding, VLAN hopping,
           STP root election, CDP info disclosure
  Tools: arpspoof, bettercap, yersinia, macchanger, dsniff

Layer 1 - Physical
  Attacks: Cable tapping, hardware keylogger, rogue AP,
           optical fiber interception
  Tools: WiFi Pineapple, hardware implants
What you're seeing: This is a cheat-sheet of those seven wrapping stages, top to bottom, with the kinds of attack that hit each one and the tools that do it. Do not memorise it — just notice that every layer is a separate place something can go wrong, from a web form at the very top (Layer 7) down to someone physically tapping a cable at the bottom (Layer 1).
↪ You'll operate at several of these layers hands-on across this module and in ↪ the network-attacks lab.

TCP/IP Model and Header Attack Surface

In practice attackers think in the TCP/IP model (4 layers). Every header field is a potential attack vector - either to spoof, manipulate, or exploit.

👁 WATCH THIS · you don't need to run it yet — just read along
// CRITICAL HEADER FIELDS FOR ATTACKERS
IP HEADER (20 bytes minimum):
  Version (4 bits)    - IPv4 vs IPv6 confusion attacks
  TTL (8 bits)        - fingerprint OS, traceroute, hop counting
  Protocol (8 bits)   - TCP=6, UDP=17, ICMP=1
  Src IP (32 bits)    - SPOOF THIS for amplification, decoy scans
  Dst IP (32 bits)    - routing, broadcast amplification
  Flags (3 bits)      - DF bit: don't fragment (MTU probing)
  Fragment Offset     - fragmentation evasion attacks

TCP HEADER (20 bytes minimum):
  Src Port (16 bits)  - spoof for bypass, randomize for stealth
  Dst Port (16 bits)  - service identification
  Seq Number (32 bits)- session hijacking if predictable
  Ack Number (32 bits)- connection state tracking
  Flags (9 bits):
    SYN - initiate connection (SYN flood target)
    ACK - acknowledgement (firewall inference with -sA)
    FIN - close connection gracefully
    RST - reset connection (TCP RST injection)
    URG - urgent data (rarely used, evasion)
    PSH - push data immediately
  Window Size (16 bits)- OS fingerprinting, flow control
  Checksum (16 bits)  - --badsum in nmap tests IDS behavior

UDP HEADER (8 bytes only):
  Src Port, Dst Port, Length, Checksum
  No state = harder to filter = amplification attacks

ICMP:
  Type 8 (Echo Request) - ping sweep discovery
  Type 0 (Echo Reply)   - response confirms host up
  Type 11 (TTL Exceeded)- traceroute mechanism
  Type 3 (Unreachable)  - port closed indicator
  Type 5 (Redirect)     - ICMP redirect attack vector
What you're seeing: Every packet carries a small form at the front with labelled boxes: where it came from, where it is going, how many hops it has left to live. This lists the boxes that matter to an attacker and why. The one to clock is Src IP, marked SPOOF THIS — nothing forces a sender to tell the truth about their own return address, and half of networking's trouble starts there.
↪ You'll craft and spoof these very fields yourself with tools like scapy and hping3 later in this module.

TCP 3-Way Handshake and Attack Opportunities

BEGINNER NOTE

The TCP handshake is how two computers agree to start a conversation. Think of it like knocking on a door (SYN), getting an answer (SYN-ACK), and confirming you heard them (ACK). Attackers can abuse each step.

// HANDSHAKE PHASES AND ATTACK VECTORS
Phase 1 - SYN (Client to Server):
  Client sends: SYN, seq=X
  Server allocates memory, stores half-open connection
  ATTACK: SYN flood - send millions of SYNs from spoofed IPs
           Server fills backlog queue, legitimate connections rejected

Phase 2 - SYN-ACK (Server to Client):
  Server sends: SYN+ACK, seq=Y, ack=X+1
  ATTACK: SYN-ACK reflection - spoof src IP to victim
           Server floods victim with SYN-ACKs (amplification ~1.4x)

Phase 3 - ACK (Client to Server):
  Client sends: ACK, ack=Y+1
  Connection ESTABLISHED - both sides enter ESTABLISHED state
  ATTACK: If seq numbers predictable, inject ACK with correct seq
           = TCP session hijacking (historical, modern OS randomizes)

Half-Open Scan (nmap -sS):
  Client sends SYN
  If port OPEN:   server sends SYN-ACK -> client sends RST (never ACKs)
  If port CLOSED: server sends RST immediately
  Advantage: never completes handshake, harder to log

SYN Cookie Defense (linux default):
  Server encodes connection state in SYN-ACK sequence number
  No memory allocated until final ACK received
  Defeats SYN flood - check: sysctl net.ipv4.tcp_syncookies

IPv4 Addressing - CIDR, RFC1918, Broadcast

// ADDRESSING KNOWLEDGE EVERY ATTACKER NEEDS
PRIVATE RANGES (RFC 1918) - not routable on internet:
  10.0.0.0/8        (10.0.0.0 - 10.255.255.255)   Class A
  172.16.0.0/12     (172.16.0.0 - 172.31.255.255) Class B
  192.168.0.0/16    (192.168.0.0 - 192.168.255.255) Class C

SPECIAL ADDRESSES:
  127.0.0.0/8       Loopback (localhost = 127.0.0.1)
  169.254.0.0/16    APIPA / link-local (no DHCP assigned)
  0.0.0.0/0         Default route (all traffic)
  255.255.255.255   Limited broadcast (layer 2 only)
  x.x.x.255        Directed broadcast for subnet (Smurf attack)

CIDR NOTATION:
  /24 = 256 hosts (mask 255.255.255.0)   - typical LAN
  /16 = 65536 hosts                       - corporate network
  /8  = 16M hosts                         - class A
  /32 = single host                       - specific target
  /30 = 4 addresses, 2 usable            - point-to-point links

CIDR QUICK MATH:
  192.168.1.100/24
    Network: 192.168.1.0
    Broadcast: 192.168.1.255
    Hosts: .1 through .254

SUBNET ENUMERATION:
  ipcalc 192.168.1.100/24   # show network details
  nmap -sn 192.168.1.0/24   # ping scan entire subnet

IPv6 Fundamentals and Attack Surface

IPv6 is increasingly common and introduces new attack surface. Many networks run dual-stack (IPv4 + IPv6) and IPv6 is often less monitored than IPv4.

// IPv6 ADDRESSING AND NEIGHBOR DISCOVERY ATTACKS
ADDRESS TYPES:
  ::1/128           Loopback
  fe80::/10         Link-local (auto-assigned, every interface)
  fc00::/7          Unique local (RFC4193, like RFC1918)
  2000::/3          Global unicast (routable internet)
  ff02::1           All-nodes multicast (replaces broadcast)
  ff02::2           All-routers multicast
  ff02::1:ff00::/104 Solicited-node multicast (for NDP)

NEIGHBOR DISCOVERY PROTOCOL (NDP) replaces ARP:
  ICMPv6 Type 133 - Router Solicitation  (host asks for router)
  ICMPv6 Type 134 - Router Advertisement (router announces self)
  ICMPv6 Type 135 - Neighbor Solicitation (who has this IPv6?)
  ICMPv6 Type 136 - Neighbor Advertisement (I have this IPv6)

  ARP SPOOFING EQUIVALENT: Neighbor Advertisement spoofing
  Send fake NA claiming your MAC for target IPv6 addr

SLAAC (Stateless Address Autoconfiguration):
  Host receives RA (Router Advertisement)
  Generates address from prefix + interface MAC (EUI-64)
  ATTACK: Send rogue RAs via flood6 or fake_router6
  Tools: thc-ipv6 toolkit, mitm6

IPv6 ATTACKS:
  mitm6   - Spoof DHCPv6 + DNS to capture NTLMv2 hashes
  flood6  - RA flood to disrupt routing
  alive6  - IPv6 host discovery
  parasite6 - NDP spoofing (ARP poison equivalent)
  redir6  - ICMPv6 redirect attack

DUAL-STACK GOTCHA:
  Many firewalls filter IPv4 but allow IPv6 freely
  Always check for IPv6 on targets: nmap -6 fe80::1%eth0

DNS Resolution Process and Attack Surface

// DNS RESOLUTION CHAIN - WHERE ATTACKS LIVE
RESOLUTION CHAIN:
  1. Browser cache
  2. OS resolver cache (/etc/hosts first)
  3. Recursive resolver (your ISP or 8.8.8.8)
  4. Root nameservers (13 root servers, anycast)
  5. TLD nameservers (.com, .net, .org)
  6. Authoritative nameserver (final answer)

ATTACK SURFACES:
  Step 2: /etc/hosts poisoning (local access required)
  Step 3: DNS cache poisoning (Kaminsky attack)
           Flood resolver with fake responses
           If txid matches before real response -> cached
  Step 5-6: Zone transfer (AXFR) from misconfigured NS
  Any step: DNS interception (MITM + bettercap dns.spoof)
  Any step: DNS tunneling (data exfil via DNS queries)

RECORD TYPES (know these for recon):
  A     - IPv4 address
  AAAA  - IPv6 address
  CNAME - Canonical name (alias)
  MX    - Mail exchanger (priority + hostname)
  NS    - Nameserver for domain
  TXT   - Text records (SPF, DKIM, DMARC, juicy info)
  PTR   - Reverse lookup (IP -> hostname)
  SOA   - Start of Authority (zone serial, TTL defaults)
  SRV   - Service location records (_ldap._tcp, _kerberos._tcp)

DNS SECURITY MECHANISMS (and why they often fail):
  DNSSEC - signs records with crypto, rarely deployed
  DoH    - DNS over HTTPS (hides queries, bypasses filters)
  DoT    - DNS over TLS port 853
  RPKI   - BGP route origin validation

Common Ports and Services Reference

// PORT MAP - EVERY PENTESTER MUST MEMORIZE
WELL-KNOWN PORTS (0-1023):
  20/21  FTP (data/control) - often anonymous, cleartext creds
  22     SSH  - brute force, key attacks, tunneling
  23     Telnet - fully cleartext, legacy systems
  25     SMTP - open relay, user enum, mail injection
  53     DNS  - zone transfer, amplification, tunneling
  67/68  DHCP - rogue server, starvation
  69     TFTP - unauthenticated file transfer
  80     HTTP - web attacks, enumeration
  88     Kerberos - AS-REQ brute force, ticket attacks
  110    POP3 - cleartext email retrieval
  111    RPC portmapper - NFS enumeration
  119    NNTP
  123    NTP  - monlist amplification attack (556x)
  135    MSRPC - Windows RPC endpoint mapper
  137-139 NetBIOS - LLMNR/NBT-NS poisoning with Responder
  143    IMAP
  161/162 SNMP - community string brute, MIB dump, write access
  389    LDAP - anonymous bind, injection, AD enumeration
  443    HTTPS
  445    SMB  - EternalBlue, SMB relay, share enumeration
  465    SMTPS
  514    Syslog
  515    LPD (printer)
  546/547 DHCPv6
  587    SMTP submission
  636    LDAPS
  993    IMAPS
  995    POP3S

REGISTERED PORTS (1024-49151):
  1080   SOCKS proxy
  1433   MSSQL - credential attacks, xp_cmdshell RCE
  1521   Oracle DB
  2049   NFS  - exposed share mounting, root squash bypass
  3268   LDAP Global Catalog
  3306   MySQL - credential attacks, UDF injection
  3389   RDP  - BlueKeep, credential spray, NLA bypass
  4444   Metasploit default handler
  5432   PostgreSQL
  5900   VNC  - weak passwords, unencrypted
  5985/5986 WinRM - lateral movement, PowerShell remoting
  6379   Redis - unauthenticated RCE via config rewrite
  6443   Kubernetes API
  8080   HTTP alternate / proxy
  8443   HTTPS alternate
  8888   Jupyter Notebook - often unauthenticated
  9200   Elasticsearch - unauthenticated HTTP API
  11211  Memcached - UDP amplification (51000x), info disclosure
  27017  MongoDB - unauthenticated access, data exfil

Network Topology - Trust Zones and Segmentation

// HOW SEGMENTATION AFFECTS YOUR ATTACK PATH
TYPICAL ENTERPRISE NETWORK ZONES:
  Internet (untrusted)
       |
  [Perimeter Firewall]
       |
  DMZ (semi-trusted) - web servers, mail, DNS, VPN gateway
       |
  [Internal Firewall]
       |
  Internal LAN (trusted)
    |-- Corporate VLAN (workstations)
    |-- Server VLAN (file, print, app servers)
    |-- Management VLAN (network gear, OOB)
    |-- Guest VLAN (isolated internet only)
    |-- Production VLAN (databases, critical systems)

ATTACK PATH IMPLICATIONS:
  External attacker:
    1. Compromise DMZ host (webshell, vuln service)
    2. Pivot to internal LAN (tunnel through DMZ host)
    3. Enumerate internal network
    4. Lateral movement to server VLAN
    5. Escalate to domain admin
    6. Access production VLAN / databases

VLAN SEGMENTATION BYPASS:
  VLAN hopping (Chapter 4) breaks L2 segmentation
  Misconfigured trunk ports expose all VLANs
  Dual-homed servers bridge VLANs

FLAT NETWORK (no segmentation):
  Attacker on any workstation can reach:
  - Domain controllers
  - Database servers
  - Backup servers
  = Disaster (but very common in SMBs)

Firewalls, IDS/IPS - Types and Evasion Fundamentals

// UNDERSTANDING DEFENSES TO BYPASS THEM
FIREWALL TYPES:
  Packet filter (L3/L4):
    - Stateless, checks src/dst IP + port + protocol
    - Simple ACLs, cheap, fast
    - Bypass: use allowed ports (80/443/53), fragment packets

  Stateful inspection (L4):
    - Tracks TCP connection state
    - Blocks packets not part of established session
    - Bypass: inject into established sessions

  Application layer (L7 / proxy):
    - Understands HTTP, DNS, FTP content
    - Detects protocol anomalies
    - Bypass: encode payloads, use valid-looking HTTP

  NGFW (Next-Gen Firewall):
    - App ID, user ID, threat intelligence feeds
    - SSL inspection (MITM your HTTPS)
    - Bypass: CDN fronting, encrypted C2, valid TLS certs

IDS vs IPS:
  IDS (Intrusion Detection System):
    - Passive monitor, generates alerts only
    - Does NOT block traffic
    - Signature-based: known attack patterns
    - Behavioral: anomaly from baseline

  IPS (Intrusion Prevention System):
    - Inline, actively blocks malicious traffic
    - False positive risk = legitimate traffic dropped
    - Evasion = IDS/IPS evasion

EVASION FUNDAMENTALS (details in Chapter 6):
  Fragmentation: reassembly required before inspection
  Slow timing: evade rate-based detection
  Encoding: base64, hex, ROT13 in payloads
  Protocol confusion: tunneling HTTP inside DNS
  Decoy traffic: blend attack with legitimate patterns

Proxies, Load Balancers, NAT

// HOW NETWORK INFRASTRUCTURE CHANGES ATTACK SURFACE
NAT (Network Address Translation):
  Hides internal IPs behind single public IP
  Impact on attacker:
  - Scanning from internet sees only public IP
  - Cannot directly reach internal hosts
  - Bypass: SSRF from internal service, VPN misconfiguration

REVERSE PROXY / LOAD BALANCER:
  Cloudflare, nginx, HAProxy in front of web servers
  Impact:
  - Real server IP hidden behind proxy IP
  - WAF (Web Application Firewall) often present
  - Find real IP via: SSL cert history, DNS history,
    Shodan searches, email headers from app, subdomains
  - Tools: censys, shodan, viewdns.info, securitytrails

FORWARD PROXY:
  Transparent: intercepts all outbound traffic (MITM-able)
  Explicit: clients configured to use proxy
  Impact on attacker:
  - All outbound connections go through proxy
  - Non-HTTP protocols may be blocked
  - But CONNECT method allows TCP tunneling over HTTP!
  - HTTPTunnel, chisel, and others exploit this

CONTENT DELIVERY NETWORK (CDN):
  Traffic flows through CDN edge nodes globally
  Provides DDoS mitigation (absorbs volume attacks)
  SSL termination at CDN edge
  For attackers: CDN fronting (hide C2 behind CDN)
RECAP · CHECK YOURSELF
  • The OSI layer an attack targets determines which tools detect it and which defenses apply - always identify the layer first
  • Every TCP/IP header field is attack surface: spoof src IP for amplification, manipulate TTL for OS fingerprinting, abuse flags for firewall bypass
  • SYN flood works by exhausting the server connection backlog before handshakes complete - SYN cookies mitigate this without memory allocation
  • IPv6 is frequently less monitored than IPv4 on dual-stack networks - NDP (Neighbor Discovery) is the ARP equivalent and equally unauthenticated
  • DNS has no authentication by default - every step in the resolution chain is a potential interception or poisoning point
Read to the end to count this chapter
▸ READY TO PRACTISE
You've now covered enough for Lab steps 1–2 of 21. Try them in the lab while it's fresh.
OPEN LAB ▸
⚡ TEST YOURSELF
End-of-chapter quiz
A dozen questions — recall and practical. Graded, earns up to 20 XP.
READY TO PRACTICE?
MOD-08 Interactive Lab
21 steps · 445 XP · Real commands · Flag captures
LAUNCH LAB →
← MOD-07: MALWAREMOD-09: CLOUD SECURITY →